[PATCH 4/9] glamor: Track the next vertex offset as we go in render accel.
Eric Anholt
eric at anholt.net
Sat Mar 8 20:07:05 PST 2014
I want to extract the VBO mapping code, and as part of that I need to
get the global vbo_offset munging to stop.
Signed-off-by: Eric Anholt <eric at anholt.net>
---
glamor/glamor_priv.h | 2 +-
glamor/glamor_render.c | 14 ++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index c93f483..b23c12b 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -702,7 +702,7 @@ void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
glamor_composite_shader *shader,
struct blendinfo *op_info);
-void glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
+void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
/* glamor_trapezoid.c */
void glamor_trapezoids(CARD8 op,
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 7e25cd5..69a22d9 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -701,7 +701,7 @@ glamor_composite_with_copy(CARD8 op,
return ret;
}
-void
+void *
glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
@@ -765,6 +765,8 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
}
glamor_put_context(glamor_priv);
+
+ return glamor_priv->vb + glamor_priv->vbo_offset;
}
static void
@@ -1226,7 +1228,6 @@ glamor_composite_with_shader(CARD8 op,
GLfloat dst_xscale, dst_yscale;
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
struct shader_key key, key_ca;
- float *vertices;
int dest_x_off, dest_y_off;
int source_x_off, source_y_off;
int mask_x_off, mask_y_off;
@@ -1303,9 +1304,10 @@ glamor_composite_with_shader(CARD8 op,
while (nrect) {
int mrect, rect_processed;
int vb_stride;
+ float *vertices;
mrect = nrect > nrect_max ? nrect_max : nrect;
- glamor_setup_composite_vbo(screen, mrect * vert_stride);
+ vertices = glamor_setup_composite_vbo(screen, mrect * vert_stride);
rect_processed = mrect;
vb_stride = glamor_priv->vb_stride / sizeof(float);
while (mrect--) {
@@ -1331,7 +1333,7 @@ glamor_composite_with_shader(CARD8 op,
("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n",
x_dest, y_dest, x_source, y_source, x_mask, y_mask, width,
height);
- vertices = (float *) (glamor_priv->vb + glamor_priv->vbo_offset);
+
assert(glamor_priv->vbo_offset <
glamor_priv->vbo_size - glamor_priv->vb_stride);
glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale,
@@ -1361,10 +1363,14 @@ glamor_composite_with_shader(CARD8 op,
y_mask + height,
glamor_priv->yInverted,
vertices, vb_stride);
+ vertices += 2;
}
glamor_priv->render_nr_verts += 4;
glamor_priv->vbo_offset += glamor_priv->vb_stride * 4;
rects++;
+
+ /* We've incremented by one of our 4 verts, now do the other 3. */
+ vertices += 3 * vb_stride;
}
glamor_flush_composite_rects(screen);
nrect -= rect_processed;
--
1.9.0
More information about the xorg-devel
mailing list