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 enum
{ {
PROP_DRIVER_NAME = 1, PROP_DRIVER_NAME = 1,
PROP_BUS_ID,
PROP_CONNECTOR_ID, PROP_CONNECTOR_ID,
PROP_PLANE_ID, PROP_PLANE_ID,
PROP_FORCE_MODESETTING, PROP_FORCE_MODESETTING,
@ -561,8 +562,8 @@ gst_kms_sink_start (GstBaseSink * bsink)
pres = NULL; pres = NULL;
plane = NULL; plane = NULL;
if (self->devname) if (self->devname || self->bus_id)
self->fd = drmOpen (self->devname, NULL); self->fd = drmOpen (self->devname, self->bus_id);
else else
self->fd = kms_open (&self->devname); self->fd = kms_open (&self->devname);
if (self->fd < 0) if (self->fd < 0)
@ -1436,6 +1437,10 @@ gst_kms_sink_set_property (GObject * object, guint prop_id,
g_free (sink->devname); g_free (sink->devname);
sink->devname = g_value_dup_string (value); sink->devname = g_value_dup_string (value);
break; break;
case PROP_BUS_ID:
g_free (sink->bus_id);
sink->bus_id = g_value_dup_string (value);
break;
case PROP_CONNECTOR_ID: case PROP_CONNECTOR_ID:
sink->conn_id = g_value_get_int (value); sink->conn_id = g_value_get_int (value);
break; break;
@ -1463,6 +1468,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id,
case PROP_DRIVER_NAME: case PROP_DRIVER_NAME:
g_value_take_string (value, sink->devname); g_value_take_string (value, sink->devname);
break; break;
case PROP_BUS_ID:
g_value_take_string (value, sink->bus_id);
break;
case PROP_CONNECTOR_ID: case PROP_CONNECTOR_ID:
g_value_set_int (value, sink->conn_id); g_value_set_int (value, sink->conn_id);
break; break;
@ -1485,6 +1493,7 @@ gst_kms_sink_finalize (GObject * object)
sink = GST_KMS_SINK (object); sink = GST_KMS_SINK (object);
g_clear_pointer (&sink->devname, g_free); g_clear_pointer (&sink->devname, g_free);
g_clear_pointer (&sink->bus_id, g_free);
gst_poll_free (sink->poll); gst_poll_free (sink->poll);
G_OBJECT_CLASS (parent_class)->finalize (object); 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, "device name", "DRM device driver name", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT); 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: * kmssink:connector-id:
* *

View file

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