[PATCH xserver 03/12] modesetting: Drop code for GLAMOR && !GLAMOR_HAS_GBM.
Eric Anholt
eric at anholt.net
Tue May 16 18:37:14 UTC 2017
The glamor_egl module that the GLAMOR paths are using is only built if
GLAMOR_HAS_GBM is true, and there's no plan for implementing the
module without GBM. Simplify modesetting's code as a result.
Signed-off-by: Eric Anholt <eric at anholt.net>
---
hw/xfree86/drivers/modesetting/dri2.c | 4 ++--
hw/xfree86/drivers/modesetting/driver.c | 14 +++++++-------
hw/xfree86/drivers/modesetting/driver.h | 6 ++----
hw/xfree86/drivers/modesetting/drmmode_display.c | 19 ++++---------------
hw/xfree86/drivers/modesetting/pageflip.c | 2 +-
hw/xfree86/drivers/modesetting/present.c | 8 +++-----
6 files changed, 19 insertions(+), 34 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
index 8944ef1364ae..bfaea3b843da 100644
--- a/hw/xfree86/drivers/modesetting/dri2.c
+++ b/hw/xfree86/drivers/modesetting/dri2.c
@@ -42,7 +42,7 @@
#include "driver.h"
#include "dri2.h"
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
enum ms_dri2_frame_event_type {
MS_DRI2_QUEUE_SWAP,
@@ -1113,4 +1113,4 @@ ms_dri2_close_screen(ScreenPtr screen)
DRI2CloseScreen(screen);
}
-#endif /* GLAMOR */
+#endif /* GLAMOR_HAS_GBM */
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index a1451fe471e8..f371198a99be 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -593,7 +593,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout)
PixmapSyncDirtyHelper(dirty);
if (!screen->isGPU) {
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
/*
* When copying from the master framebuffer to the shared pixmap,
* we must ensure the copy is complete before the slave starts a
@@ -738,7 +738,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
ms->drmmode.glamor = FALSE;
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
if (ms->drmmode.force_24_32) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cannot use glamor with 24bpp packed fb\n");
return;
@@ -1410,7 +1410,7 @@ msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
static Bool
msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
{
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
ScreenPtr screen = ppix->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
modesettingPtr ms = modesettingPTR(scrn);
@@ -1599,7 +1599,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
fbPictureInit(pScreen, NULL, 0);
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
if (ms->drmmode.glamor) {
if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1666,7 +1666,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
xf86DPMSInit(pScreen, xf86DPMSSet, 0);
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
if (ms->drmmode.glamor) {
XF86VideoAdaptorPtr glamor_adaptor;
@@ -1688,7 +1688,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
if (ms->drmmode.glamor) {
if (!ms_dri2_screen_init(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1789,7 +1789,7 @@ CloseScreen(ScreenPtr pScreen)
/* Clear mask of assigned crtc's in this generation */
ms_ent->assigned_crtcs = 0;
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
if (ms->drmmode.glamor) {
ms_dri2_close_screen(pScreen);
}
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
index 25e3a547d43d..bfdc66c8933a 100644
--- a/hw/xfree86/drivers/modesetting/driver.h
+++ b/hw/xfree86/drivers/modesetting/driver.h
@@ -33,13 +33,11 @@
#include <xf86Crtc.h>
#include <damage.h>
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
#define GLAMOR_FOR_XORG 1
#include "glamor.h"
-#ifdef GLAMOR_HAS_GBM
#include <gbm.h>
#endif
-#endif
#include "drmmode_display.h"
#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
@@ -146,7 +144,7 @@ void ms_vblank_close_screen(ScreenPtr screen);
Bool ms_present_screen_init(ScreenPtr screen);
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
typedef void (*ms_pageflip_handler_proc)(modesettingPtr ms,
uint64_t frame,
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index bbca8ca704a5..850888c94cf3 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -496,7 +496,7 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
drmmode_crtc->dpms_mode = mode;
}
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
static PixmapPtr
create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
{
@@ -546,7 +546,7 @@ out_free_fb:
void
drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
{
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
PixmapPtr src, dst;
@@ -1895,27 +1895,16 @@ drmmode_clones_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, drmModeResPtr mode_re
static Bool
drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo)
{
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
ScrnInfoPtr scrn = drmmode->scrn;
if (!drmmode->glamor)
return TRUE;
-#ifdef GLAMOR_HAS_GBM
if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed");
return FALSE;
}
-#else
- if (!glamor_egl_create_textured_pixmap(pixmap,
- drmmode_bo_get_handle(&drmmode->front_bo),
- scrn->displayWidth *
- scrn->bitsPerPixel / 8)) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "glamor_egl_create_textured_pixmap() failed\n");
- return FALSE;
- }
-#endif
#endif
return TRUE;
@@ -1930,7 +1919,7 @@ drmmode_glamor_handle_new_screen_pixmap(drmmode_ptr drmmode)
if (!drmmode_set_pixmap_bo(drmmode, screen_pixmap, &drmmode->front_bo))
return FALSE;
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
if (drmmode->glamor)
glamor_set_screen_pixmap(screen_pixmap, NULL);
#endif
diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c
index 4dc05ec81255..d5fd0625bd14 100644
--- a/hw/xfree86/drivers/modesetting/pageflip.c
+++ b/hw/xfree86/drivers/modesetting/pageflip.c
@@ -63,7 +63,7 @@ ms_flush_drm_events(ScreenPtr screen)
return 1;
}
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
/*
* Event data for an in progress flip.
diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index 55b622cbc0d9..fcff8ee16270 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -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
+#ifdef GLAMOR_HAS_GBM
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
+#ifdef GLAMOR_HAS_GBM
/**
* Callback for the DRM event queue when a flip has completed on all pipes
@@ -255,10 +255,8 @@ ms_present_check_flip(RRCrtcPtr crtc,
drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private;
/* Don't do pageflipping if CRTCs are rotated. */
-#ifdef GLAMOR_HAS_GBM
if (drmmode_crtc->rotate_bo.gbm)
return FALSE;
-#endif
if (ms_crtc_on(config->crtc[i]))
num_crtcs_on++;
@@ -387,7 +385,7 @@ static present_screen_info_rec ms_present_screen_info = {
.flush = ms_present_flush,
.capabilities = PresentCapabilityNone,
-#ifdef GLAMOR
+#ifdef GLAMOR_HAS_GBM
.check_flip = ms_present_check_flip,
.flip = ms_present_flip,
.unflip = ms_present_unflip,
--
2.11.0
More information about the xorg-devel
mailing list