[PATCH xserver 13/19] glamor: Simplify the pixmap box looping.

Eric Anholt eric at anholt.net
Wed Jan 27 17:56:42 PST 2016


We had a double loop across h and w, and passed the current x and y
out to callers who then used w to multiply/add to an index.  Instead,
just single loop across w * h.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_composite_glyphs.c | 10 ++++++----
 glamor/glamor_copy.c             | 15 ++++++++-------
 glamor/glamor_dash.c             |  6 +++---
 glamor/glamor_glyphblt.c         | 12 ++++++------
 glamor/glamor_lines.c            |  6 +++---
 glamor/glamor_points.c           |  7 ++++---
 glamor/glamor_priv.h             | 20 +++++++++-----------
 glamor/glamor_rects.c            |  7 ++++---
 glamor/glamor_segs.c             |  6 +++---
 glamor/glamor_spans.c            | 23 ++++++++++++-----------
 glamor/glamor_text.c             |  8 +++++---
 glamor/glamor_transfer.c         | 16 ++++++++--------
 glamor/glamor_transform.c        |  7 +++----
 glamor/glamor_transform.h        |  3 +--
 glamor/glamor_xv.c               |  6 +++---
 15 files changed, 78 insertions(+), 74 deletions(-)

diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c
index 2e4dfe2..f51ff6d 100644
--- a/glamor/glamor_composite_glyphs.c
+++ b/glamor/glamor_composite_glyphs.c
@@ -237,10 +237,10 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst,
     glamor_screen_private *glamor_priv = glamor_get_screen_private(drawable->pScreen);
     PixmapPtr atlas_pixmap = atlas->atlas;
     glamor_pixmap_private *atlas_priv = glamor_get_pixmap_private(atlas_pixmap);
-    glamor_pixmap_fbo *atlas_fbo = glamor_pixmap_fbo_at(atlas_priv, 0, 0);
+    glamor_pixmap_fbo *atlas_fbo = glamor_pixmap_fbo_at(atlas_priv, 0);
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
-    int box_x, box_y;
+    int box_index;
     int off_x, off_y;
 
     glamor_put_vbo_space(drawable->pScreen);
@@ -255,11 +255,13 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst,
 
         glUniform1i(prog->atlas_uniform, 1);
 
