MA-13450-1 [#ccc] Switch layer memory allocation to virtual pool to improve performance.
authorIvan.liu <xiaowen.liu@nxp.com>
Thu, 15 Nov 2018 05:58:54 +0000 (13:58 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Add DRM_VIV_GEM_VIRTUAL_POOL flags.
Switch to virtual pool when this flag is set.

Change-Id: I6e1e799cd0b4f81ed1ffbfdabe8f105325fa9644
Signed-off-by: Ivan.liu <xiaowen.liu@nxp.com>
(cherry picked from commit c4bd0fc803409c54d06e3554f4857922d6640925)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_drm.h
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c

index 97ba6f8..e269cc9 100644 (file)
@@ -68,6 +68,7 @@ extern "C" {
 #define DRM_VIV_GEM_CACHED          (1u << 1)
 #define DRM_VIV_GEM_SECURE          (1u << 2)
 #define DRM_VIV_GEM_CMA_LIMIT       (1u << 3)
+#define DRM_VIV_GEM_VIRTUAL_POOL    (1u << 4)
 
 struct drm_viv_gem_create {
     __u64 size;
index a047d4e..bfb76ac 100644 (file)
@@ -168,6 +168,7 @@ static int viv_ioctl_gem_create(struct drm_device *drm, void *data,
     gckVIDMEM_NODE nodeObject;
     gctUINT32 flags = gcvALLOC_FLAG_DMABUF_EXPORTABLE;
     gceSTATUS status = gcvSTATUS_OK;
+    gcePOOL pool = gcvPOOL_DEFAULT;
 
     gal_dev = (gckGALDEVICE)drm->dev_private;
     if (!gal_dev)
@@ -191,6 +192,10 @@ static int viv_ioctl_gem_create(struct drm_device *drm, void *data,
     {
         flags |= gcvALLOC_FLAG_CMA_LIMIT;
     }
+    if (args->flags & DRM_VIV_GEM_VIRTUAL_POOL) {
+        flags &= ~(gcvALLOC_FLAG_CMA_LIMIT | gcvALLOC_FLAG_CONTIGUOUS);
+        pool = gcvPOOL_VIRTUAL;
+    }
 
     gckOS_ZeroMemory(&iface, sizeof(iface));
     iface.command = gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY;
@@ -199,7 +204,7 @@ static int viv_ioctl_gem_create(struct drm_device *drm, void *data,
     iface.u.AllocateLinearVideoMemory.alignment = 256;
     iface.u.AllocateLinearVideoMemory.type = gcvSURF_RENDER_TARGET; /* should be general */
     iface.u.AllocateLinearVideoMemory.flag = flags;
-    iface.u.AllocateLinearVideoMemory.pool = gcvPOOL_DEFAULT;
+    iface.u.AllocateLinearVideoMemory.pool = pool;
     gcmkONERROR(gckDEVICE_Dispatch(gal_dev->device, &iface));
 
     kernel = gal_dev->device->map[gal_dev->device->defaultHwType].kernels[0];