aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0331-drm-amd-display-Fallback-on-legacy-properties-in-ato.patch
blob: de637a5425c866e30472c85c9be58095058ee64f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From b72421ff02e276181701e07cac145b1ca724531a Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Fri, 27 Jan 2017 10:55:20 -0500
Subject: [PATCH 0331/4131] drm/amd/display: Fallback on legacy properties in
 atomic_get_properties

We still rely on legacy properties. Fallback on legacy properties until
we get to pull these into some atomic state.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 40 +++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index 63ad629..28bd6be 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -1410,6 +1410,43 @@ struct drm_connector_state *amdgpu_dm_connector_atomic_duplicate_state(
 	return NULL;
 }
 
+
+/**
+ * amdgpu_dm_atomic_get_property - fetch connector property value
+ * @connector: connector to fetch property for
+ * @state: state containing the property value
+ * @property: property to look up
+ * @val: pointer to write property value into
+ *
+ * The DRM core does not store shadow copies of properties for
+ * atomic-capable drivers.  This entrypoint is used to fetch
+ * the current value of a driver-specific connector property.
+ */
+int amdgpu_dm_connector_atomic_get_property(struct drm_connector *connector,
+							  const struct drm_connector_state *state,
+							  struct drm_property *property,
+							  uint64_t *val)
+{
+	int i;
+
+	/*
+	 * TODO: Get properties from atomic state or objs.  Until it's ready,
+	 * continue to look up all property values in the DRM's shadow copy
+	 * in obj->properties->values[].
+	 *
+	 * When the crtc/connector state work matures, this function should
+	 * be updated to read the values out of the state structure instead.
+	 */
+	for (i = 0; i < connector->base.properties->count; i++) {
+		if (connector->base.properties->properties[i] == property) {
+			*val = connector->base.properties->values[i];
+			return 0;
+		}
+	}
+
+	return -EINVAL;
+}
+
 static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
 	.dpms = drm_atomic_helper_connector_dpms,
 	.reset = amdgpu_dm_connector_funcs_reset,
@@ -1419,7 +1456,8 @@ static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
 	.destroy = amdgpu_dm_connector_destroy,
 	.atomic_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-	.atomic_set_property = amdgpu_dm_connector_atomic_set_property
+	.atomic_set_property = amdgpu_dm_connector_atomic_set_property,
+	.atomic_get_property = amdgpu_dm_connector_atomic_get_property,
 };
 
 static struct drm_encoder *best_encoder(struct drm_connector *connector)
-- 
2.7.4