kmssink: add parameter force-modesetting

The force-modesetting parameter forces the kmssink to ignore already
configured display modes, to configure the display mode itself and use
the base plane for output.

https://bugzilla.gnome.org/show_bug.cgi?id=773473
This commit is contained in:
Michael Tretter 2016-10-18 14:57:25 +02:00 committed by Víctor Manuel Jáquez Leal
parent 3d0c5dd58e
commit dff77fd15f

View file

@ -75,6 +75,7 @@ enum
PROP_DRIVER_NAME = 1, PROP_DRIVER_NAME = 1,
PROP_CONNECTOR_ID, PROP_CONNECTOR_ID,
PROP_PLANE_ID, PROP_PLANE_ID,
PROP_FORCE_MODESETTING,
PROP_N PROP_N
}; };
@ -515,8 +516,8 @@ gst_kms_sink_start (GstBaseSink * bsink)
if (!crtc) if (!crtc)
goto crtc_failed; goto crtc_failed;
if (!crtc->mode_valid) { if (!crtc->mode_valid || self->modesetting_enabled) {
GST_DEBUG_OBJECT (self, "crtc has no valid mode: enabling modesetting"); GST_DEBUG_OBJECT (self, "enabling modesetting");
self->modesetting_enabled = TRUE; self->modesetting_enabled = TRUE;
universal_planes = TRUE; universal_planes = TRUE;
} }
@ -1306,6 +1307,9 @@ gst_kms_sink_set_property (GObject * object, guint prop_id,
case PROP_PLANE_ID: case PROP_PLANE_ID:
sink->plane_id = g_value_get_int (value); sink->plane_id = g_value_get_int (value);
break; break;
case PROP_FORCE_MODESETTING:
sink->modesetting_enabled = g_value_get_boolean (value);
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;
@ -1330,6 +1334,9 @@ gst_kms_sink_get_property (GObject * object, guint prop_id,
case PROP_PLANE_ID: case PROP_PLANE_ID:
g_value_set_int (value, sink->plane_id); g_value_set_int (value, sink->plane_id);
break; break;
case PROP_FORCE_MODESETTING:
g_value_set_boolean (value, sink->modesetting_enabled);
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;
@ -1426,6 +1433,18 @@ gst_kms_sink_class_init (GstKMSSinkClass * klass)
"Plane ID", "DRM plane id", -1, G_MAXINT32, -1, "Plane ID", "DRM plane id", -1, G_MAXINT32, -1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
/**
* kmssink:force-modesetting:
*
* If the output connector is already active, the sink automatically uses an
* overlay plane. Enforce mode setting in the kms sink and output to the
* base plane to override the automatic behavior.
*/
g_properties[PROP_FORCE_MODESETTING] =
g_param_spec_boolean ("force-modesetting", "Force modesetting",
"When enabled, the sink try to configure the display mode", 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);
} }