Skip to content

Commit abdd276

Browse files
Fangzhi Zuoalexdeucher
authored andcommitted
drm/amd/display: Prune Invalid Modes For HDMI Output
[Why] 1. HDMI does not have 6 bpc support. Having 6 bpc pass validation does not comply with spec. 2. Validate 420 only for native HDMI, but not apply to pcon use case. 3. Current mode validation log is not readable. [how] 1. Cap 8 bpc for dp-hdmi converter. 2. Validate yuv420 for pcon use case as well, if rgb/yuv444 8bpc cannot fit into pcon bw limitation of the link from the converter to HDMI sink. 3. Add readable pixel_format and color_depth into debug log. Reviewed-by: Wayne Lin <wayne.lin@amd.com> Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com> Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 3807756 commit abdd276

4 files changed

Lines changed: 59 additions & 8 deletions

File tree

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7323,10 +7323,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
73237323
const struct drm_connector_state *drm_state = dm_state ? &dm_state->base : NULL;
73247324
int requested_bpc = drm_state ? drm_state->max_requested_bpc : 8;
73257325
enum dc_status dc_result = DC_OK;
7326+
uint8_t bpc_limit = 6;
73267327

73277328
if (!dm_state)
73287329
return NULL;
73297330

7331+
if (aconnector->dc_link->connector_signal == SIGNAL_TYPE_HDMI_TYPE_A ||
7332+
aconnector->dc_link->dpcd_caps.dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER)
7333+
bpc_limit = 8;
7334+
73307335
do {
73317336
stream = create_stream_for_sink(connector, drm_mode,
73327337
dm_state, old_stream,
@@ -7347,22 +7352,26 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
73477352
dc_result = dm_validate_stream_and_context(adev->dm.dc, stream);
73487353

73497354
if (dc_result != DC_OK) {
7350-
DRM_DEBUG_KMS("Mode %dx%d (clk %d) failed DC validation with error %d (%s)\n",
7355+
DRM_DEBUG_KMS("Mode %dx%d (clk %d) pixel_encoding:%s color_depth:%s failed validation -- %s\n",
73517356
drm_mode->hdisplay,
73527357
drm_mode->vdisplay,
73537358
drm_mode->clock,
7354-
dc_result,
7359+
dc_pixel_encoding_to_str(stream->timing.pixel_encoding),
7360+
dc_color_depth_to_str(stream->timing.display_color_depth),
73557361
dc_status_to_str(dc_result));
73567362

73577363
dc_stream_release(stream);
73587364
stream = NULL;
73597365
requested_bpc -= 2; /* lower bpc to retry validation */
73607366
}
73617367

7362-
} while (stream == NULL && requested_bpc >= 6);
7368+
} while (stream == NULL && requested_bpc >= bpc_limit);
73637369

7364-
if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
7365-
DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
7370+
if ((dc_result == DC_FAIL_ENC_VALIDATE ||
7371+
dc_result == DC_EXCEED_DONGLE_CAP) &&
7372+
!aconnector->force_yuv420_output) {
7373+
DRM_DEBUG_KMS("%s:%d Retry forcing yuv420 encoding\n",
7374+
__func__, __LINE__);
73667375

73677376
aconnector->force_yuv420_output = true;
73687377
stream = create_validate_stream_for_sink(aconnector, drm_mode,

drivers/gpu/drm/amd/display/dc/core/dc_debug.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,43 @@ char *dc_status_to_str(enum dc_status status)
392392

393393
return "Unexpected status error";
394394
}
395+
396+
char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding)
397+
{
398+
switch (pixel_encoding) {
399+
case PIXEL_ENCODING_RGB:
400+
return "RGB";
401+
case PIXEL_ENCODING_YCBCR422:
402+
return "YUV422";
403+
case PIXEL_ENCODING_YCBCR444:
404+
return "YUV444";
405+
case PIXEL_ENCODING_YCBCR420:
406+
return "YUV420";
407+
default:
408+
return "Unknown";
409+
}
410+
}
411+
412+
char *dc_color_depth_to_str(enum dc_color_depth color_depth)
413+
{
414+
switch (color_depth) {
415+
case COLOR_DEPTH_666:
416+
return "6-bpc";
417+
case COLOR_DEPTH_888:
418+
return "8-bpc";
419+
case COLOR_DEPTH_101010:
420+
return "10-bpc";
421+
case COLOR_DEPTH_121212:
422+
return "12-bpc";
423+
case COLOR_DEPTH_141414:
424+
return "14-bpc";
425+
case COLOR_DEPTH_161616:
426+
return "16-bpc";
427+
case COLOR_DEPTH_999:
428+
return "9-bpc";
429+
case COLOR_DEPTH_111111:
430+
return "11-bpc";
431+
default:
432+
return "Unknown";
433+
}
434+
}

drivers/gpu/drm/amd/display/dc/core/dc_stream.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,12 +812,12 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream)
812812
stream->dst.height,
813813
stream->output_color_space);
814814
DC_LOG_DC(
815-
"\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n",
815+
"\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixel_encoding:%s, color_depth:%s\n",
816816
stream->timing.pix_clk_100hz / 10,
817817
stream->timing.h_total,
818818
stream->timing.v_total,
819-
stream->timing.pixel_encoding,
820-
stream->timing.display_color_depth);
819+
dc_pixel_encoding_to_str(stream->timing.pixel_encoding),
820+
dc_color_depth_to_str(stream->timing.display_color_depth));
821821
DC_LOG_DC(
822822
"\tlink: %d\n",
823823
stream->link->link_index);

drivers/gpu/drm/amd/display/dc/inc/core_status.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,7 @@ enum dc_status {
6060
};
6161

6262
char *dc_status_to_str(enum dc_status status);
63+
char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding);
64+
char *dc_color_depth_to_str(enum dc_color_depth color_depth);
6365

6466
#endif /* _CORE_STATUS_H_ */

0 commit comments

Comments
 (0)