-        glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        glamor_pixmap_loop(pixmap_priv, box_index) {
             BoxPtr box = RegionRects(dst->pCompositeClip);
             int nbox = RegionNumRects(dst->pCompositeClip);
 
-            glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+            glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE,
+                                            prog->matrix_uniform,
+                                            &off_x, &off_y);
 
             /* Run over the clip list, drawing the glyphs
              * in each box
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index 1adfba0..5fed89f 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -307,7 +307,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
     PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
     glamor_pixmap_private *src_priv = glamor_get_pixmap_private(src_pixmap);
     glamor_pixmap_private *dst_priv = glamor_get_pixmap_private(dst_pixmap);
-    int src_box_x, src_box_y, dst_box_x, dst_box_y;
+    int src_box_index, dst_box_index;
     int dst_off_x, dst_off_y;
     int src_off_x, src_off_y;
     GLshort *v;
@@ -368,19 +368,20 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(src_priv, src_box_x, src_box_y) {
-        BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_x, src_box_y);
+    glamor_pixmap_loop(src_priv, src_box_index) {
+        BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_index);
 
         args.dx = dx + src_off_x - src_box->x1;
         args.dy = dy + src_off_y - src_box->y1;
-        args.src = glamor_pixmap_fbo_at(src_priv, src_box_x, src_box_y);
+        args.src = glamor_pixmap_fbo_at(src_priv, src_box_index);
 
         if (!glamor_use_program(dst_pixmap, gc, prog, &args))
             goto bail_ctx;
 
-        glamor_pixmap_loop(dst_priv, dst_box_x, dst_box_y) {
-            glamor_set_destination_drawable(dst, dst_box_x, dst_box_y, FALSE, FALSE,
-                                            prog->matrix_uniform, &dst_off_x, &dst_off_y);
+        glamor_pixmap_loop(dst_priv, dst_box_index) {
+            glamor_set_destination_drawable(dst, dst_box_index, FALSE, FALSE,
+                                            prog->matrix_uniform,
+                                            &dst_off_x, &dst_off_y);
 
             glScissor(dst_off_x - args.dx,
                       dst_off_y - args.dy,
diff --git a/glamor/glamor_dash.c b/glamor/glamor_dash.c
index 101228e..a6a11c1 100644
--- a/glamor/glamor_dash.c
+++ b/glamor/glamor_dash.c
@@ -205,16 +205,16 @@ glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog,
 {
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
-    int box_x, box_y;
+    int box_index;
     int off_x, off_y;
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int nbox = RegionNumRects(gc->pCompositeClip);
         BoxPtr box = RegionRects(gc->pCompositeClip);
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE,
+        glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
                                         prog->matrix_uniform, &off_x, &off_y);
 
         while (nbox--) {
diff --git a/glamor/glamor_glyphblt.c b/glamor/glamor_glyphblt.c
index 1791f6d..b21aa06 100644
--- a/glamor/glamor_glyphblt.c
+++ b/glamor/glamor_glyphblt.c
@@ -48,7 +48,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
     glamor_pixmap_private *pixmap_priv;
     glamor_program *prog;
     RegionPtr clip = gc->pCompositeClip;
-    int box_x, box_y;
+    int box_index;
 
     pixmap_priv = glamor_get_pixmap_private(pixmap);
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
@@ -67,7 +67,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
     start_x += drawable->x;
     y += drawable->y;
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int x;
         int n;
         int num_points, max_points;
@@ -75,7 +75,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
         int off_x, off_y;
         char *vbo_offset;
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE,
+        glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE,
                                         prog->matrix_uniform, &off_x, &off_y);
 
         max_points = 500;
@@ -169,7 +169,7 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
     int bitmap_stride = bitmap->devKind;
     glamor_program *prog;
     RegionPtr clip = gc->pCompositeClip;
-    int box_x, box_y;
+    int box_index;
     int yy, xx;
     int num_points;
     INT16 *points = NULL;
@@ -220,8 +220,8 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
 
     glamor_put_vbo_space(screen);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
-        glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE,
+    glamor_pixmap_loop(pixmap_priv, box_index) {
+        glamor_set_destination_drawable(drawable, box_index, FALSE, TRUE,
                                         prog->matrix_uniform, NULL, NULL);
 
         glDrawArrays(GL_POINTS, 0, num_points);
diff --git a/glamor/glamor_lines.c b/glamor/glamor_lines.c
index 2dd9c07..a2c9b1f 100644
--- a/glamor/glamor_lines.c
+++ b/glamor/glamor_lines.c
@@ -44,7 +44,7 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
     int off_x, off_y;
     DDXPointPtr v;
     char *vbo_offset;
-    int box_x, box_y;
+    int box_index;
     int add_last;
 
     pixmap_priv = glamor_get_pixmap_private(pixmap);
@@ -99,11 +99,11 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int nbox = RegionNumRects(gc->pCompositeClip);
         BoxPtr box = RegionRects(gc->pCompositeClip);
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE,
+        glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
                                         prog->matrix_uniform, &off_x, &off_y);
 
         while (nbox--) {
diff --git a/glamor/glamor_points.c b/glamor/glamor_points.c
index 3ba4a69..facfe82 100644
--- a/glamor/glamor_points.c
+++ b/glamor/glamor_points.c
@@ -46,7 +46,7 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
     int off_x, off_y;
     GLshort *vbo_ppt;
     char *vbo_offset;
-    int box_x, box_y;
+    int box_index;
 
     pixmap_priv = glamor_get_pixmap_private(pixmap);
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
@@ -86,11 +86,12 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int nbox = RegionNumRects(gc->pCompositeClip);
         BoxPtr box = RegionRects(gc->pCompositeClip);
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y);
+        glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
+                                        prog->matrix_uniform, &off_x, &off_y);
 
         while (nbox--) {
             glScissor(box->x1 + off_x,
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 60b0a66..a70f10e 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -485,19 +485,17 @@ glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
 }
 
 static inline glamor_pixmap_fbo *
-glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
+glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int box)
 {
-    assert(x < priv->block_wcnt);
-    assert(y < priv->block_hcnt);
-    return priv->fbo_array[y * priv->block_wcnt + x];
+    assert(box < priv->block_wcnt * priv->block_hcnt);
+    return priv->fbo_array[box];
 }
 
 static inline BoxPtr
-glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
+glamor_pixmap_box_at(glamor_pixmap_private *priv, int box)
 {
-    assert(x < priv->block_wcnt);
-    assert(y < priv->block_hcnt);
-    return &priv->box_array[y * priv->block_wcnt + x];
+    assert(box < priv->block_wcnt * priv->block_hcnt);
+    return &priv->box_array[box];
 }
 
 static inline int
@@ -512,9 +510,9 @@ glamor_pixmap_hcnt(glamor_pixmap_private *priv)
     return priv->block_hcnt;
 }
 
-#define glamor_pixmap_loop(priv, x, y)                  \
-    for (y = 0; y < glamor_pixmap_hcnt(priv); y++)      \
-        for (x = 0; x < glamor_pixmap_wcnt(priv); x++)
+#define glamor_pixmap_loop(priv, box_index)                            \
+    for (box_index = 0; box_index < glamor_pixmap_hcnt(priv) *         \
+             glamor_pixmap_wcnt(priv); box_index++)                    \
 
 /**
  * Pixmap upload status, used by glamor_render.c's support for
diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c
index c378e4a..e447320 100644
--- a/glamor/glamor_rects.c
+++ b/glamor/glamor_rects.c
@@ -51,7 +51,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
     int off_x, off_y;
     GLshort *v;
     char *vbo_offset;
-    int box_x, box_y;
+    int box_index;
 
     pixmap_priv = glamor_get_pixmap_private(pixmap);
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
@@ -111,11 +111,12 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int nbox = RegionNumRects(gc->pCompositeClip);
         BoxPtr box = RegionRects(gc->pCompositeClip);
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+        glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE,
+                                        prog->matrix_uniform, &off_x, &off_y);
 
         while (nbox--) {
             glScissor(box->x1 + off_x,
diff --git a/glamor/glamor_segs.c b/glamor/glamor_segs.c
index e167325..5fffa3b 100644
--- a/glamor/glamor_segs.c
+++ b/glamor/glamor_segs.c
@@ -44,7 +44,7 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
     int off_x, off_y;
     xSegment *v;
     char *vbo_offset;
-    int box_x, box_y;
+    int box_index;
     int add_last;
 
     pixmap_priv = glamor_get_pixmap_private(pixmap);
@@ -91,11 +91,11 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int nbox = RegionNumRects(gc->pCompositeClip);
         BoxPtr box = RegionRects(gc->pCompositeClip);
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE,
+        glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
                                         prog->matrix_uniform, &off_x, &off_y);
 
         while (nbox--) {
diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c
index 58da3ed..89a9c51 100644
--- a/glamor/glamor_spans.c
+++ b/glamor/glamor_spans.c
@@ -55,7 +55,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
     GLshort *v;
     char *vbo_offset;
     int c;
-    int box_x, box_y;
+    int box_index;
 
     pixmap_priv = glamor_get_pixmap_private(pixmap);
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
@@ -119,11 +119,12 @@ glamor_fill_spans_gl(DrawablePtr drawable,
 
     glEnable(GL_SCISSOR_TEST);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+    glamor_pixmap_loop(pixmap_priv, box_index) {
         int nbox = RegionNumRects(gc->pCompositeClip);
         BoxPtr box = RegionRects(gc->pCompositeClip);
 
-        glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+        glamor_set_destination_drawable(drawable, box_index, FALSE, FALSE,
+                                        prog->matrix_uniform, &off_x, &off_y);
 
         while (nbox--) {
             glScissor(box->x1 + off_x,
@@ -180,7 +181,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
     glamor_pixmap_private *pixmap_priv;
-    int box_x, box_y;
+    int box_index;
     int n;
     char *d;
     GLenum type;
@@ -197,9 +198,9 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
 
     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);
-        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
+    glamor_pixmap_loop(pixmap_priv, box_index) {
+        BoxPtr                  box = glamor_pixmap_box_at(pixmap_priv, box_index);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_index);
 
         glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
         glPixelStorei(GL_PACK_ALIGNMENT, 4);
@@ -265,7 +266,7 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
     glamor_pixmap_private *pixmap_priv;
-    int box_x, box_y;
+    int box_index;
     int n;
     char *s;
     GLenum type;
@@ -289,9 +290,9 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
 
     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
-    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
-        BoxPtr                  box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
-        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
+    glamor_pixmap_loop(pixmap_priv, box_index) {
+        BoxPtr              box = glamor_pixmap_box_at(pixmap_priv, box_index);
+        glamor_pixmap_fbo  *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_index);
 
         glActiveTexture(GL_TEXTURE0);
         glBindTexture(GL_TEXTURE_2D, fbo->tex);
diff --git a/glamor/glamor_text.c b/glamor/glamor_text.c
index 429f53b..c305305 100644
--- a/glamor/glamor_text.c
+++ b/glamor/glamor_text.c
@@ -107,7 +107,7 @@ glamor_text(DrawablePtr drawable, GCPtr gc,
     int firstCol = font->info.firstCol;
     int glyph_spacing_x = glamor_font->glyph_width_bytes * 8;
     int glyph_spacing_y = glamor_font->glyph_height;
-    int box_x, box_y;
+    int box_index;
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
 
@@ -188,11 +188,13 @@ glamor_text(DrawablePtr drawable, GCPtr gc,
 
         glEnable(GL_SCISSOR_TEST);
 
-        glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        glamor_pixmap_loop(pixmap_priv, box_index) {
             BoxPtr box = RegionRects(gc->pCompositeClip);
             int nbox = RegionNumRects(gc->pCompositeClip);
 
-            glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+            glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE,
+                                            prog->matrix_uniform,
+                                            &off_x, &off_y);
 
             /* Run over the clip list, drawing the glyphs
              * in each box
diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c
index 91e1747..ed81195 100644
--- a/glamor/glamor_transfer.c
+++ b/glamor/glamor_transfer.c
@@ -63,7 +63,7 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
     ScreenPtr                   screen = pixmap->drawable.pScreen;
     glamor_screen_private       *glamor_priv = glamor_get_screen_private(screen);
     glamor_pixmap_private       *priv = glamor_get_pixmap_private(pixmap);
-    int                         box_x, box_y;
+    int                         box_index;
     int                         bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
     GLenum                      type;
     GLenum                      format;
@@ -77,9 +77,9 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
     if (glamor_priv->has_unpack_subimage)
         glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
 
-    glamor_pixmap_loop(priv, box_x, box_y) {
-        BoxPtr                  box = glamor_pixmap_box_at(priv, box_x, box_y);
-        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y);
+    glamor_pixmap_loop(priv, box_index) {
+        BoxPtr                  box = glamor_pixmap_box_at(priv, box_index);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_index);
         BoxPtr                  boxes = in_boxes;
         int                     nbox = in_nbox;
 
@@ -167,7 +167,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
     ScreenPtr screen = pixmap->drawable.pScreen;
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
     glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
-    int box_x, box_y;
+    int box_index;
     int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
     GLenum type;
     GLenum format;
@@ -180,9 +180,9 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
     if (glamor_priv->has_pack_subimage)
         glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
 
-    glamor_pixmap_loop(priv, box_x, box_y) {
-        BoxPtr                  box = glamor_pixmap_box_at(priv, box_x, box_y);
-        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y);
+    glamor_pixmap_loop(priv, box_index) {
+        BoxPtr                  box = glamor_pixmap_box_at(priv, box_index);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_index);
         BoxPtr                  boxes = in_boxes;
         int                     nbox = in_nbox;
 
diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c
index 564a52d..17b1066 100644
--- a/glamor/glamor_transform.c
+++ b/glamor/glamor_transform.c
@@ -35,8 +35,7 @@
 
 void
 glamor_set_destination_drawable(DrawablePtr     drawable,
-                                int             box_x,
-                                int             box_y,
+                                int             box_index,
                                 Bool            do_drawable_translate,
                                 Bool            center_offset,
                                 GLint           matrix_uniform_location,
@@ -48,7 +47,7 @@ glamor_set_destination_drawable(DrawablePtr     drawable,
     PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
     glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
     int off_x, off_y;
-    BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
+    BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_index);
     int w = box->x2 - box->x1;
     int h = box->y2 - box->y1;
     float scale_x = 2.0f / (float) w;
@@ -95,7 +94,7 @@ glamor_set_destination_drawable(DrawablePtr     drawable,
                 scale_x, (off_x + center_adjust) * scale_x - 1.0f,
                 scale_y, (off_y + center_adjust) * scale_y - 1.0f);
 
-    glamor_set_destination_pixmap_fbo(glamor_priv, glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
+    glamor_set_destination_pixmap_fbo(glamor_priv, glamor_pixmap_fbo_at(pixmap_priv, box_index),
                                       0, 0, w, h);
 }
 
diff --git a/glamor/glamor_transform.h b/glamor/glamor_transform.h
index dca6a26..ab7b2bc 100644
--- a/glamor/glamor_transform.h
+++ b/glamor/glamor_transform.h
@@ -25,8 +25,7 @@
 
 void
 glamor_set_destination_drawable(DrawablePtr     drawable,
-                                int             box_x,
-                                int             box_y,
+                                int             box_index,
                                 Bool            do_drawable_translate,
                                 Bool            center_offset,
                                 GLint           matrix_uniform_location,
diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c
index e8c849d..9ac60af 100644
--- a/glamor/glamor_xv.c
+++ b/glamor/glamor_xv.c
@@ -258,7 +258,7 @@ glamor_xv_render(glamor_port_private *port_priv)
     GLint uloc;
     GLfloat *v;
     char *vbo_offset;
-    int dst_box_x, dst_box_y;
+    int dst_box_index;
 
     if (!glamor_priv->xv_prog.prog)
         glamor_init_xv_shader(screen);
@@ -368,11 +368,11 @@ glamor_xv_render(glamor_port_private *port_priv)
     glamor_put_vbo_space(screen);
 
     /* Now draw our big triangle, clipped to each of the clip boxes. */
-    glamor_pixmap_loop(pixmap_priv, dst_box_x, dst_box_y) {
+    glamor_pixmap_loop(pixmap_priv, dst_box_index) {
         int dst_off_x, dst_off_y;
 
         glamor_set_destination_drawable(port_priv->pDraw,
-                                        dst_box_x, dst_box_y,
+                                        dst_box_index,
                                         FALSE, FALSE,
                                         glamor_priv->xv_prog.matrix_uniform,
                                         &dst_off_x, &dst_off_y);
-- 
2.6.4



More information about the xorg-devel mailing list