Commit d4252eee authored by Stylon Wang's avatar Stylon Wang Committed by Alex Deucher

drm/amd/display: Add debugfs entry to force YUV420 output

[Why]
Even if YUV420 is available for video mode, YUV444 is still
automatically selected. This poses a problem for compliance tests.

[How]
Add a per-connector debugfs entry "force_yuv420_output" to force
selection of YUV420 mode.
Signed-off-by: default avatarStylon Wang <stylon.wang@amd.com>
Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 74701238
...@@ -3312,7 +3312,7 @@ static void fill_stream_properties_from_drm_display_mode( ...@@ -3312,7 +3312,7 @@ static void fill_stream_properties_from_drm_display_mode(
{ {
struct dc_crtc_timing *timing_out = &stream->timing; struct dc_crtc_timing *timing_out = &stream->timing;
const struct drm_display_info *info = &connector->display_info; const struct drm_display_info *info = &connector->display_info;
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
memset(timing_out, 0, sizeof(struct dc_crtc_timing)); memset(timing_out, 0, sizeof(struct dc_crtc_timing));
timing_out->h_border_left = 0; timing_out->h_border_left = 0;
...@@ -3323,6 +3323,9 @@ static void fill_stream_properties_from_drm_display_mode( ...@@ -3323,6 +3323,9 @@ static void fill_stream_properties_from_drm_display_mode(
if (drm_mode_is_420_only(info, mode_in) if (drm_mode_is_420_only(info, mode_in)
&& stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) && stream->signal == SIGNAL_TYPE_HDMI_TYPE_A)
timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420; timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
else if (drm_mode_is_420_also(info, mode_in)
&& aconnector->force_yuv420_output)
timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
else if ((connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB444) else if ((connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB444)
&& stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) && stream->signal == SIGNAL_TYPE_HDMI_TYPE_A)
timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR444; timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR444;
......
...@@ -287,6 +287,7 @@ struct amdgpu_dm_connector { ...@@ -287,6 +287,7 @@ struct amdgpu_dm_connector {
uint32_t debugfs_dpcd_address; uint32_t debugfs_dpcd_address;
uint32_t debugfs_dpcd_size; uint32_t debugfs_dpcd_size;
#endif #endif
bool force_yuv420_output;
}; };
#define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base) #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base)
......
...@@ -942,6 +942,33 @@ static const struct { ...@@ -942,6 +942,33 @@ static const struct {
{"aux_dpcd_data", &dp_dpcd_data_debugfs_fops} {"aux_dpcd_data", &dp_dpcd_data_debugfs_fops}
}; };
/*
* Force YUV420 output if available from the given mode
*/
static int force_yuv420_output_set(void *data, u64 val)
{
struct amdgpu_dm_connector *connector = data;
connector->force_yuv420_output = (bool)val;
return 0;
}
/*
* Check if YUV420 is forced when available from the given mode
*/
static int force_yuv420_output_get(void *data, u64 *val)
{
struct amdgpu_dm_connector *connector = data;
*val = connector->force_yuv420_output;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(force_yuv420_output_fops, force_yuv420_output_get,
force_yuv420_output_set, "%llu\n");
void connector_debugfs_init(struct amdgpu_dm_connector *connector) void connector_debugfs_init(struct amdgpu_dm_connector *connector)
{ {
int i; int i;
...@@ -955,6 +982,10 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector) ...@@ -955,6 +982,10 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector)
dp_debugfs_entries[i].fops); dp_debugfs_entries[i].fops);
} }
} }
debugfs_create_file_unsafe("force_yuv420_output", 0644, dir, connector,
&force_yuv420_output_fops);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment