Commit 0cb9fa79 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer

modesetting: Fix build with glamor disabled

Fixes: cb1b1e18 "modesetting: Indirect the glamor API through
                     LoaderSymbol"
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent bfb36a58
...@@ -743,9 +743,17 @@ FreeRec(ScrnInfoPtr pScrn) ...@@ -743,9 +743,17 @@ FreeRec(ScrnInfoPtr pScrn)
} }
static void #ifdef GLAMOR_HAS_GBM
bind_glamor_api(void *mod, modesettingPtr ms)
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.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd");
ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler"); ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler");
ms->glamor.clear_pixmap = LoaderSymbolFromModule(mod, "glamor_clear_pixmap"); ms->glamor.clear_pixmap = LoaderSymbolFromModule(mod, "glamor_clear_pixmap");
...@@ -763,8 +771,12 @@ bind_glamor_api(void *mod, modesettingPtr ms) ...@@ -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.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init"); ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name"); ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name");
return TRUE;
} }
#endif
static void static void
try_enable_glamor(ScrnInfoPtr pScrn) try_enable_glamor(ScrnInfoPtr pScrn)
{ {
...@@ -773,7 +785,6 @@ try_enable_glamor(ScrnInfoPtr pScrn) ...@@ -773,7 +785,6 @@ try_enable_glamor(ScrnInfoPtr pScrn)
OPTION_ACCEL_METHOD); OPTION_ACCEL_METHOD);
Bool do_glamor = (!accel_method_str || Bool do_glamor = (!accel_method_str ||
strcmp(accel_method_str, "glamor") == 0); strcmp(accel_method_str, "glamor") == 0);
void *mod;
ms->drmmode.glamor = FALSE; ms->drmmode.glamor = FALSE;
...@@ -788,9 +799,7 @@ try_enable_glamor(ScrnInfoPtr pScrn) ...@@ -788,9 +799,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
return; return;
} }
mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME); if (load_glamor(pScrn)) {
if (mod) {
bind_glamor_api(mod, ms);
if (ms->glamor.egl_init(pScrn, ms->fd)) { if (ms->glamor.egl_init(pScrn, ms->fd)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
ms->drmmode.glamor = TRUE; ms->drmmode.glamor = TRUE;
......
...@@ -132,6 +132,7 @@ typedef struct _modesettingRec { ...@@ -132,6 +132,7 @@ typedef struct _modesettingRec {
void (*UpdatePacked)(ScreenPtr, shadowBufPtr); void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
} shadow; } shadow;
#ifdef GLAMOR_HAS_GBM
/* glamor API */ /* glamor API */
struct { struct {
Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16, Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16,
...@@ -157,7 +158,7 @@ typedef struct _modesettingRec { ...@@ -157,7 +158,7 @@ typedef struct _modesettingRec {
XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int); XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
const char *(*egl_get_driver_name)(ScreenPtr); const char *(*egl_get_driver_name)(ScreenPtr);
} glamor; } glamor;
#endif
} modesettingRec, *modesettingPtr; } modesettingRec, *modesettingPtr;
#define glamor_finish(screen) ms->glamor.finish(screen) #define glamor_finish(screen) ms->glamor.finish(screen)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment