summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan.liu <xiaowen.liu@nxp.com>2018-11-15 13:58:54 +0800
committerBryan O'Donoghue <bryan.odonoghue@linaro.org>2019-05-01 17:43:25 +0100
commit4827115c1eda06df4be950b2078490a743945f27 (patch)
tree778fec8e9903df49457daabf9ad8dacc009204f3
parent1bb190375c88297a078e49d4cafa1751f2decf00 (diff)
MA-13450-1 [#ccc] Switch layer memory allocation to virtual pool to improve performance.
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)
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_drm.h1
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_drm.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_drm.h
index 97ba6f8832f7..e269cc94baed 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_drm.h
+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_drm.h
@@ -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;
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c
index a047d4eb741a..bfb76ac6b1a3 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c
@@ -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];