summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
authorMichel Dänzer <mdaenzer@redhat.com>2020-02-10 18:41:44 +0100
committerMichel Dänzer <michel@daenzer.net>2020-02-10 18:41:44 +0100
commit0cb9fa7949d6c5398de220fbdbe1e262e943fcbb (patch)
tree89db0d92fa5bbc9c835c3278076c33a8541aa103 /hw/xfree86
parentbfb36a5806196e257958907bfcdd71c24acc5d37 (diff)
modesetting: Fix build with glamor disabled
Fixes: cb1b1e184723 "modesetting: Indirect the glamor API through LoaderSymbol" Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/drivers/modesetting/driver.c21
-rw-r--r--hw/xfree86/drivers/modesetting/driver.h3
2 files changed, 17 insertions, 7 deletions
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d00e4a739..0c1867f02 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -743,9 +743,17 @@ FreeRec(ScrnInfoPtr pScrn)
}
-static void
-bind_glamor_api(void *mod, modesettingPtr ms)
+#ifdef GLAMOR_HAS_GBM
+
+static Bool
+load_glamor(ScrnInfoPtr pScrn)
{
+ void *mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (!mod)
+ return FALSE;
+
ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd");
ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler");
ms->glamor.clear_pixmap = LoaderSymbolFromModule(mod, "glamor_clear_pixmap");
@@ -763,8 +771,12 @@ bind_glamor_api(void *mod, modesettingPtr ms)
ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name");
+
+ return TRUE;
}
+#endif
+
static void
try_enable_glamor(ScrnInfoPtr pScrn)
{
@@ -773,7 +785,6 @@ try_enable_glamor(ScrnInfoPtr pScrn)
OPTION_ACCEL_METHOD);
Bool do_glamor = (!accel_method_str ||
strcmp(accel_method_str, "glamor") == 0);
- void *mod;
ms->drmmode.glamor = FALSE;
@@ -788,9 +799,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
return;
}
- mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
- if (mod) {
- bind_glamor_api(mod, ms);
+ if (load_glamor(pScrn)) {
if (ms->glamor.egl_init(pScrn, ms->fd)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
ms->drmmode.glamor = TRUE;
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
index 60e4aaa96..7ee9f6827 100644
--- a/hw/xfree86/drivers/modesetting/driver.h
+++ b/hw/xfree86/drivers/modesetting/driver.h
@@ -132,6 +132,7 @@ typedef struct _modesettingRec {
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
} shadow;
+#ifdef GLAMOR_HAS_GBM
/* glamor API */
struct {
Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16,
@@ -157,7 +158,7 @@ typedef struct _modesettingRec {
XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
const char *(*egl_get_driver_name)(ScreenPtr);
} glamor;
-
+#endif
} modesettingRec, *modesettingPtr;
#define glamor_finish(screen) ms->glamor.finish(screen)