[RFC xserver 12/16] modesetting: Add support for multi-plane pixmaps when page-flipping

Daniel Stone daniels at collabora.com
Thu Jun 8 18:43:38 UTC 2017


From: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>

This allows the uses of CCS compressed or tiled pixmaps as BOs.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c |  2 +-
 hw/xfree86/drivers/modesetting/pageflip.c        | 27 +++++++++++++++++++-----
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index d7ad91c32..432383ecc 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -265,7 +265,7 @@ drmmode_prop_info_free(drmmode_prop_info_ptr info, int num_props)
 int
 drmmode_bo_destroy(drmmode_ptr drmmode, drmmode_bo *bo)
 {
-    int ret;
+    int i, ret;
 
 #ifdef GLAMOR_HAS_GBM
     if (bo->gbm) {
diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c
index 8cb65e884..546de8758 100644
--- a/hw/xfree86/drivers/modesetting/pageflip.c
+++ b/hw/xfree86/drivers/modesetting/pageflip.c
@@ -349,11 +349,28 @@ ms_do_pageflip(ScreenPtr screen,
 
     /* Create a new handle for the back buffer */
     flipdata->old_fb_id = ms->drmmode.fb_id;
-    if (drmModeAddFB(ms->fd, scrn->virtualX, scrn->virtualY,
-                     scrn->depth, scrn->bitsPerPixel,
-                     drmmode_bo_get_pitch(&new_front_bo),
-                     drmmode_bo_get_handle(&new_front_bo), &ms->drmmode.fb_id)) {
-        goto error_out;
+
+    if (new_front_bo.num_planes > 0 || modifier != 0) {
+        // XXX ifdef
+#ifdef GBM_BO_WITH_MODIFIERS
+        if (drmModeAddFB2WithModifiers(ms->fd, scrn->virtualX, scrn->virtualY,
+                                       format, new_front_bo.handles, strides,
+                                       offsets, modifiers, &ms->drmmode.fb_id,
+                                       DRM_MODE_FB_MODIFIERS)) {
+
+            goto error_out;
+        }
+#else
+        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                   "Multi-plane and modified buffers are not supported\n");
+#endif
+    } else {
+        if (drmModeAddFB(ms->fd, scrn->virtualX, scrn->virtualY,
+                         scrn->depth, scrn->bitsPerPixel,
+                         drmmode_bo_get_pitch(&new_front_bo),
+                         drmmode_bo_get_handle(&new_front_bo), &ms->drmmode.fb_id)) {
+            goto error_out;
+        }
     }
 
     flags = DRM_MODE_PAGE_FLIP_EVENT;
-- 
2.13.0



More information about the xorg-devel mailing list