aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glamor/glamor_core.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-21 19:36:05 +0100
committermarha <marha@users.sourceforge.net>2014-03-21 19:36:05 +0100
commit41fea4472dec859ddec76bdfa7108ebec71de1e3 (patch)
tree385ccec6dc105acc75169122d4e0714046cfbbd5 /xorg-server/glamor/glamor_core.c
parentcd8b0d0de3fcb53f6d3ece8ce26d97aaab2c0914 (diff)
downloadvcxsrv-41fea4472dec859ddec76bdfa7108ebec71de1e3.tar.gz
vcxsrv-41fea4472dec859ddec76bdfa7108ebec71de1e3.tar.bz2
vcxsrv-41fea4472dec859ddec76bdfa7108ebec71de1e3.zip
xserver fontconfig libX11 libXext libxcb mesa git update 21 Mar 2014
xserver commit 4fb31e4824d46edc80bb49b4065152899faa5ac6 libxcb commit cb686b576739deea00180c54697c8b62b8419ae0 libX11 commit 8be4610939b833587954957f5963eb4191b43d19 libXext commit 11aad96bd689d54156064d2e81213dc827a689d1 fontconfig commit 5478192f379d784b421329e4bf72cc780818e467 mesa commit 8d8d0cb09eb8735a04fc36cc4d0e2dc9f9d460eb
Diffstat (limited to 'xorg-server/glamor/glamor_core.c')
-rw-r--r--xorg-server/glamor/glamor_core.c65
1 files changed, 49 insertions, 16 deletions
diff --git a/xorg-server/glamor/glamor_core.c b/xorg-server/glamor/glamor_core.c
index 58838095b..6c0b3c834 100644
--- a/xorg-server/glamor/glamor_core.c
+++ b/xorg-server/glamor/glamor_core.c
@@ -42,7 +42,8 @@ glamor_get_drawable_location(const DrawablePtr drawable)
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(drawable->pScreen);
- if (pixmap_priv == NULL || pixmap_priv->base.gl_fbo == 0)
+ if (pixmap_priv == NULL ||
+ pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED)
return 'm';
if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
return 's';
@@ -82,9 +83,10 @@ glamor_compile_glsl_prog(GLenum type, const char *source)
}
void
-glamor_link_glsl_prog(GLint prog)
+glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...)
{
GLint ok;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glLinkProgram(prog);
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
@@ -99,12 +101,36 @@ glamor_link_glsl_prog(GLint prog)
ErrorF("Failed to link: %s\n", info);
FatalError("GLSL link failure\n");
}
+
+ if (glamor_priv->has_khr_debug) {
+ char *label;
+ va_list va;
+
+ va_start(va, format);
+ XNFvasprintf(&label, format, va);
+ glObjectLabel(GL_PROGRAM, prog, -1, label);
+ free(label);
+ va_end(va);
+ }
}
Bool
glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+ if (pixmap->devPrivate.ptr) {
+ /* Already mapped, nothing needs to be done. Note that we
+ * aren't allowing promotion from RO to RW, because it would
+ * require re-mapping the PBO.
+ */
+ assert(!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) ||
+ access == GLAMOR_ACCESS_RO ||
+ pixmap_priv->base.mapped_for_write);
+ return TRUE;
+ }
+ pixmap_priv->base.map_access = access;
return glamor_download_pixmap_to_cpu(pixmap, access);
}
@@ -242,13 +268,15 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(glamor_priv->finish_access_prog[0],
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
- glamor_link_glsl_prog(glamor_priv->finish_access_prog[0]);
+ glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[0],
+ "finish access 0");
glBindAttribLocation(glamor_priv->finish_access_prog[1],
GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(glamor_priv->finish_access_prog[1],
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
- glamor_link_glsl_prog(glamor_priv->finish_access_prog[1]);
+ glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[1],
+ "finish access 1");
glamor_priv->finish_access_revert[0] =
glGetUniformLocation(glamor_priv->finish_access_prog[0], "revert");
@@ -261,7 +289,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_revert[0], 0);
glUniform1i(glamor_priv->finish_access_swap_rb[0], 0);
- glUseProgram(0);
glamor_priv->finish_access_revert[1] =
glGetUniformLocation(glamor_priv->finish_access_prog[1], "revert");
@@ -273,7 +300,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(glamor_priv->finish_access_revert[1], 0);
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
- glUseProgram(0);
glamor_put_context(glamor_priv);
}
@@ -290,7 +316,7 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
}
void
-glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
+glamor_finish_access(DrawablePtr drawable)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
@@ -300,7 +326,15 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv))
return;
- if (access_mode != GLAMOR_ACCESS_RO) {
+ /* If we are doing a series of unmaps from a nested map, we're
+ * done. None of the callers do any rendering to maps after
+ * starting an unmap sequence, so we don't need to delay until the
+ * last nested unmap.
+ */
+ if (!pixmap->devPrivate.ptr)
+ return;
+
+ if (pixmap_priv->base.map_access == GLAMOR_ACCESS_RW) {
glamor_restore_pixmap_to_texture(pixmap);
}
@@ -348,7 +382,7 @@ glamor_prepare_access_gc(GCPtr gc)
if (!glamor_prepare_access(&gc->tile.pixmap->drawable,
GLAMOR_ACCESS_RO)) {
if (gc->stipple)
- glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&gc->stipple->drawable);
return FALSE;
}
}
@@ -362,9 +396,9 @@ void
glamor_finish_access_gc(GCPtr gc)
{
if (gc->fillStyle == FillTiled)
- glamor_finish_access(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&gc->tile.pixmap->drawable);
if (gc->stipple)
- glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&gc->stipple->drawable);
}
Bool
@@ -438,7 +472,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
(&old_tile->drawable, GLAMOR_ACCESS_RO)) {
new_tile =
fb24_32ReformatTile(old_tile, drawable->bitsPerPixel);
- glamor_finish_access(&old_tile->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&old_tile->drawable);
}
}
if (new_tile) {
@@ -461,8 +495,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
if (glamor_prepare_access
(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW)) {
fbPadPixmap(gc->tile.pixmap);
- glamor_finish_access
- (&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW);
+ glamor_finish_access(&gc->tile.pixmap->drawable);
}
}
}
@@ -478,7 +511,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
*/
if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) {
fbValidateGC(gc, changes, drawable);
- glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW);
+ glamor_finish_access(&gc->stipple->drawable);
}
}
else {
@@ -522,7 +555,7 @@ glamor_bitmap_to_region(PixmapPtr pixmap)
if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO))
return NULL;
ret = fbPixmapToRegion(pixmap);
- glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&pixmap->drawable);
return ret;
}