@@ -334,6 +334,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
crtc->worker = NULL;
return ret;
}
+
+ drm_object_attach_property(&crtc->base,
+ config->kwork_tid_property, 0);
}
return 0;
@@ -215,6 +215,13 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] = {
{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
};
+static int get_kwork_tid(struct drm_mode_object *obj, uint64_t *val)
+{
+ struct drm_crtc *crtc = obj_to_crtc(obj);
+ *val = task_pid_vnr(crtc->worker->task);
+ return 0;
+}
+
static int drm_mode_create_standard_properties(struct drm_device *dev)
{
struct drm_property *prop;
@@ -371,6 +378,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
return -ENOMEM;
dev->mode_config.modifiers_property = prop;
+ prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC,
+ "KWORK_TID", 0, UINT_MAX);
+ if (!prop)
+ return -ENOMEM;
+ prop->get_value = get_kwork_tid;
+ dev->mode_config.kwork_tid_property = prop;
+
return 0;
}
@@ -285,6 +285,7 @@ int drm_object_property_set_value(struct drm_mode_object *obj,
WARN_ON(drm_drv_uses_atomic_modeset(property->dev) &&
!(property->flags & DRM_MODE_PROP_IMMUTABLE));
+ WARN_ON(property->get_value);
for (i = 0; i < obj->properties->count; i++) {
if (obj->properties->properties[i] == property) {
@@ -303,6 +304,9 @@ static int __drm_object_property_get_value(struct drm_mode_object *obj,
{
int i;
+ if (property->get_value)
+ return property->get_value(obj, val);
+
/* read-only properties bypass atomic mechanism and still store
* their value in obj->properties->values[].. mostly to avoid
* having to deal w/ EDID and similar props in atomic paths:
@@ -926,6 +926,15 @@ struct drm_mode_config {
*/
struct drm_property *modifiers_property;
+ /**
+ * @kwork_tid_property: CRTC property to expose the task-id of the per-
+ * CRTC kthread-worker, used for non-block atomic commit. This is exposed
+ * to userspace, to allow userspace to control the scheduling policy and
+ * priority, as this is a decision that depends on how userspace structures
+ * it's rendering pipeline.
+ */
+ struct drm_property *kwork_tid_property;
+
/* cursor size */
uint32_t cursor_width, cursor_height;
@@ -188,6 +188,15 @@ struct drm_property {
* enum and bitmask values.
*/
struct list_head enum_list;
+
+ /**
+ * @get_value: accessor to get current value for "virtual" properties
+ *
+ * For properties with dynamic values, where it is for whatever reason
+ * not feasible to keep updated with drm_object_property_set_value(),
+ * this callback can be used to retrieve the current value on demand.
+ */
+ int (*get_value)(struct drm_mode_object *obj, uint64_t *val);
};
/**