Skip to contentSkip to conversation

drm/amd/display: Use root connector's colorspace property for MST

PATCH Superseded Harry Wentland 2 participants 2 messages Jul 11, 2023 – Jul 12, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Harry Wentland

author maintainer
#0 lore raw

PATCH 1/1 drm/amd/display: Use root connector's colorspace property for MST

After driver init we shouldn't create new properties. Doing so will lead to a warning storm from __drm_mode_object_add.

We don't really need to create the property for MST connectors. Re-using the mst_root connector's property is fine.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -2
index 5722b14a6bec..ba493d325dcb 100644
@@ -7359,8 +7359,13 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 			drm_connector_attach_colorspace_property(&aconnector->base);
 	} else if (connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
 		   connector_type == DRM_MODE_CONNECTOR_eDP) {
-		if (!drm_mode_create_dp_colorspace_property(&aconnector->base, supported_colorspaces))
-			drm_connector_attach_colorspace_property(&aconnector->base);
+		if (!aconnector->mst_root)
+			if (!drm_mode_create_dp_colorspace_property(&aconnector->base, supported_colorspaces))
+				drm_connector_attach_colorspace_property(&aconnector->base);
+		else /* use root connector's property */
+			if (aconnector->mst_root->base.colorspace_property)
+				drm_connector_attach_colorspace_property(&aconnector->mst_root->base);
+
 	}
 
 	if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
Signature · 1 line
2.41.0
#1 lore raw
Quoted 18 lines · Harry Wentland

After driver init we shouldn't create new properties. Doing so will lead to a warning storm from __drm_mode_object_add.

We don't really need to create the property for MST connectors. Re-using the mst_root connector's property is fine.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 5722b14a6bec..ba493d325dcb 100644
@@ -7359,8 +7359,13 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 			drm_connector_attach_colorspace_property(&aconnector->base);
 	} else if (connector_type == DRM_MODE_CONNECTOR_DisplayPort ||

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, · line 7368

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -2
 		   connector_type == DRM_MODE_CONNECTOR_eDP) {
-		if (!drm_mode_create_dp_colorspace_property(&aconnector->base, supported_colorspaces))
-			drm_connector_attach_colorspace_property(&aconnector->base);
+		if (!aconnector->mst_root)
+			if (!drm_mode_create_dp_colorspace_property(&aconnector->base, supported_colorspaces))
+				drm_connector_attach_colorspace_property(&aconnector->base);
+		else /* use root connector's property */
+			if (aconnector->mst_root->base.colorspace_property)
+				drm_connector_attach_colorspace_property(&aconnector->mst_root->base);
+

../drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function ‘amdgpu_dm_connector_init_helper’:
../drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:7361:20: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
7361 | if (!aconnector->mst_root)
| ^

I think coding style asks for curly braces around both cases as well.

Signature · 2 lines
Earthling Michel Dänzer            |                  https://redhat.com
Libre software enthusiast          |         Mesa and Xwayland developer