mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
kmssink: Add skip-vsync property
The legacy emulation in DRM/KMS drivers badly interact with GStreamer and may cause the framerate to be halved. With this property, users can disable vsync (which is handled internally by the emulation) in order to regain the full framerate. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3303>
This commit is contained in:
parent
f9dbf91539
commit
daecbd1ff0
3 changed files with 36 additions and 1 deletions
|
@ -31312,6 +31312,18 @@
|
||||||
"readable": true,
|
"readable": true,
|
||||||
"type": "gboolean",
|
"type": "gboolean",
|
||||||
"writable": true
|
"writable": true
|
||||||
|
},
|
||||||
|
"skip-vsync": {
|
||||||
|
"blurb": "When enabled will not wait internally for vsync. Should be used for atomic drivers to avoid double vsync.",
|
||||||
|
"conditionally-available": false,
|
||||||
|
"construct": true,
|
||||||
|
"construct-only": false,
|
||||||
|
"controllable": false,
|
||||||
|
"default": "false",
|
||||||
|
"mutable": "null",
|
||||||
|
"readable": true,
|
||||||
|
"type": "gboolean",
|
||||||
|
"writable": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rank": "secondary"
|
"rank": "secondary"
|
||||||
|
|
|
@ -98,6 +98,7 @@ enum
|
||||||
PROP_CONNECTOR_PROPS,
|
PROP_CONNECTOR_PROPS,
|
||||||
PROP_PLANE_PROPS,
|
PROP_PLANE_PROPS,
|
||||||
PROP_FD,
|
PROP_FD,
|
||||||
|
PROP_SKIP_VSYNC,
|
||||||
PROP_N,
|
PROP_N,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1683,7 +1684,7 @@ retry_set_plane:
|
||||||
|
|
||||||
sync_frame:
|
sync_frame:
|
||||||
/* Wait for the previous frame to complete redraw */
|
/* Wait for the previous frame to complete redraw */
|
||||||
if (!gst_kms_sink_sync (self)) {
|
if (!self->skip_vsync && !gst_kms_sink_sync (self)) {
|
||||||
GST_OBJECT_UNLOCK (self);
|
GST_OBJECT_UNLOCK (self);
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
@ -1884,6 +1885,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_FD:
|
case PROP_FD:
|
||||||
_validate_and_set_external_fd (sink, g_value_get_int (value));
|
_validate_and_set_external_fd (sink, g_value_get_int (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_SKIP_VSYNC:
|
||||||
|
sink->skip_vsync = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (!gst_video_overlay_set_property (object, PROP_N, prop_id, value))
|
if (!gst_video_overlay_set_property (object, PROP_N, prop_id, value))
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -1940,6 +1944,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_FD:
|
case PROP_FD:
|
||||||
g_value_set_int (value, sink->fd);
|
g_value_set_int (value, sink->fd);
|
||||||
break;
|
break;
|
||||||
|
case PROP_SKIP_VSYNC:
|
||||||
|
g_value_set_boolean (value, sink->skip_vsync);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -1973,6 +1980,7 @@ gst_kms_sink_init (GstKMSSink * sink)
|
||||||
gst_poll_fd_init (&sink->pollfd);
|
gst_poll_fd_init (&sink->pollfd);
|
||||||
sink->poll = gst_poll_new (TRUE);
|
sink->poll = gst_poll_new (TRUE);
|
||||||
gst_video_info_init (&sink->vinfo);
|
gst_video_info_init (&sink->vinfo);
|
||||||
|
sink->skip_vsync = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2152,6 +2160,20 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass)
|
||||||
"DRM file descriptor", -1, G_MAXINT, -1,
|
"DRM file descriptor", -1, G_MAXINT, -1,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kmssink:skip-vsync:
|
||||||
|
*
|
||||||
|
* For some cases, to suppress internal vsync, which can drop framerate
|
||||||
|
* in half, set this to 1.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
g_properties[PROP_SKIP_VSYNC] =
|
||||||
|
g_param_spec_boolean ("skip-vsync", "Skip Internal VSync",
|
||||||
|
"When enabled will not wait internally for vsync. "
|
||||||
|
"Should be used for atomic drivers to avoid double vsync.", FALSE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class, PROP_N, g_properties);
|
g_object_class_install_properties (gobject_class, PROP_N, g_properties);
|
||||||
|
|
||||||
gst_video_overlay_install_properties (gobject_class, PROP_N);
|
gst_video_overlay_install_properties (gobject_class, PROP_N);
|
||||||
|
|
|
@ -95,6 +95,7 @@ struct _GstKMSSink {
|
||||||
gboolean reconfigure;
|
gboolean reconfigure;
|
||||||
|
|
||||||
gboolean is_internal_fd;
|
gboolean is_internal_fd;
|
||||||
|
gboolean skip_vsync;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstKMSSinkClass {
|
struct _GstKMSSinkClass {
|
||||||
|
|
Loading…
Reference in a new issue