<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Nicholas Kazlauskas <nicholas.kazlauskas@amd.com><br>
<b>Sent:</b> Wednesday, May 22, 2019 11:11 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Li, Sun peng (Leo); Wentland, Harry; Kazlauskas, Nicholas<br>
<b>Subject:</b> [PATCH 2/2] drm/amd/display: Use new connector state when getting color depth</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[CAUTION: External Email]<br>
<br>
[Why]<br>
The current state on the connector is queried when getting the max bpc<br>
rather than the new state. This means that a new max bpc value can only<br>
currently take effect on the commit *after* it changes.<br>
<br>
The new state should be passed in instead.<br>
<br>
[How]<br>
Pass down the dm_state as drm state to where we do color depth lookup.<br>
<br>
The passed in state can still be NULL when called from<br>
amdgpu_dm_connector_mode_valid, so make sure that we have reasonable<br>
defaults in place. That should probably be addressed at some point.<br>
<br>
This change now (correctly) causes a modeset to occur when changing the<br>
max bpc for a connector.<br>
<br>
Cc: Leo Li <sunpeng.li@amd.com><br>
Cc: Harry Wentland <harry.wentland@amd.com><br>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com><br>
---<br>
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++++++++++--------<br>
 1 file changed, 15 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
index a7a9e4d81a17..580c324891fd 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
@@ -3038,13 +3038,14 @@ static void update_stream_scaling_settings(const struct drm_display_mode *mode,<br>
 }<br>
<br>
 static enum dc_color_depth<br>
-convert_color_depth_from_display_info(const struct drm_connector *connector)<br>
+convert_color_depth_from_display_info(const struct drm_connector *connector,<br>
+                                     const struct drm_connector_state *state)<br>
 {<br>
        uint32_t bpc = 8;<br>
<br>
        /* TODO: Use passed in state instead of the current state. */<br>
-       if (connector->state) {<br>
-               bpc = connector->state->max_bpc;<br>
+       if (state) {<br>
+               bpc = state->max_bpc;<br>
                /* Round down to the nearest even number. */<br>
                bpc = bpc - (bpc & 1);<br>
        }<br>
@@ -3165,11 +3166,12 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_<br>
<br>
 }<br>
<br>
-static void<br>
-fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream,<br>
-                                            const struct drm_display_mode *mode_in,<br>
-                                            const struct drm_connector *connector,<br>
-                                            const struct dc_stream_state *old_stream)<br>
+static void fill_stream_properties_from_drm_display_mode(<br>
+       struct dc_stream_state *stream,<br>
+       const struct drm_display_mode *mode_in,<br>
+       const struct drm_connector *connector,<br>
+       const struct drm_connector_state *connector_state,<br>
+       const struct dc_stream_state *old_stream)<br>
 {<br>
        struct dc_crtc_timing *timing_out = &stream->timing;<br>
        const struct drm_display_info *info = &connector->display_info;<br>
@@ -3192,7 +3194,7 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream,<br>
<br>
        timing_out->timing_3d_format = TIMING_3D_FORMAT_NONE;<br>
        timing_out->display_color_depth = convert_color_depth_from_display_info(<br>
-                       connector);<br>
+               connector, connector_state);<br>
        timing_out->scan_type = SCANNING_TYPE_NODATA;<br>
        timing_out->hdmi_vic = 0;<br>
<br>
@@ -3389,6 +3391,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,<br>
 {<br>
        struct drm_display_mode *preferred_mode = NULL;<br>
        struct drm_connector *drm_connector;<br>
+       const struct drm_connector_state *con_state =<br>
+               dm_state ? &dm_state->base : NULL;<br>
        struct dc_stream_state *stream = NULL;<br>
        struct drm_display_mode mode = *drm_mode;<br>
        bool native_mode_found = false;<br>
@@ -3461,10 +3465,10 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,<br>
        */<br>
        if (!scale || mode_refresh != preferred_refresh)<br>
                fill_stream_properties_from_drm_display_mode(stream,<br>
-                       &mode, &aconnector->base, NULL);<br>
+                       &mode, &aconnector->base, con_state, NULL);<br>
        else<br>
                fill_stream_properties_from_drm_display_mode(stream,<br>
-                       &mode, &aconnector->base, old_stream);<br>
+                       &mode, &aconnector->base, con_state, old_stream);<br>
<br>
        update_stream_scaling_settings(&mode, dm_state, stream);<br>
<br>
--<br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>