xf86-video-intel: src/sna/sna_video.h src/sna/sna_video_overlay.c src/sna/sna_video_sprite.c src/sna/sna_video_textured.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Jan 26 04:51:53 PST 2016
src/sna/sna_video.h | 22 ++++++++++++++++++++++
src/sna/sna_video_overlay.c | 10 ++++------
src/sna/sna_video_sprite.c | 10 ++++------
src/sna/sna_video_textured.c | 7 ++-----
4 files changed, 32 insertions(+), 17 deletions(-)
New commits:
commit bb8dc3ef37580a221a40ba3dcbde755edc59bb62
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jan 26 12:50:13 2016 +0000
sna/video: ValidateGC before use
We required the GC->pCompositeClip in order to apply the current Drawable's
clip to video region, this requires us to call ValidateGC first.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93874
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_video.h b/src/sna/sna_video.h
index dfb8c0c..b278991 100644
--- a/src/sna/sna_video.h
+++ b/src/sna/sna_video.h
@@ -213,4 +213,26 @@ sna_window_set_port(WindowPtr window, XvPortPtr port)
((void **)__get_private(window, sna_window_key))[2] = port;
}
+static inline int offset_and_clip(int x, int dx)
+{
+ x += dx;
+ if (x <= 0)
+ return 0;
+ if (x >= MAXSHORT)
+ return MAXSHORT;
+ return x;
+}
+
+static inline void init_video_region(RegionRec *region,
+ DrawablePtr draw,
+ int drw_x, int drw_y,
+ int drw_w, int drw_h)
+{
+ region->extents.x1 = offset_and_clip(draw->x, drw_x);
+ region->extents.y1 = offset_and_clip(draw->y, drw_y);
+ region->extents.x2 = offset_and_clip(draw->x, drw_x + drw_w);
+ region->extents.y2 = offset_and_clip(draw->y, drw_y + drw_h);
+ region->data = NULL;
+}
+
#endif /* SNA_VIDEO_H */
diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c
index d782113..9bc5ce4 100644
--- a/src/sna/sna_video_overlay.c
+++ b/src/sna/sna_video_overlay.c
@@ -474,15 +474,13 @@ sna_video_overlay_put_image(ddPutImage_ARGS)
if (src_h >= (drw_h * 8))
drw_h = src_h / 7;
- clip.extents.x1 = draw->x + drw_x;
- clip.extents.y1 = draw->y + drw_y;
- clip.extents.x2 = clip.extents.x1 + drw_w;
- clip.extents.y2 = clip.extents.y1 + drw_h;
- clip.data = NULL;
+ init_video_region(&clip, draw, drw_x, drw_y, drw_w, drw_h);
DBG(("%s: always_on_top=%d\n", __FUNCTION__, video->AlwaysOnTop));
- if (!video->AlwaysOnTop)
+ if (!video->AlwaysOnTop) {
+ ValidateGC(draw, gc);
RegionIntersect(&clip, &clip, gc->pCompositeClip);
+ }
if (box_empty(&clip.extents))
goto invisible;
diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 7c8a73f..9e85049 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -373,15 +373,13 @@ static int sna_video_sprite_put_image(ddPutImage_ARGS)
RegionRec clip;
int ret, i;
- clip.extents.x1 = draw->x + drw_x;
- clip.extents.y1 = draw->y + drw_y;
- clip.extents.x2 = clip.extents.x1 + drw_w;
- clip.extents.y2 = clip.extents.y1 + drw_h;
- clip.data = NULL;
+ init_video_region(&clip, draw, drw_x, drw_y, drw_w, drw_h);
DBG(("%s: always_on_top=%d\n", __FUNCTION__, video->AlwaysOnTop));
- if (!video->AlwaysOnTop)
+ if (!video->AlwaysOnTop) {
+ ValidateGC(draw, gc);
RegionIntersect(&clip, &clip, gc->pCompositeClip);
+ }
DBG(("%s: src=(%d, %d),(%d, %d), dst=(%d, %d),(%d, %d), id=%d, sizep=%dx%d, sync?=%d\n",
__FUNCTION__,
diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c
index 3f14a59..f5b7e98 100644
--- a/src/sna/sna_video_textured.c
+++ b/src/sna/sna_video_textured.c
@@ -156,12 +156,9 @@ sna_video_textured_put_image(ddPutImage_ARGS)
if (wedged(sna))
return BadAlloc;
- clip.extents.x1 = draw->x + drw_x;
- clip.extents.y1 = draw->y + drw_y;
- clip.extents.x2 = clip.extents.x1 + drw_w;
- clip.extents.y2 = clip.extents.y1 + drw_h;
- clip.data = NULL;
+ init_video_region(&clip, draw, drw_x, drw_y, drw_w, drw_h);
+ ValidateGC(draw, gc);
RegionIntersect(&clip, &clip, gc->pCompositeClip);
if (!RegionNotEmpty(&clip))
return Success;
More information about the xorg-commit
mailing list