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@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Ville Syrjälä 2018-04-23 18:43:21 +03:00 committed by Chris Wilson
parent 0cf51c7ea9
commit d7dfab62a9
1 changed files with 14 additions and 6 deletions

View File

@ -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);