ephyr: Handle window resize when using glamor

Under glamor, we need to re-create the screen pixmap at the new size
so that we can ask glamor for the associated texture. Fortunately, we
can simply use ephyr_glamor_create_screen_resources to create the new
pixmap.

Because this is being done after the server has started, we need to
walk the window heirarchy and reset any windows pointing at the old
pixmap. I could easily be convinced that this TraverseTree should be
moved to miSetScreenPixmap.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Keith Packard 2016-06-14 13:19:49 -07:00
parent 235d21670d
commit f3248eba6e
2 changed files with 31 additions and 5 deletions

View File

@ -510,6 +510,14 @@ ephyrRandRSetConfig(ScreenPtr pScreen,
screen->width = newwidth;
screen->height = newheight;
scrpriv->win_width = screen->width;
scrpriv->win_height = screen->height;
#ifdef GLAMOR
ephyr_glamor_set_window_size(scrpriv->glamor,
scrpriv->win_width,
scrpriv->win_height);
#endif
if (!ephyrMapFramebuffer(screen))
goto bail4;
@ -520,12 +528,18 @@ ephyrRandRSetConfig(ScreenPtr pScreen,
else
ephyrUnsetInternalDamage(screen->pScreen);
ephyrSetScreenSizes(screen->pScreen);
if (scrpriv->shadow) {
if (!KdShadowSet(screen->pScreen,
scrpriv->randr, ephyrShadowUpdate, ephyrWindowLinear))
goto bail4;
}
else {
#ifdef GLAMOR
if (ephyr_glamor)
ephyr_glamor_create_screen_resources(pScreen);
#endif
/* Without shadow fb ( non rotated ) we need
* to use damage to efficiently update display
* via signal regions what to copy from 'fb'.
@ -534,8 +548,6 @@ ephyrRandRSetConfig(ScreenPtr pScreen,
goto bail4;
}
ephyrSetScreenSizes(screen->pScreen);
/*
* Set frame buffer mapping
*/

View File

@ -1486,13 +1486,25 @@ ephyr_glamor_init(ScreenPtr screen)
return TRUE;
}
static int
ephyrSetPixmapVisitWindow(WindowPtr window, void *data)
{
ScreenPtr screen = window->drawable.pScreen;
if (screen->GetWindowPixmap(window) == data) {
screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen));
return WT_WALKCHILDREN;
}
return WT_DONTWALKCHILDREN;
}
Bool
ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *kd_screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = kd_screen->driver;
PixmapPtr screen_pixmap;
PixmapPtr old_screen_pixmap, screen_pixmap;
uint32_t tex;
if (!ephyr_glamor)
@ -1509,8 +1521,8 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
*
* Thus, delete the current screen pixmap, and put a fresh one in.
*/
screen_pixmap = pScreen->GetScreenPixmap(pScreen);
pScreen->DestroyPixmap(screen_pixmap);
old_screen_pixmap = pScreen->GetScreenPixmap(pScreen);
pScreen->DestroyPixmap(old_screen_pixmap);
screen_pixmap = pScreen->CreatePixmap(pScreen,
pScreen->width,
@ -1519,6 +1531,8 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
GLAMOR_CREATE_NO_LARGE);
pScreen->SetScreenPixmap(screen_pixmap);
if (pScreen->root && pScreen->SetWindowPixmap)
TraverseTree(pScreen->root, ephyrSetPixmapVisitWindow, old_screen_pixmap);
/* Tell the GLX code what to GL texture to read from. */
tex = glamor_get_pixmap_texture(screen_pixmap);