drm/amd/display: Use current connector state if NULL when checking bpc
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Wed, 5 Jun 2019 16:33:59 +0000 (12:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 11 Jun 2019 17:44:34 +0000 (12:44 -0500)
[Why]
The old logic for checking which output depth to use relied on using
the current connector state rather than the new proposed state. This
was a problem when performing atomic commits since we weren't verifying
it against the incoming max_requested_bpc.

But switching this to only use the new state and not the current state
breaks filtering modes - it'll always assume that the maximum bpc
supported by the display is in use, which will cause certain modes
like 1440p@144Hz to be filtered even when using 8bpc.

[How]
Still use the connector->state if we aren't passed an explicit state.
This will respect the max_bpc the user currently has when filtering
modes.

Also remember to reset the default max_requested_bpc to 8 whenever
connector reset is called to retain old behavior when using the new
property.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110845
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index d3c39ff6d7e272fb390779fc797ee5a7b9ebefaa..5c83c441877ae7822ed9e73e458d7ae0a110bc32 100644 (file)
@@ -2971,6 +2971,9 @@ convert_color_depth_from_display_info(const struct drm_connector *connector,
 {
        uint32_t bpc = connector->display_info.bpc;
 
+       if (!state)
+               state = connector->state;
+
        if (state) {
                bpc = state->max_bpc;
                /* Round down to the nearest even number. */
@@ -3733,6 +3736,7 @@ void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector)
                state->underscan_enable = false;
                state->underscan_hborder = 0;
                state->underscan_vborder = 0;
+               state->base.max_requested_bpc = 8;
 
                __drm_atomic_helper_connector_reset(connector, &state->base);
        }