diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-05-15 23:00:53 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-05-16 10:02:16 +0100 |
commit | e73d51247be5018fe53346f991e2f178c917cb13 (patch) | |
tree | 5e97d41d8dc68b6e446a0ab91fbb98c14150f5ba | |
parent | 10c18b1a4631ebab5508f4308c73129f2111e964 (diff) |
sna/video: Only migrate the destination window
By using move-area-to-gpu and specifying that we overwrite the target
area, we can optimize away any needless damage migration.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/gen3_render.c | 3 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 7 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 7 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 7 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 7 | ||||
-rw-r--r-- | src/sna/gen8_render.c | 7 | ||||
-rw-r--r-- | src/sna/sna_video_textured.c | 17 |
7 files changed, 22 insertions, 33 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 6ba1bb49..fffdb5af 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -5398,9 +5398,8 @@ gen3_render_video(struct sna *sna, DBG(("%s: src:%dx%d (frame:%dx%d) -> dst:%dx%d\n", __FUNCTION__, src_width, src_height, frame->width, frame->height, dst_width, dst_height)); + assert(priv->gpu_bo); dst_bo = priv->gpu_bo; - if (dst_bo == NULL) - return false; bilinear = src_width != dst_width || src_height != dst_height; diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index f74757b9..3015c2cc 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1398,6 +1398,7 @@ gen4_render_video(struct sna *sna, PixmapPtr pixmap) { struct sna_composite_op tmp; + struct sna_pixmap *priv = sna_pixmap(pixmap); int dst_width = dstRegion->extents.x2 - dstRegion->extents.x1; int dst_height = dstRegion->extents.y2 - dstRegion->extents.y1; int src_width = frame->src.x2 - frame->src.x1; @@ -1405,16 +1406,12 @@ gen4_render_video(struct sna *sna, float src_offset_x, src_offset_y; float src_scale_x, src_scale_y; int nbox, pix_xoff, pix_yoff; - struct sna_pixmap *priv; BoxPtr box; DBG(("%s: %dx%d -> %dx%d\n", __FUNCTION__, src_width, src_height, dst_width, dst_height)); - priv = sna_pixmap_force_to_gpu(pixmap, MOVE_READ | MOVE_WRITE); - if (priv == NULL) - return false; - + assert(priv->gpu_bo); memset(&tmp, 0, sizeof(tmp)); tmp.op = PictOpSrc; diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 67b0527a..9ad7afe5 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1348,6 +1348,7 @@ gen5_render_video(struct sna *sna, PixmapPtr pixmap) { struct sna_composite_op tmp; + struct sna_pixmap *priv = sna_pixmap(pixmap); int dst_width = dstRegion->extents.x2 - dstRegion->extents.x1; int dst_height = dstRegion->extents.y2 - dstRegion->extents.y1; int src_width = frame->src.x2 - frame->src.x1; @@ -1355,16 +1356,12 @@ gen5_render_video(struct sna *sna, float src_offset_x, src_offset_y; float src_scale_x, src_scale_y; int nbox, pix_xoff, pix_yoff; - struct sna_pixmap *priv; BoxPtr box; DBG(("%s: %dx%d -> %dx%d\n", __FUNCTION__, src_width, src_height, dst_width, dst_height)); - priv = sna_pixmap_force_to_gpu(pixmap, MOVE_READ | MOVE_WRITE); - if (priv == NULL) - return false; - + assert(priv->gpu_bo); memset(&tmp, 0, sizeof(tmp)); tmp.op = PictOpSrc; diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index cb6f2937..8e25dc4b 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -1585,6 +1585,7 @@ gen6_render_video(struct sna *sna, PixmapPtr pixmap) { struct sna_composite_op tmp; + struct sna_pixmap *priv = sna_pixmap(pixmap); int dst_width = dstRegion->extents.x2 - dstRegion->extents.x1; int dst_height = dstRegion->extents.y2 - dstRegion->extents.y1; int src_width = frame->src.x2 - frame->src.x1; @@ -1592,7 +1593,6 @@ gen6_render_video(struct sna *sna, float src_offset_x, src_offset_y; float src_scale_x, src_scale_y; int nbox, pix_xoff, pix_yoff; - struct sna_pixmap *priv; unsigned filter; BoxPtr box; @@ -1605,10 +1605,7 @@ gen6_render_video(struct sna *sna, REGION_EXTENTS(NULL, dstRegion)->x2, REGION_EXTENTS(NULL, dstRegion)->y2)); - priv = sna_pixmap_force_to_gpu(pixmap, MOVE_READ | MOVE_WRITE); - if (priv == NULL) - return false; - + assert(priv->gpu_bo); memset(&tmp, 0, sizeof(tmp)); tmp.dst.pixmap = pixmap; diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 8d32c3e1..2e1682cb 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -1828,6 +1828,7 @@ gen7_render_video(struct sna *sna, PixmapPtr pixmap) { struct sna_composite_op tmp; + struct sna_pixmap *priv = sna_pixmap(pixmap); int dst_width = dstRegion->extents.x2 - dstRegion->extents.x1; int dst_height = dstRegion->extents.y2 - dstRegion->extents.y1; int src_width = frame->src.x2 - frame->src.x1; @@ -1835,7 +1836,6 @@ gen7_render_video(struct sna *sna, float src_offset_x, src_offset_y; float src_scale_x, src_scale_y; int nbox, pix_xoff, pix_yoff; - struct sna_pixmap *priv; unsigned filter; BoxPtr box; @@ -1848,10 +1848,7 @@ gen7_render_video(struct sna *sna, REGION_EXTENTS(NULL, dstRegion)->x2, REGION_EXTENTS(NULL, dstRegion)->y2)); - priv = sna_pixmap_force_to_gpu(pixmap, MOVE_READ | MOVE_WRITE); - if (priv == NULL) - return false; - + assert(priv->gpu_bo); memset(&tmp, 0, sizeof(tmp)); tmp.dst.pixmap = pixmap; diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c index 0b7979e1..bda37002 100644 --- a/src/sna/gen8_render.c +++ b/src/sna/gen8_render.c @@ -3644,6 +3644,7 @@ gen8_render_video(struct sna *sna, PixmapPtr pixmap) { struct sna_composite_op tmp; + struct sna_pixmap *priv = sna_pixmap(pixmap); int dst_width = dstRegion->extents.x2 - dstRegion->extents.x1; int dst_height = dstRegion->extents.y2 - dstRegion->extents.y1; int src_width = frame->src.x2 - frame->src.x1; @@ -3651,7 +3652,6 @@ gen8_render_video(struct sna *sna, float src_offset_x, src_offset_y; float src_scale_x, src_scale_y; int nbox, pix_xoff, pix_yoff; - struct sna_pixmap *priv; unsigned filter; BoxPtr box; @@ -3664,10 +3664,7 @@ gen8_render_video(struct sna *sna, REGION_EXTENTS(NULL, dstRegion)->x2, REGION_EXTENTS(NULL, dstRegion)->y2)); - priv = sna_pixmap_force_to_gpu(pixmap, MOVE_READ | MOVE_WRITE); - if (priv == NULL) - return false; - + assert(priv->gpu_bo); memset(&tmp, 0, sizeof(tmp)); tmp.dst.pixmap = pixmap; diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c index c2a37bf1..335769c6 100644 --- a/src/sna/sna_video_textured.c +++ b/src/sna/sna_video_textured.c @@ -170,6 +170,7 @@ sna_video_textured_put_image(ClientPtr client, struct sna *sna = video->sna; struct sna_video_frame frame; PixmapPtr pixmap = get_drawable_pixmap(draw); + unsigned int flags; BoxRec dstBox; RegionRec clip; xf86CrtcPtr crtc; @@ -197,12 +198,6 @@ sna_video_textured_put_image(ClientPtr client, clip.extents.x1, clip.extents.y1, clip.extents.x2, clip.extents.y2)); - if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_WRITE)) { - DBG(("%s: attempting to render to a non-GPU pixmap\n", - __FUNCTION__)); - return BadAlloc; - } - sna_video_frame_init(video, format->id, width, height, &frame); if (!sna_video_clip_helper(video, &frame, &crtc, &dstBox, @@ -211,6 +206,16 @@ sna_video_textured_put_image(ClientPtr client, &clip)) return Success; + flags = MOVE_WRITE | __MOVE_FORCE; + if (clip.data) + flags |= MOVE_READ; + + if (!sna_pixmap_move_area_to_gpu(pixmap, &clip.extents, flags)) { + DBG(("%s: attempting to render to a non-GPU pixmap\n", + __FUNCTION__)); + return BadAlloc; + } + sna_video_frame_set_rotation(video, &frame, RR_Rotate_0); if (xvmc_passthrough(format->id)) { |