drmmode_display.c :Exynos: Fix the flicker issue in HW cursor

To enable the overlay for HW cursor layer a specific ioctl need to
be called. This Ioctl will set the postion of layer and thus calling
chroma keying, which is required for overlay.

BUG=Flicker in browser tab is being observed which I guess
	is in x86 too
TEST=Tested on Daisy with xorg.conf having HWCursor "true"

Change-Id: Ibf04777fa9da331e6b6d69713f324e7dbd862d1c
Signed-off-by: Akshu <akshu.a@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/25276
Reviewed-by: Anush Elangovan <anush@google.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index c55f81e..29c6210 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -139,6 +139,14 @@
 
 static void drmmode_output_dpms(xf86OutputPtr output, int mode);
 
+struct drm_exynos_plane_set_zpos {
+	 __u32 plane_id;
+	 __s32 zpos;
+};
+#define DRM_EXYNOS_PLANE_SET_ZPOS       0x06
+#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
+		DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
+
 static drmmode_ptr
 drmmode_from_scrn(ScrnInfoPtr pScrn)
 {
@@ -366,6 +374,8 @@
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	drmmode_cursor_ptr cursor = drmmode->cursor;
+
+	struct drm_exynos_plane_set_zpos data;
 	int crtc_x, crtc_y, src_x, src_y, w, h;
 
 	if (!cursor)
@@ -400,6 +410,10 @@
 		h = crtc->mode.VDisplay - crtc_y;
 	}
 
+	data.plane_id = cursor->ovr->plane_id;
+	data.zpos = 1;
+	ioctl(drmmode->fd, DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS, &data);
+
 	/* note src coords (last 4 args) are in Q16 format */
 	drmModeSetPlane(drmmode->fd, cursor->ovr->plane_id,
 			drmmode_crtc->mode_crtc->crtc_id, cursor->fb_id, 0,