[PATCH xserver 3/5] ephyr: Handle window resize when using glamor
Keith Packard
keithp at keithp.com
Tue Jun 14 21:02:49 UTC 2016
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 at keithp.com>
---
hw/kdrive/ephyr/ephyr.c | 16 ++++++++++++++--
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 2bc5ccc..e5f1883 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 d84c33b..abe6eda 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);
--
2.8.1
More information about the xorg-devel
mailing list