All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Paalanen <ppaalanen@gmail.com>
To: Harry Wentland <harry.wentland@amd.com>
Cc: "Jani Nikula" <jani.nikula@linux.intel.com>,
	"Sebastian Wick" <sebastian.wick@redhat.com>,
	dri-devel@lists.freedesktop.org,
	"Uma Shankar" <uma.shankar@intel.com>,
	amd-gfx@lists.freedesktop.org, "Joshua Ashton" <joshua@froggi.es>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	Vitaly.Prosyak@amd.com
Subject: Re: [PATCH v3 06/17] drm/connector: Print connector colorspace in state debugfs
Date: Wed, 8 Mar 2023 11:19:50 +0200	[thread overview]
Message-ID: <20230308111950.58f222a9@eldfell> (raw)
In-Reply-To: <20230307151107.49649-7-harry.wentland@amd.com>

[-- Attachment #1: Type: text/plain, Size: 3296 bytes --]

On Tue, 7 Mar 2023 10:10:56 -0500
Harry Wentland <harry.wentland@amd.com> wrote:

> v3: Fix kerneldocs (kernel test robot)
> 
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> 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: dri-devel@lists.freedesktop.org
> Cc: amd-gfx@lists.freedesktop.org
> Reviewed-By: Joshua Ashton <joshua@froggi.es>
> ---
>  drivers/gpu/drm/drm_atomic.c    |  1 +
>  drivers/gpu/drm/drm_connector.c | 15 +++++++++++++++
>  include/drm/drm_connector.h     |  1 +
>  3 files changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index c0dc5858a723..d6d04c4ccfc0 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1071,6 +1071,7 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
>  	drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
>  	drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware);
>  	drm_printf(p, "\tmax_requested_bpc=%d\n", state->max_requested_bpc);
> +	drm_printf(p, "\tcolorspace=%s\n", drm_get_colorspace_name(state->colorspace));
>  
>  	if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
>  		if (state->writeback_job && state->writeback_job->fb)
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 7649f0ac454f..7ed48f9cbb20 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1044,6 +1044,21 @@ static const char * const colorspace_names[] = {
>  	[DRM_MODE_COLORIMETRY_BT601_YCC] = "BT601_YCC",
>  };
>  
> +/**
> + * drm_get_colorspace_name - return a string for color encoding
> + * @colorspace: color space to compute name of
> + *
> + * In contrast to the other drm_get_*_name functions this one here returns a
> + * const pointer and hence is threadsafe.
> + */
> +const char *drm_get_colorspace_name(enum drm_colorspace colorspace)
> +{
> +	if (WARN_ON(colorspace >= ARRAY_SIZE(colorspace_names)))
> +		return "unknown";
> +
> +	return colorspace_names[colorspace];

Should this protect against returning NULL? Well, I suppose that cannot
happen right now, and probably holes will not be added in the enum. But
should kernel code still be more paranoid?


Thanks,
pq

> +}
> +
>  static const u32 hdmi_colorspaces =
>  	BIT(DRM_MODE_COLORIMETRY_SMPTE_170M_YCC) |
>  	BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 46c064d9ffef..c77e42408522 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1970,6 +1970,7 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
>  
>  bool drm_connector_has_possible_encoder(struct drm_connector *connector,
>  					struct drm_encoder *encoder);
> +const char *drm_get_colorspace_name(enum drm_colorspace colorspace);
>  
>  /**
>   * drm_for_each_connector_iter - connector_list iterator macro


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Pekka Paalanen <ppaalanen@gmail.com>
To: Harry Wentland <harry.wentland@amd.com>
Cc: Sebastian Wick <sebastian.wick@redhat.com>,
	dri-devel@lists.freedesktop.org,
	Uma Shankar <uma.shankar@intel.com>,
	amd-gfx@lists.freedesktop.org, Joshua Ashton <joshua@froggi.es>,
	Vitaly.Prosyak@amd.com
Subject: Re: [PATCH v3 06/17] drm/connector: Print connector colorspace in state debugfs
Date: Wed, 8 Mar 2023 11:19:50 +0200	[thread overview]
Message-ID: <20230308111950.58f222a9@eldfell> (raw)
In-Reply-To: <20230307151107.49649-7-harry.wentland@amd.com>

[-- Attachment #1: Type: text/plain, Size: 3296 bytes --]

On Tue, 7 Mar 2023 10:10:56 -0500
Harry Wentland <harry.wentland@amd.com> wrote:

> v3: Fix kerneldocs (kernel test robot)
> 
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> 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: dri-devel@lists.freedesktop.org
> Cc: amd-gfx@lists.freedesktop.org
> Reviewed-By: Joshua Ashton <joshua@froggi.es>
> ---
>  drivers/gpu/drm/drm_atomic.c    |  1 +
>  drivers/gpu/drm/drm_connector.c | 15 +++++++++++++++
>  include/drm/drm_connector.h     |  1 +
>  3 files changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index c0dc5858a723..d6d04c4ccfc0 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1071,6 +1071,7 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
>  	drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)");
>  	drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware);
>  	drm_printf(p, "\tmax_requested_bpc=%d\n", state->max_requested_bpc);
> +	drm_printf(p, "\tcolorspace=%s\n", drm_get_colorspace_name(state->colorspace));
>  
>  	if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
>  		if (state->writeback_job && state->writeback_job->fb)
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 7649f0ac454f..7ed48f9cbb20 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1044,6 +1044,21 @@ static const char * const colorspace_names[] = {
>  	[DRM_MODE_COLORIMETRY_BT601_YCC] = "BT601_YCC",
>  };
>  
> +/**
> + * drm_get_colorspace_name - return a string for color encoding
> + * @colorspace: color space to compute name of
> + *
> + * In contrast to the other drm_get_*_name functions this one here returns a
> + * const pointer and hence is threadsafe.
> + */
> +const char *drm_get_colorspace_name(enum drm_colorspace colorspace)
> +{
> +	if (WARN_ON(colorspace >= ARRAY_SIZE(colorspace_names)))
> +		return "unknown";
> +
> +	return colorspace_names[colorspace];

Should this protect against returning NULL? Well, I suppose that cannot
happen right now, and probably holes will not be added in the enum. But
should kernel code still be more paranoid?


Thanks,
pq

> +}
> +
>  static const u32 hdmi_colorspaces =
>  	BIT(DRM_MODE_COLORIMETRY_SMPTE_170M_YCC) |
>  	BIT(DRM_MODE_COLORIMETRY_BT709_YCC) |
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 46c064d9ffef..c77e42408522 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1970,6 +1970,7 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
>  
>  bool drm_connector_has_possible_encoder(struct drm_connector *connector,
>  					struct drm_encoder *encoder);
> +const char *drm_get_colorspace_name(enum drm_colorspace colorspace);
>  
>  /**
>   * drm_for_each_connector_iter - connector_list iterator macro


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-03-08  9:19 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 15:10 [PATCH v3 00/17] Enable Colorspace connector property in amdgpu Harry Wentland
2023-03-07 15:10 ` Harry Wentland
2023-03-07 15:10 ` [PATCH v3 01/17] drm/connector: Convert DRM_MODE_COLORIMETRY to enum Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-07 15:13   ` Simon Ser
2023-03-07 15:13     ` Simon Ser
2023-03-07 15:29     ` [PATCH v4 " Harry Wentland
2023-03-07 15:29       ` Harry Wentland
2023-03-08  8:21       ` Pekka Paalanen
2023-03-08  8:21         ` Pekka Paalanen
2023-03-07 15:10 ` [PATCH v3 02/17] drm/connector: Add enum documentation to drm_colorspace Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-08  8:59   ` Pekka Paalanen
2023-03-08  8:59     ` Pekka Paalanen
2023-03-09  0:56     ` Sebastian Wick
2023-03-09  0:56       ` Sebastian Wick
2023-03-09 10:03       ` Pekka Paalanen
2023-03-09 10:03         ` Pekka Paalanen
2023-03-09 20:23         ` Sebastian Wick
2023-03-09 20:23           ` Sebastian Wick
2023-05-24 17:00     ` Harry Wentland
2023-05-24 17:00       ` Harry Wentland
2023-03-07 15:10 ` [PATCH v3 03/17] drm/connector: Deprecate split for BT.2020 in drm_colorspace enum Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-08  9:09   ` Pekka Paalanen
2023-03-08  9:09     ` Pekka Paalanen
2023-03-09  1:05     ` Sebastian Wick
2023-03-09  1:05       ` Sebastian Wick
2023-03-09  1:10       ` Ville Syrjälä
2023-03-09  1:10         ` Ville Syrjälä
2023-05-24 17:01     ` Harry Wentland
2023-05-24 17:01       ` Harry Wentland
2023-03-07 15:10 ` [PATCH v3 04/17] drm/connector: Pull out common create_colorspace_property code Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-07 15:10 ` [PATCH v3 05/17] drm/connector: Use common colorspace_names array Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-08  9:15   ` Pekka Paalanen
2023-03-08  9:15     ` Pekka Paalanen
2023-03-09  1:39   ` Sebastian Wick
2023-03-09  1:39     ` Sebastian Wick
2023-03-07 15:10 ` [PATCH v3 06/17] drm/connector: Print connector colorspace in state debugfs Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-08  9:19   ` Pekka Paalanen [this message]
2023-03-08  9:19     ` Pekka Paalanen
2023-03-07 15:10 ` [PATCH v3 07/17] drm/connector: Allow drivers to pass list of supported colorspaces Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-07 15:10 ` [PATCH v3 08/17] drm/amd/display: Always pass connector_state to stream validation Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-07 15:10 ` [PATCH v3 09/17] drm/amd/display: Register Colorspace property for DP and HDMI Harry Wentland
2023-03-07 15:10   ` Harry Wentland
2023-03-08  9:24   ` Pekka Paalanen
2023-05-24 18:16     ` Harry Wentland
2023-03-16  0:37   ` Sebastian Wick
2023-03-16  9:50     ` Ville Syrjälä
2023-03-16  9:50       ` Ville Syrjälä
2023-03-16 10:07       ` Pekka Paalanen
2023-03-16 10:07         ` Pekka Paalanen
2023-03-16 10:47         ` Ville Syrjälä
2023-03-16 10:47           ` Ville Syrjälä
2023-03-16 11:34           ` Pekka Paalanen
2023-03-16 11:34             ` Pekka Paalanen
2023-03-16 12:35             ` Ville Syrjälä
2023-03-16 12:35               ` Ville Syrjälä
2023-03-16 21:13               ` Sebastian Wick
2023-03-16 21:13                 ` Sebastian Wick
2023-03-16 23:01                 ` Ville Syrjälä
2023-03-16 23:01                   ` Ville Syrjälä
2023-03-17  8:53                   ` Pekka Paalanen
2023-03-17  8:53                     ` Pekka Paalanen
2023-03-17 12:50                     ` Ville Syrjälä
2023-03-17 12:50                       ` Ville Syrjälä
2023-03-17 13:35                       ` Pekka Paalanen
2023-03-17 13:35                         ` Pekka Paalanen
2023-03-17 13:53                         ` Joshua Ashton
2023-03-17 13:53                           ` Joshua Ashton
2023-05-24 19:51                           ` Harry Wentland
2023-03-17 14:14                         ` Ville Syrjälä
2023-03-17 14:14                           ` Ville Syrjälä
2023-03-17 15:37                           ` Pekka Paalanen
2023-03-17 15:37                             ` Pekka Paalanen
2023-03-17 16:33                             ` Ville Syrjälä
2023-03-17 16:33                               ` Ville Syrjälä
2023-03-17 17:40                               ` Sebastian Wick
2023-03-17 17:40                                 ` Sebastian Wick
2023-03-17 18:38                                 ` Ville Syrjälä
2023-03-17 18:38                                   ` Ville Syrjälä
2023-03-17 18:47                                   ` Sebastian Wick
2023-03-17 18:47                                     ` Sebastian Wick
2023-03-17 19:13                                     ` Ville Syrjälä
2023-03-17 19:13                                       ` Ville Syrjälä
2023-03-07 15:11 ` [PATCH v3 10/17] drm/amd/display: Signal mode_changed if colorspace changed Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-07 15:11 ` [PATCH v3 11/17] drm/amd/display: Send correct DP colorspace infopacket Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-09  1:58   ` Sebastian Wick
2023-03-07 15:11 ` [PATCH v3 12/17] drm/amd/display: Always set crtcinfo from create_stream_for_sink Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-07 15:11 ` [PATCH v3 13/17] drm/amd/display: Add support for explicit BT601_YCC Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-07 15:11 ` [PATCH v3 14/17] drm/amd/display: Add debugfs for testing output colorspace Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-08  9:30   ` Pekka Paalanen
2023-03-09  2:05   ` Sebastian Wick
2023-03-07 15:11 ` [PATCH v3 15/17] drm/amd/display: Add default case for output_color_space switch Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-08  9:35   ` Pekka Paalanen
2023-03-07 15:11 ` [PATCH v3 16/17] drm/amd/display: Fallback to 2020_YCBCR if the pixel encoding is not RGB Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-07 15:11 ` [PATCH v3 17/17] drm/amd/display: Refactor avi_info_frame colorimetry determination Harry Wentland
2023-03-07 15:11   ` Harry Wentland
2023-03-08  9:38 ` [PATCH v3 00/17] Enable Colorspace connector property in amdgpu Pekka Paalanen
2023-03-08  9:38   ` Pekka Paalanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230308111950.58f222a9@eldfell \
    --to=ppaalanen@gmail.com \
    --cc=Vitaly.Prosyak@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=joshua@froggi.es \
    --cc=sebastian.wick@redhat.com \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.