Skip to content

Commit 07e3a1c

Browse files
Nicholas Kazlauskasalexdeucher
authored andcommitted
drm/amd/display: Support amdgpu "max bpc" connector property (v2)
[Why] Many panels support more than 8bpc but some modes are unavailable while running at greater than 8bpc due to DP/HDMI bandwidth constraints. Support for more than 8bpc was added recently in the driver but it defaults to the maximum supported bpc - locking out these modes. This should be a user configurable option such that the user can select what bpc configuration they would like. [How] This patch adds support for getting and setting the amdgpu driver specific "max bpc" property on the connector. It also adds support for limiting the output bpc based on the property value. The default limitation is the lowest value in the range, 8bpc. This was the old value before the range was uncapped. This patch should be updated/replaced later once common drm support for max bpc lands. Bugzilla: https://bugs.freedesktop.org/108542 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201585 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200645 Fixes: e03fd3f ("drm/amd/display: Do not limit color depth to 8bpc") v2: rebase on upstream (Alex) Signed-off-by: Nicholas Kazlauskas <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 69756c6 commit 07e3a1c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,8 +2358,15 @@ static void update_stream_scaling_settings(const struct drm_display_mode *mode,
23582358
static enum dc_color_depth
23592359
convert_color_depth_from_display_info(const struct drm_connector *connector)
23602360
{
2361+
struct dm_connector_state *dm_conn_state =
2362+
to_dm_connector_state(connector->state);
23612363
uint32_t bpc = connector->display_info.bpc;
23622364

2365+
/* TODO: Remove this when there's support for max_bpc in drm */
2366+
if (dm_conn_state && bpc > dm_conn_state->max_bpc)
2367+
/* Round down to nearest even number. */
2368+
bpc = dm_conn_state->max_bpc - (dm_conn_state->max_bpc & 1);
2369+
23632370
switch (bpc) {
23642371
case 0:
23652372
/*
@@ -2943,6 +2950,9 @@ int amdgpu_dm_connector_atomic_set_property(struct drm_connector *connector,
29432950
} else if (property == adev->mode_info.underscan_property) {
29442951
dm_new_state->underscan_enable = val;
29452952
ret = 0;
2953+
} else if (property == adev->mode_info.max_bpc_property) {
2954+
dm_new_state->max_bpc = val;
2955+
ret = 0;
29462956
}
29472957

29482958
return ret;
@@ -2985,6 +2995,9 @@ int amdgpu_dm_connector_atomic_get_property(struct drm_connector *connector,
29852995
} else if (property == adev->mode_info.underscan_property) {
29862996
*val = dm_state->underscan_enable;
29872997
ret = 0;
2998+
} else if (property == adev->mode_info.max_bpc_property) {
2999+
*val = dm_state->max_bpc;
3000+
ret = 0;
29883001
}
29893002
return ret;
29903003
}
@@ -3795,6 +3808,9 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
37953808
drm_object_attach_property(&aconnector->base.base,
37963809
adev->mode_info.underscan_vborder_property,
37973810
0);
3811+
drm_object_attach_property(&aconnector->base.base,
3812+
adev->mode_info.max_bpc_property,
3813+
0);
37983814

37993815
}
38003816

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ struct dm_connector_state {
204204
enum amdgpu_rmx_type scaling;
205205
uint8_t underscan_vborder;
206206
uint8_t underscan_hborder;
207+
uint8_t max_bpc;
207208
bool underscan_enable;
208209
bool freesync_enable;
209210
bool freesync_capable;

0 commit comments

Comments
 (0)