[PATCH 3/8] modesetting: Create helper for glamor_egl_create_textured_screen call.
Kenneth Graunke
kenneth at whitecape.org
Tue Dec 9 16:55:26 PST 2014
This will need to change when we add GBM support; by pulling it into a
helper function, we should only have to edit one place.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
hw/xfree86/drivers/modesetting/driver.c | 14 ++-------
hw/xfree86/drivers/modesetting/drmmode_display.c | 37 ++++++++++++++++--------
hw/xfree86/drivers/modesetting/drmmode_display.h | 1 +
3 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 06b0f21..61c8032 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -886,18 +886,8 @@ CreateScreenResources(ScreenPtr pScreen)
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
return FALSE;
-#ifdef GLAMOR
- if (ms->drmmode.glamor) {
- if (!glamor_egl_create_textured_screen(pScreen,
- ms->drmmode.front_bo->handle,
- pScrn->displayWidth *
- pScrn->bitsPerPixel / 8)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "glamor_egl_create_textured_screen() failed\n");
- return FALSE;
- }
- }
-#endif
+ if (!drmmode_glamor_handle_new_screen_pixmap(&ms->drmmode))
+ return FALSE;
drmmode_uevent_init(pScrn, &ms->drmmode);
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index f88148d..6f6eaf3 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1176,6 +1176,29 @@ drmmode_clones_init(ScrnInfoPtr scrn, drmmode_ptr drmmode)
}
}
+Bool
+drmmode_glamor_handle_new_screen_pixmap(drmmode_ptr drmmode)
+{
+#ifdef GLAMOR
+ ScrnInfoPtr scrn = drmmode->scrn;
+ ScreenPtr screen = xf86ScrnToScreen(drmmode->scrn);
+
+ if (!drmmode->glamor)
+ return TRUE;
+
+ if (!glamor_egl_create_textured_screen(screen,
+ drmmode->front_bo->handle,
+ scrn->displayWidth *
+ scrn->bitsPerPixel / 8)) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "glamor_egl_create_textured_screen() failed\n");
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
static Bool
drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
{
@@ -1243,18 +1266,8 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
screen->ModifyPixmapHeader(ppix, width, height, -1, -1, pitch, new_pixels);
-#ifdef GLAMOR
- if (drmmode->glamor) {
- if (!glamor_egl_create_textured_screen(screen,
- drmmode->front_bo->handle,
- scrn->displayWidth *
- scrn->bitsPerPixel / 8)) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "glamor_egl_create_textured_screen() failed\n");
- goto fail;
- }
- }
-#endif
+ if (!drmmode_glamor_handle_new_screen_pixmap(drmmode))
+ goto fail;
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 92e2816..a8df7ca 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -129,6 +129,7 @@ extern DevPrivateKeyRec msPixmapPrivateKeyRec;
#define msGetPixmapPriv(drmmode, p) ((msPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &(drmmode)->pixmapPrivateKeyRec))
+Bool drmmode_glamor_handle_new_screen_pixmap(drmmode_ptr drmmode);
void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv);
Bool drmmode_SetSlaveBO(PixmapPtr ppix,
drmmode_ptr drmmode,
--
2.1.3
More information about the xorg-devel
mailing list