diff options
author | Keith Packard <keithp@keithp.com> | 2016-06-14 13:19:49 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-06-20 11:55:12 -0700 |
commit | f3248eba6e2d0c099025f8e9a4874b431246eac7 (patch) | |
tree | abee063b1fd6ddda2fb93b9ddc89a008011b4a2b | |
parent | 235d21670dcff224807ff719c7fa86212058ec46 (diff) |
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>
-rw-r--r-- | hw/kdrive/ephyr/ephyr.c | 16 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.c | 20 |
2 files changed, 31 insertions, 5 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 2bc5ccc58..e5f188334 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -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 */ diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index d84c33b2a..abe6edaf0 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -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); |