Commit 1edf0cc6 authored by Zhigang Gong's avatar Zhigang Gong Committed by Zhigang Gong

glamor: Don't write back read only pixmap to fbo.

For those pixmap which has valid fbo and opened as GLAMOR_ACCESS_RO
mode, we don't need to upload the texture back when calling the
glamor_finish_access(). This will get about 10% performance gain.
parent 1495ba9e
......@@ -332,6 +332,7 @@ glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
return FALSE;
}
pixmap_priv->access_mode = access;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, pixmap_priv->fb);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ROW_LENGTH, row_length);
......@@ -468,6 +469,9 @@ glamor_finish_access(DrawablePtr drawable)
if (pixmap->devPrivate.ptr == NULL)
return;
if (pixmap_priv->access_mode == GLAMOR_ACCESS_RO)
goto read_only;
stride = pixmap->devKind;
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
switch (drawable->depth) {
......@@ -526,6 +530,7 @@ glamor_finish_access(DrawablePtr drawable)
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDeleteTextures(1, &tex);
read_only:
if (GLEW_MESA_pack_invert || glamor_priv->yInverted) {
glBindBufferARB (GL_PIXEL_PACK_BUFFER_EXT, pixmap_priv->pbo);
glUnmapBufferARB (GL_PIXEL_PACK_BUFFER_EXT);
......
......@@ -193,6 +193,7 @@ typedef struct glamor_pixmap_private {
GLuint fb;
GLuint pbo;
enum glamor_pixmap_type type;
glamor_access_t access_mode;
} glamor_pixmap_private;
extern DevPrivateKey glamor_screen_private_key;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment