summaryrefslogtreecommitdiff
path: root/src/sna/gen6_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-11-08 12:54:09 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-11-08 17:15:47 +0000
commit7fc15ec3975e3a99a6bbb869c07172cdee6e5f63 (patch)
treecacba7044b019d5ddcdb366fe02db6d642ebeca7 /src/sna/gen6_render.c
parent694e9bc4e2e9a73ce72b1fb9ef8ecbf773b901fe (diff)
sna/video: Move the composite offsets into the dstRegion
Move the application of the composite offset from the backends into the caller so that we correctly apply the offset to the dstRegion prior to calling move-to-gpu with that set of boxes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen6_render.c')
-rw-r--r--src/sna/gen6_render.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 0fc10210..23943aa9 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1633,9 +1633,9 @@ gen6_render_video(struct sna *sna,
int src_height = frame->src.y2 - frame->src.y1;
float src_offset_x, src_offset_y;
float src_scale_x, src_scale_y;
- int nbox, pix_xoff, pix_yoff;
unsigned filter;
const BoxRec *box;
+ int nbox;
DBG(("%s: src=(%d, %d), dst=(%d, %d), %dx[(%d, %d), (%d, %d)...]\n",
__FUNCTION__,
@@ -1686,17 +1686,6 @@ gen6_render_video(struct sna *sna,
gen6_align_vertex(sna, &tmp);
gen6_emit_video_state(sna, &tmp);
- /* Set up the offset for translating from the given region (in screen
- * coordinates) to the backing pixmap.
- */
-#ifdef COMPOSITE
- pix_xoff = -pixmap->screen_x + pixmap->drawable.x;
- pix_yoff = -pixmap->screen_y + pixmap->drawable.y;
-#else
- pix_xoff = 0;
- pix_yoff = 0;
-#endif
-
src_scale_x = (float)src_width / dst_width / frame->width;
src_offset_x = (float)frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
@@ -1706,35 +1695,26 @@ gen6_render_video(struct sna *sna,
box = region_rects(dstRegion);
nbox = region_num_rects(dstRegion);
while (nbox--) {
- BoxRec r;
-
- r.x1 = box->x1 + pix_xoff;
- r.x2 = box->x2 + pix_xoff;
- r.y1 = box->y1 + pix_yoff;
- r.y2 = box->y2 + pix_yoff;
-
gen6_get_rectangles(sna, &tmp, 1, gen6_emit_video_state);
- OUT_VERTEX(r.x2, r.y2);
+ OUT_VERTEX(box->x2, box->y2);
OUT_VERTEX_F(box->x2 * src_scale_x + src_offset_x);
OUT_VERTEX_F(box->y2 * src_scale_y + src_offset_y);
- OUT_VERTEX(r.x1, r.y2);
+ OUT_VERTEX(box->x1, box->y2);
OUT_VERTEX_F(box->x1 * src_scale_x + src_offset_x);
OUT_VERTEX_F(box->y2 * src_scale_y + src_offset_y);
- OUT_VERTEX(r.x1, r.y1);
+ OUT_VERTEX(box->x1, box->y1);
OUT_VERTEX_F(box->x1 * src_scale_x + src_offset_x);
OUT_VERTEX_F(box->y1 * src_scale_y + src_offset_y);
- if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
- sna_damage_add_box(&priv->gpu_damage, &r);
- sna_damage_subtract_box(&priv->cpu_damage, &r);
- }
box++;
}
-
gen4_vertex_flush(sna);
+
+ sna_damage_add(&priv->gpu_damage, dstRegion);
+
return true;
}