From f3ab3d0c6123c8e7ddd3be6142f721590d153848 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 18 Jul 2019 13:57:02 +0100 Subject: [PATCH] glamor_egl: disable modifiers via glamor_init() Currently we parse through xf86Info.debug to check if we the modifiers should be disabled. Handle that within DDX and pass GLAMOR_NO_MODIFIERS into the glamor_init() flags. This allows individual DDX control over the setting - say when modifiers are woking OK with one implementation and not the other. Most importantly, this removes the final xf86 piece from the codebase. Signed-off-by: Emil Velikov --- glamor/glamor.h | 4 +++- glamor/glamor_egl.c | 7 +++---- hw/xfree86/drivers/modesetting/drmmode_display.c | 8 +++++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/glamor/glamor.h b/glamor/glamor.h index 77df1ff96..d35364950 100644 --- a/glamor/glamor.h +++ b/glamor/glamor.h @@ -68,8 +68,10 @@ typedef Bool (*GetDrawableModifiersFuncPtr) (DrawablePtr draw, #define GLAMOR_EGL_EXTERNAL_BUFFER 3 #define GLAMOR_USE_EGL_SCREEN (1 << 0) #define GLAMOR_NO_DRI3 (1 << 1) +#define GLAMOR_NO_MODIFIERS (1 << 2) #define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \ - | GLAMOR_NO_DRI3) + | GLAMOR_NO_DRI3 \ + | GLAMOR_NO_MODIFIERS) /* until we need geometry shaders GL3.1 should suffice. */ #define GLAMOR_GL_CORE_VER_MAJOR 3 diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 8ddfb62bb..8821813f1 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -870,6 +870,9 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) */ glamor_enable_dri3(screen); + if (glamor_priv->flags & GLAMOR_NO_MODIFIERS) + glamor_egl->dmabuf_capable = FALSE; + /* If the driver wants to do its own auth dance (e.g. Xwayland * on pre-3.15 kernels that don't have render nodes and thus * has the wayland compositor as a master), then it needs us @@ -1034,10 +1037,6 @@ glamor_egl_init(ScreenPtr screen, int fd) "EGL_EXT_image_dma_buf_import") && epoxy_has_egl_extension(glamor_egl->display, "EGL_EXT_image_dma_buf_import_modifiers")) { - if (xf86Info.debug != NULL) - glamor_egl->dmabuf_capable = !!strstr(xf86Info.debug, - "dmabuf_capable"); - else glamor_egl->dmabuf_capable = TRUE; } #endif diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index f621df52f..27a520743 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -36,6 +36,7 @@ #include "dumb_bo.h" #include "inputstr.h" #include "xf86str.h" +#include "xf86Priv.h" #include "X11/Xatom.h" #include "micmap.h" #include "xf86cmap.h" @@ -3412,7 +3413,12 @@ drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode) ScreenPtr pScreen = xf86ScrnToScreen(pScrn); if (drmmode->glamor) { - if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) { + unsigned int flags = GLAMOR_USE_EGL_SCREEN; + + if (xf86Info.debug != NULL && !strstr(xf86Info.debug, "dmabuf_capable")) + flags |= GLAMOR_NO_MODIFIERS; + + if (!glamor_init(pScreen, flags)) { return FALSE; } #ifdef GBM_BO_WITH_MODIFIERS