glamor: Replace glamor_get/put_context() with just glamor_make_current().
Now that we have the DIX global state for the current context, we don't need to track nesting to try to reduce MakeCurrent overhead. v2: Fix a mistaken replacement of a put_context with make_current in glamor_fill_spans_gl() (caught by keithp). Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1) Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
This commit is contained in:
parent
11ff12d4e7
commit
fab0a4a4c9
|
@ -248,11 +248,10 @@ glamor_block_handler(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_priv->tick++;
|
||||
glFlush();
|
||||
glamor_fbo_expire(glamor_priv);
|
||||
glamor_put_context(glamor_priv);
|
||||
if (glamor_priv->state == RENDER_STATE
|
||||
&& glamor_priv->render_idle_cnt++ > RENDER_IDEL_MAX) {
|
||||
glamor_priv->state = IDLE_STATE;
|
||||
|
@ -265,9 +264,8 @@ _glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = data;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glFlush();
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -43,14 +43,7 @@ struct glamor_context {
|
|||
/** The GLXDrawable we should MakeCurrent to */
|
||||
uint32_t drawable_xid;
|
||||
|
||||
/**
|
||||
* Count of how deep in glamor_get_context() we are, to reduce
|
||||
* MakeCurrent calls.
|
||||
*/
|
||||
int get_count;
|
||||
|
||||
void (*get_context)(struct glamor_context *glamor_ctx);
|
||||
void (*put_context)(struct glamor_context *glamor_ctx);
|
||||
void (*make_current)(struct glamor_context *glamor_ctx);
|
||||
};
|
||||
|
||||
Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx);
|
||||
|
|
|
@ -70,7 +70,7 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
|
|||
pixmap_priv_get_fbo_off(dst_pixmap_priv, &fbo_x_off, &fbo_y_off);
|
||||
pixmap_priv_get_fbo_off(src_pixmap_priv, &src_fbo_x_off, &src_fbo_y_off);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, src_pixmap_priv->base.fbo->fb);
|
||||
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
|
||||
glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off);
|
||||
|
@ -112,7 +112,6 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
|
|||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
glamor_put_context(glamor_priv);
|
||||
glamor_priv->state = BLIT_STATE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -155,7 +154,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
|||
|
||||
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||
|
@ -206,7 +205,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
/* The source texture is bound to a fbo, we have to flush it here. */
|
||||
glamor_put_context(glamor_priv);
|
||||
glamor_priv->state = RENDER_STATE;
|
||||
glamor_priv->render_idle_cnt = 0;
|
||||
return TRUE;
|
||||
|
@ -367,12 +365,10 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
|||
if (gc) {
|
||||
if (!glamor_set_planemask(dst_pixmap, gc->planemask))
|
||||
goto fall_back;
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
if (!glamor_set_alu(screen, gc->alu)) {
|
||||
glamor_put_context(glamor_priv);
|
||||
goto fail;
|
||||
}
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
if (!src_pixmap_priv) {
|
||||
|
@ -545,9 +541,8 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
|||
}
|
||||
|
||||
fail:
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
if (ok)
|
||||
return TRUE;
|
||||
|
|
|
@ -241,7 +241,7 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
|||
char *source;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_priv->finish_access_prog[0] = glCreateProgram();
|
||||
glamor_priv->finish_access_prog[1] = glCreateProgram();
|
||||
|
||||
|
@ -300,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);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -309,10 +308,9 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
|
|||
glamor_screen_private *glamor_priv;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glDeleteProgram(glamor_priv->finish_access_prog[0]);
|
||||
glDeleteProgram(glamor_priv->finish_access_prog[1]);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -341,11 +339,10 @@ glamor_finish_access(DrawablePtr drawable)
|
|||
if (pixmap_priv->base.fbo->pbo != 0 && pixmap_priv->base.fbo->pbo_valid) {
|
||||
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
glDeleteBuffers(1, &pixmap_priv->base.fbo->pbo);
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
pixmap_priv->base.fbo->pbo_valid = FALSE;
|
||||
pixmap_priv->base.fbo->pbo = 0;
|
||||
|
|
|
@ -95,11 +95,8 @@ glamor_egl_get_screen_private(ScrnInfoPtr scrn)
|
|||
}
|
||||
|
||||
static void
|
||||
glamor_egl_get_context(struct glamor_context *glamor_ctx)
|
||||
glamor_egl_make_current(struct glamor_context *glamor_ctx)
|
||||
{
|
||||
if (glamor_ctx->get_count++)
|
||||
return;
|
||||
|
||||
eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!eglMakeCurrent(glamor_ctx->display,
|
||||
|
@ -109,12 +106,6 @@ glamor_egl_get_context(struct glamor_context *glamor_ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glamor_egl_put_context(struct glamor_context *glamor_ctx)
|
||||
{
|
||||
--glamor_ctx->get_count;
|
||||
}
|
||||
|
||||
static EGLImageKHR
|
||||
_glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
|
||||
int width, int height, int stride, int name, int depth)
|
||||
|
@ -166,7 +157,7 @@ glamor_create_texture_from_image(ScreenPtr screen,
|
|||
struct glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glGenTextures(1, texture);
|
||||
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||
|
@ -176,8 +167,6 @@ glamor_create_texture_from_image(ScreenPtr screen,
|
|||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -290,7 +279,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
|||
|
||||
glamor_egl = glamor_egl_get_screen_private(scrn);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
if (glamor_egl->has_gem) {
|
||||
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
|
||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||
|
@ -320,7 +309,6 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
|||
ret = TRUE;
|
||||
|
||||
done:
|
||||
glamor_put_context(glamor_priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -340,7 +328,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
|
|||
|
||||
glamor_egl = glamor_egl_get_screen_private(scrn);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
image = eglCreateImageKHR(glamor_egl->display,
|
||||
glamor_egl->context,
|
||||
|
@ -356,7 +344,6 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
|
|||
ret = TRUE;
|
||||
|
||||
done:
|
||||
glamor_put_context(glamor_priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -414,7 +401,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
|
|||
|
||||
glamor_egl = glamor_egl_get_screen_private(scrn);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
image = pixmap_priv->base.image;
|
||||
if (!image) {
|
||||
|
@ -449,7 +436,6 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
|
|||
|
||||
gbm_bo_destroy(bo);
|
||||
failure:
|
||||
glamor_put_context(glamor_priv);
|
||||
return fd;
|
||||
#else
|
||||
return -1;
|
||||
|
@ -679,8 +665,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
|||
glamor_ctx->ctx = glamor_egl->context;
|
||||
glamor_ctx->display = glamor_egl->display;
|
||||
|
||||
glamor_ctx->get_context = glamor_egl_get_context;
|
||||
glamor_ctx->put_context = glamor_egl_put_context;
|
||||
glamor_ctx->make_current = glamor_egl_make_current;
|
||||
|
||||
if (glamor_egl->dri3_capable) {
|
||||
/* Tell the core that we have the interfaces for import/export
|
||||
|
|
|
@ -129,7 +129,7 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
|||
void
|
||||
glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
||||
{
|
||||
glamor_get_context(fbo->glamor_priv);
|
||||
glamor_make_current(fbo->glamor_priv);
|
||||
|
||||
if (fbo->fb)
|
||||
glDeleteFramebuffers(1, &fbo->fb);
|
||||
|
@ -137,7 +137,6 @@ glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
|||
glDeleteTextures(1, &fbo->tex);
|
||||
if (fbo->pbo)
|
||||
glDeleteBuffers(1, &fbo->pbo);
|
||||
glamor_put_context(fbo->glamor_priv);
|
||||
|
||||
free(fbo);
|
||||
}
|
||||
|
@ -180,7 +179,7 @@ glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
|||
{
|
||||
int status;
|
||||
|
||||
glamor_get_context(fbo->glamor_priv);
|
||||
glamor_make_current(fbo->glamor_priv);
|
||||
|
||||
if (fbo->fb == 0)
|
||||
glGenFramebuffers(1, &fbo->fb);
|
||||
|
@ -219,7 +218,6 @@ glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
|||
FatalError("destination is framebuffer incomplete: %s [%x]\n",
|
||||
str, status);
|
||||
}
|
||||
glamor_put_context(fbo->glamor_priv);
|
||||
}
|
||||
|
||||
glamor_pixmap_fbo *
|
||||
|
@ -241,9 +239,8 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
|
|||
fbo->glamor_priv = glamor_priv;
|
||||
|
||||
if (flag == GLAMOR_CREATE_PIXMAP_MAP) {
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glGenBuffers(1, &fbo->pbo);
|
||||
glamor_put_context(glamor_priv);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -341,14 +338,13 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
|
|||
w, h);
|
||||
}
|
||||
if (!tex) {
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
|
||||
format, GL_UNSIGNED_BYTE, NULL);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ glamor_init_solid_shader(ScreenPtr screen)
|
|||
GLint fs_prog, vs_prog;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_priv->solid_prog = glCreateProgram();
|
||||
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, solid_vs);
|
||||
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, solid_fs);
|
||||
|
@ -169,7 +169,6 @@ glamor_init_solid_shader(ScreenPtr screen)
|
|||
|
||||
glamor_priv->solid_color_uniform_location =
|
||||
glGetUniformLocation(glamor_priv->solid_prog, "color");
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -178,9 +177,8 @@ glamor_fini_solid_shader(ScreenPtr screen)
|
|||
glamor_screen_private *glamor_priv;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glDeleteProgram(glamor_priv->solid_prog);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -196,7 +194,7 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
|
|||
|
||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glUseProgram(glamor_priv->solid_prog);
|
||||
|
||||
glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
|
||||
|
@ -255,7 +253,6 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
|
|||
free(vertices);
|
||||
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glamor_put_context(glamor_priv);
|
||||
glamor_priv->state = RENDER_STATE;
|
||||
glamor_priv->render_idle_cnt = 0;
|
||||
}
|
||||
|
@ -338,13 +335,12 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
if (!glamor_set_alu(screen, alu)) {
|
||||
if (alu == GXclear)
|
||||
fg_pixel = 0;
|
||||
else {
|
||||
glamor_fallback("unsupported alu %x\n", alu);
|
||||
glamor_put_context(glamor_priv);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +351,6 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
|||
glamor_solid_boxes(pixmap, &box, 1, fg_pixel);
|
||||
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
|
|||
glamor_font->default_col = font->info.defaultCh;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glGenTextures(1, &glamor_font->texture_id);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -119,8 +119,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
|
|||
}
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return glamor_font;
|
||||
}
|
||||
|
||||
|
@ -150,9 +148,8 @@ glamor_unrealize_font(ScreenPtr screen, FontPtr font)
|
|||
glamor_font->realized = FALSE;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glDeleteTextures(1, &glamor_font->texture_id);
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
/* Check to see if all of the screens are done with this font
|
||||
* and free the private when that happens
|
||||
|
|
|
@ -34,22 +34,13 @@
|
|||
*/
|
||||
|
||||
static void
|
||||
glamor_glx_get_context(struct glamor_context *glamor_ctx)
|
||||
glamor_glx_make_current(struct glamor_context *glamor_ctx)
|
||||
{
|
||||
if (glamor_ctx->get_count++)
|
||||
return;
|
||||
|
||||
glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid,
|
||||
glamor_ctx->ctx);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glamor_glx_put_context(struct glamor_context *glamor_ctx)
|
||||
{
|
||||
--glamor_ctx->get_count;
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_glx_screen_init(struct glamor_context *glamor_ctx)
|
||||
{
|
||||
|
@ -63,8 +54,7 @@ glamor_glx_screen_init(struct glamor_context *glamor_ctx)
|
|||
|
||||
glamor_ctx->drawable_xid = glXGetCurrentDrawable();
|
||||
|
||||
glamor_ctx->get_context = glamor_glx_get_context;
|
||||
glamor_ctx->put_context = glamor_glx_put_context;
|
||||
glamor_ctx->make_current = glamor_glx_make_current;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
goto bail;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs,
|
||||
&glamor_facet_poly_glyph_blt);
|
||||
|
@ -137,11 +137,9 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
|||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glamor_put_context(glamor_priv);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -212,20 +210,18 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
return FALSE;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
if (!glamor_set_alu(screen, gc->alu)) {
|
||||
if (gc->alu == GXclear)
|
||||
fg_pixel = 0;
|
||||
else {
|
||||
glamor_fallback("unsupported alu %x\n", gc->alu);
|
||||
glamor_put_context(glamor_priv);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!glamor_set_planemask(pixmap, gc->planemask)) {
|
||||
glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
|
||||
glamor_put_context(glamor_priv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -281,8 +277,6 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
|
|||
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1285,9 +1285,8 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
|
|||
* thus we have to composite from the cache picture
|
||||
* to the cache picture, we need a flush here to make
|
||||
* sure latter we get the corret glyphs data.*/
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glFlush();
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -324,7 +324,7 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
|
|||
return;
|
||||
}
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) {
|
||||
glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]);
|
||||
|
@ -371,8 +371,6 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
|
|||
}
|
||||
|
||||
glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog;
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -519,7 +517,7 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
|
|||
return;
|
||||
}
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]) {
|
||||
glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]);
|
||||
glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2] = 0;
|
||||
|
@ -562,8 +560,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
|
|||
}
|
||||
|
||||
glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog;
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -595,7 +591,7 @@ glamor_fini_gradient_shader(ScreenPtr screen)
|
|||
int i = 0;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
/* Linear Gradient */
|
||||
|
@ -607,8 +603,6 @@ glamor_fini_gradient_shader(ScreenPtr screen)
|
|||
glDeleteProgram(glamor_priv->gradient_prog
|
||||
[SHADER_GRADIENT_RADIAL][i]);
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -739,7 +733,7 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
|
|||
tex_vertices[0], tex_vertices[1], tex_vertices[2], tex_vertices[3],
|
||||
tex_vertices[4], tex_vertices[5], tex_vertices[6], tex_vertices[7]);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||
GL_FALSE, 0, vertices);
|
||||
|
@ -749,8 +743,6 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
|
|||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -892,7 +884,7 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
|
|||
GLint r2_uniform_location = 0;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
/* Create a pixmap with VBO. */
|
||||
pixmap = glamor_create_pixmap(screen,
|
||||
|
@ -1123,7 +1115,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return dst_picture;
|
||||
|
||||
GRADIENT_FAIL:
|
||||
|
@ -1140,7 +1131,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
|
|||
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glamor_put_context(glamor_priv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1194,7 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
GLint pt_distance_uniform_location = 0;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
/* Create a pixmap with VBO. */
|
||||
pixmap = glamor_create_pixmap(screen,
|
||||
|
@ -1468,7 +1458,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return dst_picture;
|
||||
|
||||
GRADIENT_FAIL:
|
||||
|
@ -1485,7 +1474,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glamor_put_context(glamor_priv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
goto bail;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (prog->failed)
|
||||
goto bail_ctx;
|
||||
|
@ -105,8 +105,6 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
|||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
glamor_priv->state = RENDER_STATE;
|
||||
glamor_priv->render_idle_cnt = 0;
|
||||
|
||||
|
@ -114,7 +112,6 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
|||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glamor_put_context(glamor_priv);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
goto bail;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (glamor_priv->glsl_version >= 130) {
|
||||
prog = glamor_use_program_fill(pixmap, gc,
|
||||
|
@ -144,11 +144,9 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glamor_put_context(glamor_priv);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -316,13 +316,13 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
|
|||
GLint source_sampler_uniform_location, mask_sampler_uniform_location;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
vs = glamor_create_composite_vs(key);
|
||||
if (vs == 0)
|
||||
goto out;
|
||||
return;
|
||||
fs = glamor_create_composite_fs(key);
|
||||
if (fs == 0)
|
||||
goto out;
|
||||
return;
|
||||
|
||||
prog = glCreateProgram();
|
||||
glAttachShader(prog, vs);
|
||||
|
@ -363,9 +363,6 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
|
|||
glGetUniformLocation(prog, "mask_repeat_mode");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static glamor_composite_shader *
|
||||
|
@ -406,7 +403,7 @@ glamor_init_composite_shaders(ScreenPtr screen)
|
|||
int eb_size;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glGenBuffers(1, &glamor_priv->ebo);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
|
||||
|
||||
|
@ -416,8 +413,6 @@ glamor_init_composite_shaders(ScreenPtr screen)
|
|||
glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW);
|
||||
free(eb);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -428,7 +423,7 @@ glamor_fini_composite_shaders(ScreenPtr screen)
|
|||
int i, j, k;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glDeleteBuffers(1, &glamor_priv->ebo);
|
||||
|
||||
|
@ -439,8 +434,6 @@ glamor_fini_composite_shaders(ScreenPtr screen)
|
|||
if (shader->prog)
|
||||
glDeleteProgram(shader->prog);
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
@ -496,7 +489,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
|||
float wh[4];
|
||||
int repeat_type;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glActiveTexture(GL_TEXTURE0 + unit);
|
||||
glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex);
|
||||
repeat_type = picture->repeatType;
|
||||
|
@ -564,7 +557,6 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
|||
repeat_type -= RepeatFix;
|
||||
}
|
||||
glUniform1i(repeat_location, repeat_type);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -685,7 +677,7 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
|||
|
||||
vert_size = n_verts * glamor_priv->vb_stride;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
|
||||
|
||||
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
|
||||
|
@ -707,7 +699,6 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
|||
4 : 2) * sizeof(float));
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
||||
}
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return vb;
|
||||
}
|
||||
|
@ -717,7 +708,7 @@ glamor_flush_composite_rects(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (!glamor_priv->render_nr_verts)
|
||||
return;
|
||||
|
@ -730,7 +721,6 @@ glamor_flush_composite_rects(ScreenPtr screen)
|
|||
glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
|
||||
GL_UNSIGNED_SHORT, NULL);
|
||||
}
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
int pict_format_combine_tab[][3] = {
|
||||
|
@ -1112,7 +1102,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
|||
|
||||
glamor_priv = dest_priv->base.glamor_priv;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glUseProgram(shader->prog);
|
||||
|
||||
if (key->source == SHADER_SOURCE_SOLID) {
|
||||
|
@ -1146,8 +1136,6 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(op_info->source_blend, op_info->dest_blend);
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
@ -1202,7 +1190,7 @@ glamor_composite_with_shader(CARD8 op,
|
|||
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
|
||||
glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID;
|
||||
glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE &&
|
||||
|
@ -1328,7 +1316,6 @@ glamor_composite_with_shader(CARD8 op,
|
|||
glamor_priv->render_idle_cnt = 0;
|
||||
if (saved_source_format)
|
||||
source->format = saved_source_format;
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
ret = TRUE;
|
||||
return ret;
|
||||
|
|
|
@ -61,7 +61,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
goto bail;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (glamor_priv->glsl_version >= 130) {
|
||||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
|
||||
|
@ -152,11 +152,9 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glamor_put_context(glamor_priv);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -222,7 +220,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
|
|||
|
||||
glamor_format_for_pixmap(pixmap, &format, &type);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
|
||||
BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
|
||||
|
@ -261,7 +259,6 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
|
|||
}
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
bail:
|
||||
return FALSE;
|
||||
|
@ -327,7 +324,7 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
|
|||
glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
|
||||
glamor_format_for_pixmap(pixmap, &format, &type);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -397,7 +394,6 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
|
|||
}
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
|
||||
bail:
|
||||
|
|
|
@ -267,7 +267,7 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
goto bail;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
|
||||
|
||||
|
@ -279,8 +279,6 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
glamor_priv->state = RENDER_STATE;
|
||||
glamor_priv->render_idle_cnt = 0;
|
||||
|
||||
|
@ -289,7 +287,6 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glamor_put_context(glamor_priv);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -420,7 +417,7 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (TERMINALFONT(gc->font))
|
||||
prog = &glamor_priv->te_text_prog;
|
||||
|
@ -482,8 +479,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
|
|||
(void) glamor_text(drawable, gc, glamor_font, prog,
|
||||
x, y, count, chars, charinfo, sixteen);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
glamor_priv->state = RENDER_STATE;
|
||||
glamor_priv->render_idle_cnt = 0;
|
||||
|
||||
|
@ -491,7 +486,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
bail:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glamor_put_context(glamor_priv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ glamor_init_tile_shader(ScreenPtr screen)
|
|||
GLint sampler_uniform_location;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_priv->tile_prog = glCreateProgram();
|
||||
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, tile_vs);
|
||||
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, tile_fs);
|
||||
|
@ -82,7 +82,6 @@ glamor_init_tile_shader(ScreenPtr screen)
|
|||
|
||||
glamor_priv->tile_wh =
|
||||
glGetUniformLocation(glamor_priv->tile_prog, "wh");
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -91,9 +90,8 @@ glamor_fini_tile_shader(ScreenPtr screen)
|
|||
glamor_screen_private *glamor_priv;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glDeleteProgram(glamor_priv->tile_prog);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -123,7 +121,7 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
|||
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
|
||||
pixmap_priv_get_dest_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glUseProgram(glamor_priv->tile_prog);
|
||||
|
||||
glamor_pixmap_fbo_fix_wh_ratio(wh, src_pixmap_priv);
|
||||
|
@ -155,7 +153,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
|||
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
glamor_priv->state = RENDER_STATE;
|
||||
glamor_priv->render_idle_cnt = 0;
|
||||
|
@ -193,10 +190,9 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
if (!glamor_set_alu(screen, alu)) {
|
||||
glamor_fallback("unsupported alu %x\n", alu);
|
||||
glamor_put_context(glamor_priv);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -290,7 +286,6 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
|||
_glamor_tile(pixmap, tile, x, y, width, height, tile_x, tile_y);
|
||||
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
fail:
|
||||
return FALSE;
|
||||
|
|
|
@ -70,7 +70,7 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
|
||||
glamor_format_for_pixmap(pixmap, &format, &type);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
@ -127,7 +127,6 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -180,7 +179,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
|
||||
glamor_format_for_pixmap(pixmap, &format, &type);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
|
||||
|
@ -226,7 +225,6 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -235,14 +235,13 @@ glamor_flush_composite_triangles(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_put_vbo_space(screen);
|
||||
|
||||
if (!glamor_priv->render_nr_verts)
|
||||
return;
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
@ -627,7 +626,7 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
|
|||
|
||||
vert_size = n_verts * glamor_priv->vb_stride;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
@ -667,8 +666,6 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
|
|||
vbo_offset + stride * sizeof(float));
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return vb;
|
||||
}
|
||||
|
||||
|
@ -811,7 +808,7 @@ _glamor_trapezoids_with_shader(CARD8 op,
|
|||
goto TRAPEZOID_OUT;
|
||||
}
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
box = REGION_RECTS(®ion);
|
||||
nbox = REGION_NUM_RECTS(®ion);
|
||||
|
@ -979,7 +976,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
||||
glDisable(GL_BLEND);
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
TRAPEZOID_OUT:
|
||||
if (box) {
|
||||
|
@ -1332,7 +1328,7 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
|
|||
"}\n";
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glamor_priv->trapezoid_prog = glCreateProgram();
|
||||
|
||||
|
@ -1354,8 +1350,6 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
|
|||
GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param");
|
||||
|
||||
glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1364,9 +1358,8 @@ glamor_fini_trapezoid_shader(ScreenPtr screen)
|
|||
glamor_screen_private *glamor_priv;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glDeleteProgram(glamor_priv->trapezoid_prog);
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
@ -1406,7 +1399,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||
|
||||
|
@ -1564,7 +1557,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
|
||||
glamor_put_context(glamor_priv);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1499,18 +1499,12 @@ __fls(unsigned long x)
|
|||
#endif
|
||||
|
||||
static inline void
|
||||
glamor_get_context(glamor_screen_private * glamor_priv)
|
||||
glamor_make_current(glamor_screen_private *glamor_priv)
|
||||
{
|
||||
if (lastGLContext != &glamor_priv->ctx) {
|
||||
lastGLContext = &glamor_priv->ctx;
|
||||
glamor_priv->ctx.get_context(&glamor_priv->ctx);
|
||||
glamor_priv->ctx.make_current(&glamor_priv->ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
glamor_put_context(glamor_screen_private * glamor_priv)
|
||||
{
|
||||
glamor_priv->ctx.put_context(&glamor_priv->ctx);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,7 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
|
|||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
void *data;
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
|
||||
|
||||
|
@ -79,7 +79,6 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
|
|||
*/
|
||||
glamor_priv->has_buffer_storage = false;
|
||||
glamor_priv->vbo_size = 0;
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return glamor_get_vbo_space(screen, size, vbo_offset);
|
||||
}
|
||||
|
@ -130,8 +129,6 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
|
|||
data = glamor_priv->vb;
|
||||
}
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -140,7 +137,7 @@ glamor_put_vbo_space(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (glamor_priv->has_buffer_storage) {
|
||||
/* If we're in the ARB_buffer_storage path, we have a
|
||||
|
@ -155,8 +152,6 @@ glamor_put_vbo_space(ScreenPtr screen)
|
|||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -164,11 +159,9 @@ glamor_init_vbo(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glGenBuffers(1, &glamor_priv->vbo);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -176,11 +169,9 @@ glamor_fini_vbo(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glDeleteBuffers(1, &glamor_priv->vbo);
|
||||
if (!glamor_priv->has_map_buffer_range)
|
||||
free(glamor_priv->vb);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ glamor_init_xv_shader(ScreenPtr screen)
|
|||
GLint fs_prog, vs_prog;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glamor_priv->xv_prog = glCreateProgram();
|
||||
|
||||
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xv_vs);
|
||||
|
@ -110,8 +110,6 @@ glamor_init_xv_shader(ScreenPtr screen)
|
|||
glBindAttribLocation(glamor_priv->xv_prog,
|
||||
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
|
||||
glamor_link_glsl_prog(screen, glamor_priv->xv_prog, "xv");
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
}
|
||||
|
||||
#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v))
|
||||
|
@ -316,7 +314,7 @@ glamor_display_textured_video(glamor_port_private *port_priv)
|
|||
&src_yscale[i]);
|
||||
}
|
||||
}
|
||||
glamor_get_context(glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
glUseProgram(glamor_priv->xv_prog);
|
||||
|
||||
uloc = glGetUniformLocation(glamor_priv->xv_prog, "offsetyco");
|
||||
|
@ -404,7 +402,6 @@ glamor_display_textured_video(glamor_port_private *port_priv)
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
||||
glamor_put_context(glamor_priv);
|
||||
DamageDamageRegion(port_priv->pDraw, &port_priv->clip);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user