Commit d7dfab62 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Chris Wilson
Browse files

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ä's avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent 0cf51c7e
...@@ -433,14 +433,16 @@ static int sna_video_sprite_put_image(ddPutImage_ARGS) ...@@ -433,14 +433,16 @@ static int sna_video_sprite_put_image(ddPutImage_ARGS)
for (i = 0; i < video->sna->mode.num_real_crtc; i++) { for (i = 0; i < video->sna->mode.num_real_crtc; i++) {
xf86CrtcPtr crtc = config->crtc[i]; xf86CrtcPtr crtc = config->crtc[i];
struct sna_video_frame frame; struct sna_video_frame frame;
BoxRec dst = draw_extents; const int pipe = sna_crtc_pipe(crtc);
int pipe; bool hw_scaling = has_hw_scaling(sna, video);
INT32 x1, x2, y1, y2; INT32 x1, x2, y1, y2;
RegionRec reg;
Rotation rotation; Rotation rotation;
RegionRec reg;
BoxRec dst;
bool cache_bo; bool cache_bo;
pipe = sna_crtc_pipe(crtc); retry:
dst = draw_extents;
sna_video_frame_init(video, format->id, width, height, &frame); sna_video_frame_init(video, format->id, width, height, &frame);
...@@ -540,7 +542,7 @@ off: ...@@ -540,7 +542,7 @@ off:
cache_bo = true; 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.x2 - frame.src.x1) == (dst.x2 - dst.x1) &&
(frame.src.y2 - frame.src.y1) == (dst.y2 - dst.y1))) { (frame.src.y2 - frame.src.y1) == (dst.y2 - dst.y1))) {
ScreenPtr screen = to_screen_from_sna(sna); ScreenPtr screen = to_screen_from_sna(sna);
...@@ -603,8 +605,14 @@ off: ...@@ -603,8 +605,14 @@ off:
else else
kgem_bo_destroy(&sna->kgem, frame.bo); 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; goto err;
}
} }
sna_video_fill_colorkey(video, &clip); sna_video_fill_colorkey(video, &clip);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment