summaryrefslogtreecommitdiff
path: root/glamor/glamor_pixmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'glamor/glamor_pixmap.c')
-rw-r--r--glamor/glamor_pixmap.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index a811f6015..371e486b5 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -66,12 +66,10 @@ void
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0,
int width, int height)
{
- glamor_get_context(fbo->glamor_priv);
+ glamor_make_current(fbo->glamor_priv);
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
glViewport(x0, y0, width, height);
-
- glamor_put_context(fbo->glamor_priv);
}
void
@@ -707,7 +705,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
int non_sub = 0;
unsigned int iformat = 0;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (*tex == 0) {
glGenTextures(1, tex);
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
@@ -735,7 +733,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
if (bits == NULL)
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- glamor_put_context(glamor_priv);
}
static Bool
@@ -832,7 +829,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
x + w, y + h,
glamor_priv->yInverted, vertices);
/* Slow path, we need to flip y or wire alpha to 1. */
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, 2 * sizeof(float), vertices);
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
@@ -859,8 +856,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
glDeleteTextures(1, &tex);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glamor_put_context(glamor_priv);
-
if (need_free_bits)
free(bits);
return TRUE;
@@ -1140,7 +1135,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
if (temp_fbo == NULL)
return NULL;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
temp_xscale = 1.0 / w;
temp_yscale = 1.0 / h;
@@ -1177,7 +1172,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
return temp_fbo;
}
@@ -1255,7 +1249,7 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
fbo_y_off = 0;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
if (glamor_priv->has_pack_invert || glamor_priv->yInverted) {
@@ -1286,7 +1280,7 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
unsigned int temp_pbo;
int yy;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glGenBuffers(1, &temp_pbo);
glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo);
glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, GL_STREAM_READ);
@@ -1301,7 +1295,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glamor_put_context(glamor_priv);
if (need_post_conversion) {
/* As OpenGL desktop version never enters here.
@@ -1473,10 +1466,9 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
data = malloc(stride * pixmap->drawable.height);
}
else {
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (pixmap_priv->base.fbo->pbo == 0)
glGenBuffers(1, &pixmap_priv->base.fbo->pbo);
- glamor_put_context(glamor_priv);
pbo = pixmap_priv->base.fbo->pbo;
}