diff --git a/docs/plugins/gst-plugins-bad-plugins.args b/docs/plugins/gst-plugins-bad-plugins.args
index 90ce2abaa5..2f8cc38efa 100644
--- a/docs/plugins/gst-plugins-bad-plugins.args
+++ b/docs/plugins/gst-plugins-bad-plugins.args
@@ -72070,6 +72070,16 @@ Gestures in the defined region of interest will emit messages.
NULL
+
+GstKMSSink::plane-id
+gint
+>= G_MAXULONG
+rwx
+Plane ID
+DRM plane id.
+-1
+
+
GstBs2b::fcut
gint
diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
index 90ce3ffd08..3c1c954fde 100644
--- a/sys/kms/gstkmssink.c
+++ b/sys/kms/gstkmssink.c
@@ -73,6 +73,7 @@ enum
{
PROP_DRIVER_NAME = 1,
PROP_CONNECTOR_ID,
+ PROP_PLANE_ID,
PROP_N
};
@@ -391,7 +392,10 @@ gst_kms_sink_start (GstBaseSink * bsink)
if (!pres)
goto plane_resources_failed;
- plane = find_plane_for_crtc (self->fd, res, pres, crtc->crtc_id);
+ if (self->plane_id == -1)
+ plane = find_plane_for_crtc (self->fd, res, pres, crtc->crtc_id);
+ else
+ plane = drmModeGetPlane (self->fd, self->plane_id);
if (!plane)
goto plane_failed;
@@ -1153,6 +1157,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id,
case PROP_CONNECTOR_ID:
sink->conn_id = g_value_get_int (value);
break;
+ case PROP_PLANE_ID:
+ sink->plane_id = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1174,6 +1181,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id,
case PROP_CONNECTOR_ID:
g_value_set_int (value, sink->conn_id);
break;
+ case PROP_PLANE_ID:
+ g_value_set_int (value, sink->plane_id);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1197,6 +1207,7 @@ gst_kms_sink_init (GstKMSSink * sink)
{
sink->fd = -1;
sink->conn_id = -1;
+ sink->plane_id = -1;
gst_poll_fd_init (&sink->pollfd);
sink->poll = gst_poll_new (TRUE);
gst_video_info_init (&sink->vinfo);
@@ -1259,6 +1270,17 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass)
"Connector ID", "DRM connector id", -1, G_MAXINT32, -1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ /**
+ * kmssink:plane-id:
+ *
+ * There could be several planes associated with a CRTC.
+ * By default the first plane that's possible to use with a given
+ * CRTC is tried.
+ */
+ g_properties[PROP_PLANE_ID] = g_param_spec_int ("plane-id",
+ "Plane ID", "DRM plane id", -1, G_MAXINT32, -1,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+
g_object_class_install_properties (gobject_class, PROP_N, g_properties);
}