[PATCH xserver 2/7] drmmode: Track if BO allocation used modifiers

Daniel Stone daniels at collabora.com
Wed Apr 4 15:16:33 UTC 2018


Keep track of whether or not we fed modifiers into GBM when we allocated
a BO. We'll use this later inside Glamor, to reallocate buffer storage
if we allocate buffer storage using modifiers, and a non-modifier-aware
client requests an export of that pixmap.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels at collabora.com>
Reported-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 5 ++++-
 hw/xfree86/drivers/modesetting/drmmode_display.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index fc1aef2b6..aeb44263b 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1022,13 +1022,16 @@ drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
                                                    format, modifiers,
                                                    num_modifiers);
             free(modifiers);
-            if (bo->gbm)
+            if (bo->gbm) {
+                bo->used_modifiers = TRUE;
                 return TRUE;
+            }
         }
 #endif
 
         bo->gbm = gbm_bo_create(drmmode->gbm, width, height, format,
                                 GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
+        bo->used_modifiers = FALSE;
         return bo->gbm != NULL;
     }
 #endif
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 4e1e013ff..74954b853 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -75,6 +75,7 @@ typedef struct {
     uint32_t height;
     struct dumb_bo *dumb;
 #ifdef GLAMOR_HAS_GBM
+    Bool used_modifiers;
     struct gbm_bo *gbm;
 #endif
 } drmmode_bo;
-- 
2.17.0



More information about the xorg-devel mailing list