diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 3be7cb0766..e508f9df0f 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -427,7 +427,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) { /* TODO: Is scanout ever used? If so, where? */ bo = gbm_bo_create(glamor_egl->gbm, width, height, format, -#ifdef GLAMOR_HAS_GBM_LINEAR +#ifdef GBM_BO_USE_LINEAR (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? GBM_BO_USE_LINEAR : 0) | #endif @@ -435,7 +435,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) if (!bo) { /* something failed, try again without GBM_BO_USE_SCANOUT */ bo = gbm_bo_create(glamor_egl->gbm, width, height, format, -#ifdef GLAMOR_HAS_GBM_LINEAR +#ifdef GBM_BO_USE_LINEAR (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? GBM_BO_USE_LINEAR : 0) | #endif diff --git a/hw/xfree86/drivers/video/modesetting/dri2.c b/hw/xfree86/drivers/video/modesetting/dri2.c index 615633dbab..c4f69bdd69 100644 --- a/hw/xfree86/drivers/video/modesetting/dri2.c +++ b/hw/xfree86/drivers/video/modesetting/dri2.c @@ -44,7 +44,7 @@ #include "driver.h" #include "dri2.h" -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR enum ms_dri2_frame_event_type { MS_DRI2_QUEUE_SWAP, @@ -1107,4 +1107,4 @@ ms_dri2_close_screen(ScreenPtr screen) DRI2CloseScreen(screen); } -#endif /* GLAMOR_HAS_GBM */ +#endif /* GLAMOR */ diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/video/modesetting/driver.c index a59128c78d..140dad968b 100644 --- a/hw/xfree86/drivers/video/modesetting/driver.c +++ b/hw/xfree86/drivers/video/modesetting/driver.c @@ -286,7 +286,7 @@ check_outputs(int fd, int *count) *count = res->count_connectors; ret = res->count_connectors > 0; -#if defined(GLAMOR_HAS_GBM_LINEAR) +#if defined(GLAMOR) && defined(GBM_BO_USE_LINEAR) if (ret == FALSE) { uint64_t value = 0; if (drmGetCap(fd, DRM_CAP_PRIME, &value) == 0 && @@ -707,7 +707,7 @@ ms_tearfree_update_damages(ScreenPtr pScreen) static void ms_tearfree_do_flips(ScreenPtr pScreen) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); modesettingPtr ms = modesettingPTR(scrn); @@ -824,7 +824,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout) PixmapSyncDirtyHelper(dirty); if (!screen->isGPU) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); /* * When copying from the primary framebuffer to the shared pixmap, @@ -1022,7 +1022,7 @@ FreeScreen(ScrnInfoPtr pScrn) } -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR static Bool load_glamor(ScrnInfoPtr pScrn) @@ -1067,7 +1067,7 @@ try_enable_glamor(ScrnInfoPtr pScrn) ms->drmmode.glamor = FALSE; -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR if (ms->drmmode.force_24_32) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cannot use glamor with 24bpp packed fb\n"); return; @@ -1349,7 +1349,7 @@ PreInit(ScrnInfoPtr pScrn, int flags) if (ms->drmmode.glamor) pScrn->capabilities |= RR_Capability_SinkOffload; } -#ifdef GLAMOR_HAS_GBM_LINEAR +#if defined(GLAMOR) && defined(GBM_BO_USE_LINEAR) if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor) pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload; #endif @@ -1775,7 +1775,7 @@ modesetCreateScreenResources(ScreenPtr pScreen) static Bool msSharePixmapBacking(PixmapPtr ppix, ScreenPtr secondary, void **handle) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(ppix->drawable.pScreen)); int ret; @@ -1795,7 +1795,7 @@ msSharePixmapBacking(PixmapPtr ppix, ScreenPtr secondary, void **handle) static Bool msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR ScreenPtr screen = ppix->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); @@ -1947,7 +1947,6 @@ modesetting_get_cursor_interleave(int fd) return ret; } -#ifdef GLAMOR_HAS_GBM static struct gbm_device* gbm_create_device_by_name(int fd, const char* name) { @@ -1961,7 +1960,6 @@ gbm_create_device_by_name(int fd, const char* name) } return ret; } -#endif static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv) @@ -1975,16 +1973,17 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) if (!SetMaster(pScrn)) return FALSE; -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR if (ms->drmmode.glamor) { ms->drmmode.gbm = ms->glamor.egl_get_gbm_device(pScreen); - } else { + } else +#endif + { ms->drmmode.gbm = gbm_create_device(ms->drmmode.fd); if (!ms->drmmode.gbm) { ms->drmmode.gbm = gbm_create_device_by_name(ms->drmmode.fd, "dumb"); } } -#endif if (!ms->drmmode.gbm) { return FALSE; @@ -2130,7 +2129,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) else xf86DPMSInit(pScreen, xf86DPMSSet, 0); -#ifdef GLAMOR_HAS_GBM +#if defined(GLAMOR) && defined(XV) if (ms->drmmode.glamor) { XF86VideoAdaptorPtr glamor_adaptor; @@ -2152,7 +2151,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) return FALSE; } -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR if (ms->drmmode.glamor) { if (!(ms->drmmode.dri2_enable = ms_dri2_screen_init(pScreen))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -2287,7 +2286,7 @@ CloseScreen(ScreenPtr pScreen) /* Clear mask of assigned crtc's in this generation */ ms_ent->assigned_crtcs = 0; -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR if (ms->drmmode.dri2_enable) { ms_dri2_close_screen(pScreen); } @@ -2317,13 +2316,14 @@ CloseScreen(ScreenPtr pScreen) drmmode_free_bos(pScrn, &ms->drmmode); -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR /* If we didn't get the gbm device from glamor, we have to free it ourserves */ - if (!ms->drmmode.glamor) { + if (!ms->drmmode.glamor) +#endif + { gbm_device_destroy(ms->drmmode.gbm); ms->drmmode.gbm = NULL; } -#endif if (ms->drmmode.pageflip) { miPointerScreenPtr PointPriv = diff --git a/hw/xfree86/drivers/video/modesetting/driver.h b/hw/xfree86/drivers/video/modesetting/driver.h index 81b97a4a08..174318e861 100644 --- a/hw/xfree86/drivers/video/modesetting/driver.h +++ b/hw/xfree86/drivers/video/modesetting/driver.h @@ -39,12 +39,13 @@ #include #include #include -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR #define GLAMOR_FOR_XORG 1 #include "glamor.h" -#include #endif +#include + #include "drmmode_display.h" #define MS_LOGLEVEL_DEBUG 4 @@ -162,7 +163,7 @@ typedef struct _modesettingRec { void (*UpdatePacked)(ScreenPtr, shadowBufPtr); } shadow; -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR /* glamor API */ struct { Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16, @@ -235,7 +236,7 @@ void ms_vblank_close_screen(ScreenPtr screen); Bool ms_present_screen_init(ScreenPtr screen); -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR typedef void (*ms_pageflip_handler_proc)(modesettingPtr ms, uint64_t frame, diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_display.c b/hw/xfree86/drivers/video/modesetting/drmmode_display.c index f604f7a349..667590c036 100644 --- a/hw/xfree86/drivers/video/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/video/modesetting/drmmode_display.c @@ -858,7 +858,7 @@ drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only) if (!drmmode_crtc_get_fb_id(crtc, &fb_id, &x, &y)) return 1; -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR /* Make sure any pending drawing will be visible in a new scanout buffer */ if (drmmode->glamor) glamor_finish(crtc->scrn->pScreen); @@ -1331,7 +1331,7 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode) } } -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR static PixmapPtr create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) { @@ -1376,7 +1376,7 @@ out_free_fb: void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PixmapPtr src, dst; @@ -1426,7 +1426,6 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) void drmmode_copy_damage(xf86CrtcPtr crtc, PixmapPtr dst, RegionPtr dmg, Bool empty) { -#ifdef GLAMOR_HAS_GBM ScreenPtr pScreen = xf86ScrnToScreen(crtc->scrn); DrawableRec *src; @@ -1443,6 +1442,7 @@ drmmode_copy_damage(xf86CrtcPtr crtc, PixmapPtr dst, RegionPtr dmg, Bool empty) if (empty) RegionEmpty(dmg); +#ifdef GLAMOR /* Wait until the GC operations finish */ modesettingPTR(crtc->scrn)->glamor.finish(pScreen); #endif @@ -2179,7 +2179,7 @@ drmmode_clear_pixmap(PixmapPtr pixmap) { ScreenPtr screen = pixmap->drawable.pScreen; GCPtr gc; -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); if (ms->drmmode.glamor) { @@ -3858,7 +3858,7 @@ drmmode_clones_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, drmModeResPtr mode_re static Bool drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, struct gbm_bo *bo) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR ScrnInfoPtr scrn = drmmode->scrn; modesettingPtr ms = modesettingPTR(scrn); @@ -4185,7 +4185,7 @@ drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp) Bool drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR ScreenPtr pScreen = xf86ScrnToScreen(pScrn); modesettingPtr ms = modesettingPTR(pScrn); diff --git a/hw/xfree86/drivers/video/modesetting/pageflip.c b/hw/xfree86/drivers/video/modesetting/pageflip.c index 01a211d8a4..eb20cc5fac 100644 --- a/hw/xfree86/drivers/video/modesetting/pageflip.c +++ b/hw/xfree86/drivers/video/modesetting/pageflip.c @@ -78,7 +78,7 @@ ms_drain_drm_events(ScreenPtr screen) ms_flush_drm_events_timeout(screen, -1); } -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR /* * Event data for an in progress flip. diff --git a/hw/xfree86/drivers/video/modesetting/present.c b/hw/xfree86/drivers/video/modesetting/present.c index db42e8514b..f892bba30f 100644 --- a/hw/xfree86/drivers/video/modesetting/present.c +++ b/hw/xfree86/drivers/video/modesetting/present.c @@ -163,7 +163,7 @@ ms_present_abort_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) { ScreenPtr screen = crtc->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR xf86CrtcPtr xf86_crtc = crtc->devPrivate; /* Check if this is a fake flip routed through TearFree and abort it */ @@ -180,7 +180,7 @@ ms_present_abort_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc) static void ms_present_flush(WindowPtr window) { -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); modesettingPtr ms = modesettingPTR(scrn); @@ -190,7 +190,7 @@ ms_present_flush(WindowPtr window) #endif } -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR /** * Callback for the DRM event queue when a flip has completed on all pipes @@ -517,7 +517,7 @@ static present_screen_info_rec ms_present_screen_info = { .flush = ms_present_flush, .capabilities = PresentCapabilityNone, -#ifdef GLAMOR_HAS_GBM +#ifdef GLAMOR .check_flip = NULL, .check_flip2 = ms_present_check_flip, .flip = ms_present_flip, diff --git a/include/meson.build b/include/meson.build index 269265149b..de9e537959 100644 --- a/include/meson.build +++ b/include/meson.build @@ -106,8 +106,6 @@ conf_data.set('GLAMOR_HAS_EGL_QUERY_DRIVER', conf_data.set('GLXEXT', build_glx ? '1' : false) conf_data.set('GLAMOR', build_glamor ? '1' : false) conf_data.set('GLAMOR_HAS_GBM', gbm_dep.found() ? '1' : false) -conf_data.set('GLAMOR_HAS_GBM_LINEAR', - build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 10.6') ? '1' : false) conf_data.set('GBM_BO_WITH_MODIFIERS', build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 17.1') ? '1' : false) conf_data.set('GBM_BO_FD_FOR_PLANE',