xf86-video-intel: 2 commits - src/sna/sna_video.h src/sna/sna_video_sprite.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Apr 24 12:02:10 UTC 2018


 src/sna/sna_video.h        |    1 -
 src/sna/sna_video_sprite.c |   23 ++++++++++++++---------
 2 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit d7dfab62a9853b44bbcd67dac08391d8e5114c97
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Apr 23 18:43:21 2018 +0300

    sna/video/sprite: Retry with GPU scaling if setplane fails
    
    The kernel may reject the setplane due to eg. exceeding the max
    downscaling limit of the hardware. In that case let's retry the
    operation but let the GPU do the scaling for us.
    
    Tested on my IVB, after hacking the kernel to reject setplane
    which exceeds the max hw downscaling limit.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 7095e16c..56391aa6 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -433,14 +433,16 @@ static int sna_video_sprite_put_image(ddPutImage_ARGS)
 	for (i = 0; i < video->sna->mode.num_real_crtc; i++) {
 		xf86CrtcPtr crtc = config->crtc[i];
 		struct sna_video_frame frame;
-		BoxRec dst = draw_extents;
-		int pipe;
+		const int pipe = sna_crtc_pipe(crtc);
+		bool hw_scaling = has_hw_scaling(sna, video);
 		INT32 x1, x2, y1, y2;
-		RegionRec reg;
 		Rotation rotation;
+		RegionRec reg;
+		BoxRec dst;
 		bool cache_bo;
 
-		pipe = sna_crtc_pipe(crtc);
+retry:
+		dst = draw_extents;
 
 		sna_video_frame_init(video, format->id, width, height, &frame);
 
@@ -540,7 +542,7 @@ off:
 			cache_bo = true;
 		}
 
-		if (!has_hw_scaling(sna, video) && sna->render.video &&
+		if (!hw_scaling && sna->render.video &&
 		    !((frame.src.x2 - frame.src.x1) == (dst.x2 - dst.x1) &&
 		      (frame.src.y2 - frame.src.y1) == (dst.y2 - dst.y1))) {
 			ScreenPtr screen = to_screen_from_sna(sna);
@@ -603,8 +605,14 @@ off:
 		else
 			kgem_bo_destroy(&sna->kgem, frame.bo);
 
-		if (ret != Success)
+		if (ret != Success) {
+			/* retry with GPU scaling */
+			if (hw_scaling) {
+				hw_scaling = false;
+				goto retry;
+			}
 			goto err;
+		}
 	}
 
 	sna_video_fill_colorkey(video, &clip);
commit 0cf51c7ea9cbde2a0502c311845c10a929cad152
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Apr 23 22:24:35 2018 +0300

    sna/video/sprite: Remove stale video->plane
    
    video->plane is never populated so nuke it. Its only user can be nuked
    as well since all it's trying to do is turn off the plane (which fails
    on account plane_id being zero). We don't need to disable the plane
    immediately upon the setplane failure as the higher level code will
    end up stopping the entire port on error, and thus the plane will get
    disabled just fine.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    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 6abf6d54..bbd3f0fd 100644
--- a/src/sna/sna_video.h
+++ b/src/sna/sna_video.h
@@ -111,7 +111,6 @@ struct sna_video {
 	int alignment;
 	bool tiled;
 	bool textured;
-	int plane;
 
 	struct kgem_bo *bo[4];
 	RegionRec clip;
diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index f713ba35..7095e16c 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -381,9 +381,6 @@ sna_video_sprite_show(struct sna *sna,
 
 	if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s)) {
 		DBG(("SET_PLANE failed: ret=%d\n", errno));
-		memset(&s, 0, sizeof(s));
-		s.plane_id = video->plane;
-		(void)drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s);
 		if (video->bo[pipe]) {
 			kgem_bo_destroy(&sna->kgem, video->bo[pipe]);
 			video->bo[pipe] = NULL;


More information about the xorg-commit mailing list