[PATCH 5/8] glamor: Promote the screen pixmap to a texture when it starts as MEMORY.
Eric Anholt
eric at anholt.net
Mon Feb 3 10:36:46 PST 2014
If you're building a new X Server and trying to light up glamor, one
of the first things you want to do is get it rendering the screen to a
texture so you can later draw that to some real output (or possibly
not draw it at all, if it's Xvfb-like). Don't just leave it in a
segfaulting MEMORY state.
Signed-off-by: Eric Anholt <eric at anholt.net>
---
glamor/glamor.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 5947d7f..65fabc2 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -115,6 +115,23 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
+
+ /* If the screen pixmap hasn't already been set up to be some special
+ * pixmap type, then promote it to GLAMOR_TEXTURE_ONLY now.
+ */
+ if (pixmap_priv->type == GLAMOR_MEMORY) {
+ GLenum format;
+ glamor_pixmap_fbo *fbo;
+
+ gl_iformat_for_depth(screen_pixmap->drawable.depth, &format);
+ glamor_set_pixmap_type(screen_pixmap, GLAMOR_TEXTURE_ONLY);
+ fbo = glamor_create_fbo(glamor_priv,
+ screen_pixmap->drawable.width,
+ screen_pixmap->drawable.height,
+ format, 0);
+ glamor_pixmap_attach_fbo(screen_pixmap, fbo);
+ }
+
glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb;
pixmap_priv->base.fbo->width = screen_pixmap->drawable.width;
--
1.9.rc1
More information about the xorg-devel
mailing list