diff mbox

[xf86-video-intel] sna/video: Try to use hw scaling with SKL+ sprites

Message ID 20180202204252.28031-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Feb. 2, 2018, 8:42 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

SKL reintroduced plane scaling once more. Let's try to make use of it.

The one annoying caveat is that you can't do colorkeying and scaling at
the same time :(  For now we'll leave the choice of colorkey vs.
scaling to the user via that XV_ALWAYS_ON_TOP attribute.

One possible idea for improving the situation would be to add support
for autopaint colorkey, and automatically disable the colorkey whenever
the window is not obscured by anything and autopaint colorkey is enabled.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_video_sprite.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Chris Wilson Feb. 2, 2018, 9:15 p.m. UTC | #1
Quoting Ville Syrjala (2018-02-02 20:42:52)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> SKL reintroduced plane scaling once more. Let's try to make use of it.
> 
> The one annoying caveat is that you can't do colorkeying and scaling at
> the same time :(  For now we'll leave the choice of colorkey vs.
> scaling to the user via that XV_ALWAYS_ON_TOP attribute.

Fair enough, that attribute is fairly magic to force the plane to act as
an overlay plane and keep X's grubby hands off. Having it autoscale
would be fun :)
 
> One possible idea for improving the situation would be to add support
> for autopaint colorkey, and automatically disable the colorkey whenever
> the window is not obscured by anything and autopaint colorkey is enabled.

Ok, the way you've written it, it should allow us to extend support as
desired. Lgtm, thanks.
-Chris
Chris Wilson Feb. 6, 2018, 1:12 p.m. UTC | #2
Quoting Chris Wilson (2018-02-02 21:15:09)
> Quoting Ville Syrjala (2018-02-02 20:42:52)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > SKL reintroduced plane scaling once more. Let's try to make use of it.
> > 
> > The one annoying caveat is that you can't do colorkeying and scaling at
> > the same time :(  For now we'll leave the choice of colorkey vs.
> > scaling to the user via that XV_ALWAYS_ON_TOP attribute.
> 
> Fair enough, that attribute is fairly magic to force the plane to act as
> an overlay plane and keep X's grubby hands off. Having it autoscale
> would be fun :)
>  
> > One possible idea for improving the situation would be to add support
> > for autopaint colorkey, and automatically disable the colorkey whenever
> > the window is not obscured by anything and autopaint colorkey is enabled.
> 
> Ok, the way you've written it, it should allow us to extend support as
> desired. Lgtm, thanks.

And pushed, thanks.
-Chris
diff mbox

Patch

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 69bfdfd21b29..44898a748e1c 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -47,7 +47,9 @@ 
 #define DRM_FORMAT_YUYV         fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
 #define DRM_FORMAT_UYVY         fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
 
-#define has_hw_scaling(sna) ((sna)->kgem.gen < 071)
+#define has_hw_scaling(sna, video) ((sna)->kgem.gen < 071 || \
+				    ((sna)->kgem.gen >= 0110 && (video)->AlwaysOnTop))
+
 
 #define LOCAL_IOCTL_MODE_SETPLANE	DRM_IOWR(0xB7, struct local_mode_set_plane)
 struct local_mode_set_plane {
@@ -153,7 +155,7 @@  static int sna_video_sprite_best_size(ddQueryBestSize_ARGS)
 	struct sna_video *video = port->devPriv.ptr;
 	struct sna *sna = video->sna;
 
-	if (!has_hw_scaling(sna) && !sna->render.video) {
+	if (!has_hw_scaling(sna, video) && !sna->render.video) {
 		*p_w = vid_w;
 		*p_h = vid_h;
 	} else {
@@ -524,7 +526,7 @@  off:
 			cache_bo = true;
 		}
 
-		if (!has_hw_scaling(sna) && sna->render.video &&
+		if (!has_hw_scaling(sna, video) && 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);