mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
kmssink: Generalize setting DRM object properties
https://bugzilla.gnome.org/show_bug.cgi?id=797027
This commit is contained in:
parent
71ab97cba6
commit
203b41b510
1 changed files with 28 additions and 9 deletions
|
@ -587,10 +587,13 @@ typedef struct
|
||||||
{
|
{
|
||||||
GstKMSSink *self;
|
GstKMSSink *self;
|
||||||
drmModeObjectPropertiesPtr properties;
|
drmModeObjectPropertiesPtr properties;
|
||||||
|
guint obj_id;
|
||||||
|
guint obj_type;
|
||||||
|
const gchar *obj_type_str;
|
||||||
} SetPropsIter;
|
} SetPropsIter;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
set_connector_prop (GQuark field_id, const GValue * value, gpointer user_data)
|
set_obj_prop (GQuark field_id, const GValue * value, gpointer user_data)
|
||||||
{
|
{
|
||||||
SetPropsIter *iter = user_data;
|
SetPropsIter *iter = user_data;
|
||||||
GstKMSSink *self = iter->self;
|
GstKMSSink *self = iter->self;
|
||||||
|
@ -613,18 +616,33 @@ set_connector_prop (GQuark field_id, const GValue * value, gpointer user_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_drm_property (self->fd, self->conn_id, DRM_MODE_OBJECT_CONNECTOR,
|
if (set_drm_property (self->fd, iter->obj_id, iter->obj_type,
|
||||||
iter->properties, name, v)) {
|
iter->properties, name, v)) {
|
||||||
GST_DEBUG_OBJECT (self,
|
GST_DEBUG_OBJECT (self,
|
||||||
"Set connector property '%s' to %" G_GUINT64_FORMAT, name, v);
|
"Set %s property '%s' to %" G_GUINT64_FORMAT,
|
||||||
|
iter->obj_type_str, name, v);
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (self,
|
GST_WARNING_OBJECT (self,
|
||||||
"Failed to set connector property '%s' to %" G_GUINT64_FORMAT, name, v);
|
"Failed to set %s property '%s' to %" G_GUINT64_FORMAT,
|
||||||
|
iter->obj_type_str, name, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_kms_sink_update_properties (SetPropsIter * iter, GstStructure * props)
|
||||||
|
{
|
||||||
|
GstKMSSink *self = iter->self;
|
||||||
|
|
||||||
|
iter->properties = drmModeObjectGetProperties (self->fd, iter->obj_id,
|
||||||
|
iter->obj_type);
|
||||||
|
|
||||||
|
gst_structure_foreach (props, set_obj_prop, iter);
|
||||||
|
|
||||||
|
drmModeFreeObjectProperties (iter->properties);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_kms_sink_update_connector_properties (GstKMSSink * self)
|
gst_kms_sink_update_connector_properties (GstKMSSink * self)
|
||||||
{
|
{
|
||||||
|
@ -634,13 +652,14 @@ gst_kms_sink_update_connector_properties (GstKMSSink * self)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter.self = self;
|
iter.self = self;
|
||||||
iter.properties =
|
iter.obj_id = self->conn_id;
|
||||||
drmModeObjectGetProperties (self->fd, self->conn_id,
|
iter.obj_type = DRM_MODE_OBJECT_CONNECTOR;
|
||||||
DRM_MODE_OBJECT_CONNECTOR);
|
iter.obj_type_str = "connector";
|
||||||
|
|
||||||
|
gst_kms_sink_update_properties (&iter, self->connector_props);
|
||||||
|
}
|
||||||
|
|
||||||
gst_structure_foreach (self->connector_props, set_connector_prop, &iter);
|
|
||||||
|
|
||||||
drmModeFreeObjectProperties (iter.properties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue