1. 05 Dec, 2012 4 commits
    • Egbert Eich's avatar
      drm/exynos: fix memory leak to EDID block · 3dc5fa9a
      Egbert Eich authored
      drm_get_edid() returns a pointer to an EDID block. The caller
      is responsible to free this pointer itself.
      Here the pointer gets assigned to the local variable raw_edid.
      Therefore it should be freed before the variable goes out of
      scope.
      Signed-off-by: default avatarEgbert Eich <eich@suse.de>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      3dc5fa9a
    • Prathyush K's avatar
      drm/exynos: remove 'pages' and 'page_size' elements in exynos gem buffer · 465ed660
      Prathyush K authored
      Changelog v2:
      
      Removed redundant check for invalid sgl.
      Added check for valid page_offset in the beginning of exynos_drm_gem_map_buf.
      
      Changelog v1:
      
      The 'pages' structure is not required since we can use the 'sgt'. Even for
      CONTIG buffers, a SGT is created (which will have just one sgl). This SGT
      can be used during mmap instead of 'pages'. The 'page_size' element of the
      structure is also not used anywhere and is removed.
      This patch also fixes a memory leak where the 'pages' structure was being
      allocated during gem buffer allocation but not being freed during deallocate.
      Signed-off-by: default avatarPrathyush K <prathyush.k@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      465ed660
    • Prathyush K's avatar
      drm/exynos: add exynos drm specific fb_mmap function · dd265850
      Prathyush K authored
      Changelog v3:
      
      Passing the actual buffer size instead of vm_size to dma_mmap_attrs.
      
      Changelog v2:
      
      Extracting the private data from fb_info structure to obtain the exynos
      gem buffer structure. Now, dma address is obtained from the exynos gem
      buffer structure and not from smem_start. Also calling dma_mmap_attrs
      (instead of dma_mmap_writecombine) with the same attributes used
      during allocation.
      
      Changelog v1:
      
      This patch adds a exynos drm specific implementation of fb_mmap
      which supports mapping a non-contiguous buffer to user space.
      
      This new function does not assume that the frame buffer is contiguous
      and calls dma_mmap_writecombine for mapping the buffer to user space.
      dma_mmap_writecombine will be able to map a contiguous buffer as well
      as non-contig buffer depending on whether an IOMMU mapping is created
      for drm or not.
      Signed-off-by: default avatarPrathyush K <prathyush.k@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      dd265850
    • Inki Dae's avatar
      drm/exynos: make sure that overlay data are updated · 1daa892c
      Inki Dae authored
      Changelog v2:
      fix a little bit performance issue to previous patch.
      - When drm framebuffer is destroyed, make sure that overlay
        data are updated to real hardwrae for all encoders
        instead of waiting for vblank every page flip request.
        For this, it adds a new function,
        exynos_drm_encoder_complete_scanout function.
      
      Changelog v1:
      This patch removes wait_for_vblank call from
      exynos_drm_encoder_plane_disable function and move it to
      exynos_drm_encoder_plane_commit function.
      
      Disabling dma channel to each plane doens't need vblank
      signal to update data to real hardware. But updating
      overlay data to real hardware does need vblank signal.
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      1daa892c
  2. 04 Dec, 2012 7 commits
    • Inki Dae's avatar
      drm/exynos: add vm_ops to specific gem mmaper · 5b07c660
      Inki Dae authored
      Changelog v3:
      use drm_file's file object instead of gem object's
      - gem object's file represents the shmem storage so
        process-unique file object should be used instead.
      
      Changelog v2:
      call mutex_lock before drm_vm_open_locked is called.
      
      Changelog v1:
      This patch makes it takes a reference to gem object when
      specific gem mmap is requested. For this, it sets
      dev->driver->gem_vm_ops to vma->vm_ops.
      
      And this patch is based on exynos-drm-next-iommu branch of
      	git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynosSigned-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      5b07c660
    • Inki Dae's avatar
      drm/exynos: add userptr feature for g2d module · 2a3098ff
      Inki Dae authored
      This patch adds userptr feautre for G2D module.
      
      The userptr means user space address allocated by malloc().
      And the purpose of this feature is to make G2D's dma able
      to access the user space region.
      
      To user this feature, user should flag G2D_BUF_USRPTR to
      offset variable of struct drm_exynos_g2d_cmd and fill
      struct drm_exynos_g2d_userptr with user space address
      and size for it and then should set a pointer to
      drm_exynos_g2d_userptr object to data variable of struct
      drm_exynos_g2d_cmd. The last bit of offset variable is used
      to check if the cmdlist's buffer type is userptr or not.
      If userptr, the g2d driver gets user space address and size
      and then gets pages through get_user_pages().
      (another case is counted as gem handle)
      
      Below is sample codes:
      
      static void set_cmd(struct drm_exynos_g2d_cmd *cmd,
      		unsigned long offset, unsigned long data)
      {
      	cmd->offset = offset;
      	cmd->data = data;
      }
      
      static int solid_fill_test(int x, int y, unsigned long userptr)
      {
      	struct drm_exynos_g2d_cmd cmd_gem[5];
      	struct drm_exynos_g2d_userptr g2d_userptr;
      	unsigned int gem_nr = 0;
      	...
      
      	g2d_userptr.userptr = userptr;
      	g2d_userptr.size = x * y * 4;
      
      	set_cmd(&cmd_gem[gem_nr++], DST_BASE_ADDR_REG |
      					G2D_BUF_USERPTR,
      			(unsigned long)&g2d_userptr);
      	...
      }
      
      int main(int argc, char **argv)
      {
      	unsigned long addr;
      	...
      
      	addr = malloc(x * y * 4);
      	...
      
      	solid_fill_test(x, y, addr);
      	...
      }
      
      And next, the pages are mapped with iommu table and the device
      address is set to cmdlist so that G2D's dma can access it.
      As you may know, the pages from get_user_pages() are pinned.
      In other words, they CAN NOT be migrated and also swapped out.
      So the dma access would be safe.
      
      But the use of userptr feature has performance overhead so
      this patch also has memory pool to the userptr feature.
      Please, assume that user sends cmdlist filled with userptr
      and size every time to g2d driver, and the get_user_pages
      funcion will be called every time.
      
      The memory pool has maximum 64MB size and the userptr that
      user had ever sent, is holded in the memory pool.
      This meaning is that if the userptr from user is same as one
      in the memory pool, device address to the userptr in the memory
      pool is set to cmdlist.
      
      And last, the pages from get_user_pages() will be freed once
      user calls free() and the dma access is completed. Actually,
      get_user_pages() takes 2 reference counts if the user process
      has never accessed user region allocated by malloc(). Then, if
      the user calls free(), the page reference count becomes 1 and
      becomes 0 with put_page() call. And the reverse holds as well.
      This means how the pages backed are used by dma and freed.
      
      This patch is based on "drm/exynos: add iommu support for g2d",
      	https://patchwork.kernel.org/patch/1629481/Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      2a3098ff
    • Prathyush K's avatar
      drm/exynos: remove unnecessary sg_alloc_table call · 1119707e
      Prathyush K authored
      The function dma_get_sgtable will allocate a sg table internally so
      it is not necessary to allocate a sg table before it. The unnecessary
      'sg_alloc_table' call is removed.
      Signed-off-by: default avatarPrathyush K <prathyush.k@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      1119707e
    • Rahul Sharma's avatar
      drm: exynos: fix for mapping of dma buffers · 4ddc404b
      Rahul Sharma authored
      This patch fixes the problem of mapping contigous and non contigous dma buffers.
      
      Currently page struct is calculated from the buf->dma_addr which is not the
      physical address. It is replaced by buf->pages which points to the page struct
      of the first page of contigous memory chunk. This gives the correct page frame
      number for mapping.
      
      Non-contigous dma buffers are described using SG table and SG lists. Each
      valid SG List is pointing to a single page or group of pages which are
      physically contigous. Current implementation just maps the first page of each
      SG List and leave the other pages unmapped, leading to a crash. Given solution
      finds the page struct for the faulting page through parsing SG table and map it.
      Signed-off-by: default avatarRahul Sharma <rahul.sharma@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      4ddc404b
    • Inki Dae's avatar
      drm/exynos: remove EXYNOS_BO_NONCONTIG type checking. · ea6d66c3
      Inki Dae authored
      With iommu support, non-continuous buffer also is supported so
      this patch removes these checking from exynos_drm_gem_get/put_dma_addr
      funciton.
      
      This patch is based on the below patch set, "drm/exynos: add
      iommu support for -next".
      	http://www.spinics.net/lists/dri-devel/msg29041.htmlSigned-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      ea6d66c3
    • Inki Dae's avatar
      drm/exynos: add iommu support for g2d · d87342c1
      Inki Dae authored
      Chagelog v2:
      removed unnecessary structure, struct g2d_gem_node.
      
      Chagelog v1:
      This patch adds iommu support for g2d driver. For this, it
      adds subdrv_probe/remove callback to enable or disable
      g2d iommu. And with this patch, in case of using g2d iommu,
      we can get or put device address to a gem handle from user
      through exynos_drm_gem_get/put_dma_addr(). Actually, these
      functions take a reference to a gem handle so that the gem
      object used by g2d dma is released properly.
      
      And runqueue_node has a pointer to drm_file object of current
      process to manage gem handles to owner.
      
      This patch is based on the below patch set, "drm/exynos: add
      iommu support for -next".
           http://www.spinics.net/lists/dri-devel/msg29041.htmlSigned-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      d87342c1
    • Inki Dae's avatar
      drm/exynos: add iommu support for hdmi driver · 1055b39f
      Inki Dae authored
      Changelog v2:
      move iommu support feature to mixer side.
      And below is Prathyush's comment.
      
      According to the new IOMMU framework for exynos sysmmus,
      the owner of the sysmmu-tv is mixer (which is the actual
      device that does DMA) and not hdmi.
      The mmu-master in sysmmu-tv node is set as below in exynos5250.dtsi
      	sysmmu-tv {
      		-
      		mmu-master = <&mixer>;
      	};
      
      Changelog v1:
      The iommu will be enabled when hdmi sub driver is probed and
      will be disabled when removed.
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      1055b39f
  3. 29 Nov, 2012 17 commits
  4. 28 Nov, 2012 12 commits