gfx: gtt: Support unmapping from arbitrary context
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 15 Feb 2012 13:02:30 +0000 (15:02 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:58 +0000 (12:29 +0300)
Pass the 'tgid' down from the caller of psb_gtt_unmap_meminfo(). This
will allow unmapping from eg. workqueues. This will be used to keep
references to the GTT mapping possibly after the drm_framebuffer has
been destroyed.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/drv/psb_fb.c
drivers/staging/mrst/drv/psb_gtt.c
drivers/staging/mrst/drv/psb_gtt.h

index f784ff6..4524c17 100644 (file)
@@ -592,7 +592,7 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
        struct psb_framebuffer *psbfb = to_psb_fb(fb);
 
        /*ummap gtt pages*/
-       psb_gtt_unmap_meminfo(dev, psbfb->pvrBO);
+       psb_gtt_unmap_meminfo(dev, psbfb->pvrBO, psb_get_tgid());
 
        mutex_lock(&gPVRSRVLock);
        PVRSRVUnrefDeviceMemKM(psbfb->pvrBO);
index 2c1f47d..b47f84b 100644 (file)
@@ -933,11 +933,12 @@ static void do_unmap_meminfo(struct kref *kref)
 }
 
 int psb_gtt_unmap_meminfo(struct drm_device *dev,
-                         PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo)
+                         PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo,
+                         uint32_t tgid)
 {
        struct psb_gtt_mem_mapping *mapping;
 
-       mapping = psb_gtt_find_mapping_for_key(dev, psb_get_tgid(),
+       mapping = psb_gtt_find_mapping_for_key(dev, tgid,
                                               (u32) psKernelMemInfo);
        if (IS_ERR(mapping)) {
                DRM_DEBUG("handle is not mapped\n");
@@ -987,7 +988,7 @@ int psb_gtt_unmap_meminfo_ioctl(struct drm_device *dev, void *data,
                return -EINVAL;
        }
 
-       return psb_gtt_unmap_meminfo(dev, psKernelMemInfo);
+       return psb_gtt_unmap_meminfo(dev, psKernelMemInfo, psb_get_tgid());
 }
 
 int psb_gtt_map_pvr_memory(struct drm_device *dev,
index 3d651a5..b7ce7fb 100644 (file)
@@ -91,7 +91,8 @@ extern int psb_gtt_map_meminfo(struct drm_device *dev,
                                PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo,
                                uint32_t *offset);
 extern int psb_gtt_unmap_meminfo(struct drm_device *dev,
-                                PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo);
+                                PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo,
+                                uint32_t tgid);
 extern int psb_gtt_map_meminfo_ioctl(struct drm_device *dev, void *data,
                                     struct drm_file *file_priv);
 extern int psb_gtt_unmap_meminfo_ioctl(struct drm_device *dev, void *data,