kmssink: if the plane can not scale, retry without scaling and remember

Retry the drmModeSetPlane call without scaling if the first try fails,
and remember not to scale anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=781188
This commit is contained in:
Philipp Zabel 2016-10-19 14:56:06 +02:00 committed by Víctor Manuel Jáquez Leal
parent e0e1db212f
commit 9ed9c14eb5
2 changed files with 11 additions and 2 deletions

View file

@ -517,6 +517,8 @@ gst_kms_sink_start (GstBaseSink * bsink)
if (!get_drm_caps (self))
goto bail;
self->can_scale = TRUE;
res = drmModeGetResources (self->fd);
if (!res)
goto resources_failed;
@ -1261,7 +1263,8 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
dst.w = self->hdisplay;
dst.h = self->vdisplay;
gst_video_sink_center_rect (src, dst, &result, TRUE);
retry_set_plane:
gst_video_sink_center_rect (src, dst, &result, self->can_scale);
if (crop) {
src.w = crop->width;
@ -1279,8 +1282,13 @@ gst_kms_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
result.x, result.y, result.w, result.h,
/* source/cropping coordinates are given in Q16 */
src.x << 16, src.y << 16, src.w << 16, src.h << 16);
if (ret)
if (ret) {
if (self->can_scale) {
self->can_scale = FALSE;
goto retry_set_plane;
}
goto set_plane_failed;
}
sync_frame:
/* Wait for the previous frame to complete redraw */

View file

@ -61,6 +61,7 @@ struct _GstKMSSink {
/* capabilities */
gboolean has_prime_import;
gboolean has_async_page_flip;
gboolean can_scale;
gboolean modesetting_enabled;