Skip to content

Commit 035d53e

Browse files
Harry Wentlandalexdeucher
authored andcommitted
drm/connector: Print connector colorspace in state debugfs
v3: Fix kerneldocs (kernel test robot) v4: Avoid returning NULL from drm_get_colorspace_name Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com> Reviewed-by: Joshua Ashton <joshua@froggi.es> Reviewed-by: Simon Ser <contact@emersion.fr> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar <uma.shankar@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Joshua Ashton <joshua@froggi.es> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Simon Ser <contact@emersion.fr> Cc: Melissa Wen <mwen@igalia.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent c627087 commit 035d53e

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/gpu/drm/drm_atomic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
11311131
drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
11321132
drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware);
11331133
drm_printf(p, "\tmax_requested_bpc=%d\n", state->max_requested_bpc);
1134+
drm_printf(p, "\tcolorspace=%s\n", drm_get_colorspace_name(state->colorspace));
11341135

11351136
if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
11361137
if (state->writeback_job && state->writeback_job->fb)

drivers/gpu/drm/drm_connector.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,21 @@ static const char * const colorspace_names[] = {
10871087
[DRM_MODE_COLORIMETRY_BT601_YCC] = "BT601_YCC",
10881088
};
10891089

1090+
/**
1091+
* drm_get_colorspace_name - return a string for color encoding
1092+
* @colorspace: color space to compute name of
1093+
*
1094+
* In contrast to the other drm_get_*_name functions this one here returns a
1095+
* const pointer and hence is threadsafe.
1096+
*/
1097+
const char *drm_get_colorspace_name(enum drm_colorspace colorspace)
1098+
{
1099+
if (colorspace < ARRAY_SIZE(colorspace_names) && colorspace_names[colorspace])
1100+
return colorspace_names[colorspace];
1101+
else
1102+
return "(null)";
1103+
}
1104+
10901105
static const u32 hdmi_colorspaces =
10911106
BIT(DRM_MODE_COLORIMETRY_SMPTE_170M_YCC) |
10921107
BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |

include/drm/drm_connector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,7 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
20782078

20792079
bool drm_connector_has_possible_encoder(struct drm_connector *connector,
20802080
struct drm_encoder *encoder);
2081+
const char *drm_get_colorspace_name(enum drm_colorspace colorspace);
20812082

20822083
/**
20832084
* drm_for_each_connector_iter - connector_list iterator macro

0 commit comments

Comments
 (0)