kmssink: Add bus-id property

https://bugzilla.gnome.org/show_bug.cgi?id=786112
This commit is contained in:
Nicolas Dufresne 2017-08-09 14:55:44 -04:00
parent 57b542c5e5
commit a5229c3098
2 changed files with 23 additions and 2 deletions

View file

@ -75,6 +75,7 @@ static void gst_kms_sink_drain (GstKMSSink * self);
enum
{
PROP_DRIVER_NAME = 1,
PROP_BUS_ID,
PROP_CONNECTOR_ID,
PROP_PLANE_ID,
PROP_FORCE_MODESETTING,
@ -561,8 +562,8 @@ gst_kms_sink_start (GstBaseSink * bsink)
pres = NULL;
plane = NULL;
if (self->devname)
self->fd = drmOpen (self->devname, NULL);
if (self->devname || self->bus_id)
self->fd = drmOpen (self->devname, self->bus_id);
else
self->fd = kms_open (&self->devname);
if (self->fd < 0)
@ -1436,6 +1437,10 @@ gst_kms_sink_set_property (GObject * object, guint prop_id,
g_free (sink->devname);
sink->devname = g_value_dup_string (value);
break;
case PROP_BUS_ID:
g_free (sink->bus_id);
sink->bus_id = g_value_dup_string (value);
break;
case PROP_CONNECTOR_ID:
sink->conn_id = g_value_get_int (value);
break;
@ -1463,6 +1468,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id,
case PROP_DRIVER_NAME:
g_value_take_string (value, sink->devname);
break;
case PROP_BUS_ID:
g_value_take_string (value, sink->bus_id);
break;
case PROP_CONNECTOR_ID:
g_value_set_int (value, sink->conn_id);
break;
@ -1485,6 +1493,7 @@ gst_kms_sink_finalize (GObject * object)
sink = GST_KMS_SINK (object);
g_clear_pointer (&sink->devname, g_free);
g_clear_pointer (&sink->bus_id, g_free);
gst_poll_free (sink->poll);
G_OBJECT_CLASS (parent_class)->finalize (object);
@ -1547,6 +1556,17 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass)
"device name", "DRM device driver name", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
/**
* kmssink:bus-id:
*
* If you have a system with multiple displays for the same driver-name,
* you can choose which display to use by setting the DRM bus ID. Otherwise,
* the driver decides which one.
*/
g_properties[PROP_BUS_ID] = g_param_spec_string ("bus-id",
"Bus ID", "DRM bus ID", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
/**
* kmssink:connector-id:
*

View file

@ -74,6 +74,7 @@ struct _GstKMSSink {
GList *mem_cache;
gchar *devname;
gchar *bus_id;
guint32 mm_width, mm_height;