summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-07-02 23:05:04 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-07-04 15:27:54 +0100
commitf91ee24b2dabb48288d6e81dcdd82191f158e312 (patch)
treeced94e3cdaa71d5bf2bfad02d4190ded9ea70238
parent6db93720a73f59a9857a3c5ab260fab8b957813e (diff)
sna: Trim number of downsample passes
If we can fit the entire width or the entire height into the pipeline when downsampling, do so. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c48
1 files changed, 35 insertions, 13 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index baf51c32..74a4ded4 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -520,7 +520,7 @@ static int sna_render_picture_downsample(struct sna *sna,
struct sna_pixmap *priv;
pixman_transform_t t;
PixmapPtr tmp;
- int error, i, j, ww, hh;
+ int error, i, j, ww, hh, ni, nj;
if (!sna_pixmap_force_to_gpu(pixmap))
goto fixup;
@@ -556,24 +556,51 @@ static int sna_render_picture_downsample(struct sna *sna,
ValidatePicture(tmp_dst);
ValidatePicture(tmp_src);
- ww = w/4; hh = h/4;
+ if (w > sna->render.max_3d_size) {
+ ww = w/4;
+ nj = 2;
+ } else {
+ ww = w/2;
+ nj = 1;
+ }
+
+ if (h > sna->render.max_3d_size) {
+ hh = h/4;
+ ni = 2;
+ } else {
+ hh = h/2;
+ ni = 1;
+ }
DBG(("%s downsampling using %dx%d GPU tiles\n",
__FUNCTION__, ww, hh));
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
+ for (i = 0; i < ni; i++) {
+ BoxRec b;
+
+ b.y1 = hh*i;
+ if (i == ni - 1)
+ b.y2 = h/2;
+ else
+ b.y2 = b.y1 + hh;
+
+ for (j = 0; j < nj; j++) {
struct sna_composite_op op;
- BoxRec b;
+
+ b.x1 = ww*j;
+ if (j == nj - 1)
+ b.x2 = w/2;
+ else
+ b.x2 = b.x1 + ww;
memset(&op, 0, sizeof(op));
if (!sna->render.composite(sna,
PictOpSrc,
tmp_src, NULL, tmp_dst,
- box.x1 + ww*j, box.y1 + hh*i,
+ box.x1 + b.x1, box.y1 + b.y1,
0, 0,
- ww*j, hh*i,
- ww, hh,
+ b.x1, b.y1,
+ b.x2 - b.x1, b.y2 - b.y1,
&op)) {
tmp_src->transform = NULL;
FreePicture(tmp_src, 0);
@@ -582,11 +609,6 @@ static int sna_render_picture_downsample(struct sna *sna,
goto fixup;
}
- b.x1 = ww*j;
- b.y1 = hh*i;
- b.x2 = b.x1 + ww;
- b.y2 = b.y1 + hh;
-
op.boxes(sna, &op, &b, 1);
op.done(sna, &op);
}