drm/amd/display: Use current connector state if NULL when checking bpc

Submitted by Kazlauskas, Nicholas on June 5, 2019, 4:33 p.m.

Details

Message ID 20190605163359.19422-1-nicholas.kazlauskas@amd.com
State Accepted
Commit 01933ba42d3d9fd0917573a752b81267ec231849
Headers show
Series "drm/amd/display: Use current connector state if NULL when checking bpc" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Kazlauskas, Nicholas June 5, 2019, 4:33 p.m.
[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.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index a698c8f272ed..f627c17a1039 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3046,6 +3046,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. */
@@ -3820,6 +3823,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);
 	}

Comments

On 2019-06-05 12:33 p.m., Nicholas Kazlauskas wrote:
> [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.

> 

> Cc: Harry Wentland <harry.wentland@amd.com>

> Cc: Leo Li <sunpeng.li@amd.com>

> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>


Reviewed-by: Harry Wentland <harry.wentland@amd.com>


Harry

> ---

>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++++

>  1 file changed, 4 insertions(+)

> 

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

> index a698c8f272ed..f627c17a1039 100644

> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

> @@ -3046,6 +3046,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. */

> @@ -3820,6 +3823,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);

>  	}

>