glamor: don't reset the GLSL program
authorMarkus Wick <markus@selfnet.de>
Thu, 13 Mar 2014 10:17:39 +0000 (11:17 +0100)
committerEric Anholt <eric@anholt.net>
Mon, 17 Mar 2014 21:30:58 +0000 (14:30 -0700)
We don't use fixed function rendering, so there is no need to reset
the program at all.  This lets the driver avoid checking for state
changes between draw calls when we rebind the same program.

Improves xephyr x11perf -f8text performance by 6.03062% +/- 1.64928%
(n=20)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
glamor/glamor_copyarea.c
glamor/glamor_core.c
glamor/glamor_fill.c
glamor/glamor_glyphblt.c
glamor/glamor_gradient.c
glamor/glamor_pixmap.c
glamor/glamor_render.c
glamor/glamor_tile.c
glamor/glamor_trapezoid.c
glamor/glamor_xv.c

index 0b170dc..996611c 100644 (file)
@@ -205,7 +205,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-    glUseProgram(0);
     /* The source texture is bound to a fbo, we have to flush it here. */
     glamor_put_context(glamor_priv);
     glamor_priv->state = RENDER_STATE;
index 9e07b2b..6c0b3c8 100644 (file)
@@ -289,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");
@@ -301,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);
 }
 
index e58b336..7461b62 100644 (file)
@@ -258,7 +258,6 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
         free(vertices);
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
     glamor_priv->state = RENDER_STATE;
     glamor_priv->render_idle_cnt = 0;
index 5d785a0..a58cef9 100644 (file)
@@ -156,7 +156,6 @@ glamor_poly_glyph_blt_pixels(DrawablePtr drawable, GCPtr gc,
     }
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
-    glUseProgram(0);
 
     glamor_put_context(glamor_priv);
 
@@ -328,7 +327,6 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
     glDrawArrays(GL_POINTS, 0, num_points);
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
-    glUseProgram(0);
 
     glamor_put_context(glamor_priv);
 
index 0769eae..f77d6a8 100644 (file)
@@ -379,8 +379,6 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
 
     glamor_link_glsl_prog(screen, gradient_prog, "radial gradient");
 
-    glUseProgram(0);
-
     if (dyn_gen) {
         index = 2;
         glamor_priv->radial_max_nstops = stops_count;
@@ -592,8 +590,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
 
     glamor_link_glsl_prog(screen, gradient_prog, "linear gradient");
 
-    glUseProgram(0);
-
     if (dyn_gen) {
         index = 2;
         glamor_priv->linear_max_nstops = stops_count;
@@ -1169,7 +1165,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-    glUseProgram(0);
 
     glamor_put_context(glamor_priv);
     return dst_picture;
@@ -1191,7 +1186,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
     return NULL;
 }
@@ -1522,7 +1516,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-    glUseProgram(0);
 
     glamor_put_context(glamor_priv);
     return dst_picture;
@@ -1544,7 +1537,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
     return NULL;
 }
index 1c258a2..615faad 100644 (file)
@@ -856,7 +856,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
 
     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
 
-    glUseProgram(0);
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
     glDeleteTextures(1, &tex);
@@ -1181,7 +1180,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
     return temp_fbo;
 }
index 2496f84..c0ee22c 100644 (file)
@@ -1335,7 +1335,6 @@ glamor_composite_with_shader(CARD8 op,
     glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
     glDisable(GL_BLEND);
     DEBUGF("finish rendering.\n");
-    glUseProgram(0);
     glamor_priv->state = RENDER_STATE;
     glamor_priv->render_idle_cnt = 0;
     if (saved_source_format)
index ba7f11f..9e115ca 100644 (file)
@@ -82,7 +82,6 @@ glamor_init_tile_shader(ScreenPtr screen)
 
     glamor_priv->tile_wh =
         glGetUniformLocation(glamor_priv->tile_prog, "wh");
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
 }
 
@@ -156,7 +155,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
 
     glamor_priv->state = RENDER_STATE;
index 9c39740..969ab68 100644 (file)
@@ -982,7 +982,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
     glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
     glDisable(GL_BLEND);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
 
  TRAPEZOID_OUT:
@@ -1359,8 +1358,6 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
 
     glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
 
-    glUseProgram(0);
-
     glamor_put_context(glamor_priv);
 }
 
@@ -1573,7 +1570,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);
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
     return TRUE;
 }
index c0219b0..17745a4 100644 (file)
@@ -416,7 +416,6 @@ glamor_display_textured_video(glamor_port_private *port_priv)
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
 
-    glUseProgram(0);
     glamor_put_context(glamor_priv);
     DamageDamageRegion(port_priv->pDraw, &port_priv->clip);
 }