modesetting: Create helper for glamor_egl_create_textured_screen call.

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@whitecape.org>
Tested-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Kenneth Graunke 2014-12-09 15:18:39 -08:00
parent b4324c6a23
commit af4f94b08e
3 changed files with 28 additions and 24 deletions

View File

@ -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);

View File

@ -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];

View File

@ -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,