All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 2/2] i915: content-type property for HDMI connector
  2018-04-18 16:51 ` [PATCH v2 2/2] i915: " StanLis
@ 2018-04-18 11:35   ` Hans Verkuil
  2018-04-18 12:01     ` Lisovskiy, Stanislav
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Verkuil @ 2018-04-18 11:35 UTC (permalink / raw)
  To: StanLis, dri-devel; +Cc: intel-gfx

On 04/18/18 18:51, StanLis wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> Added encoding of drm content_type property from
> drm_connector_state within AVI infoframe in order to properly handle
> external HDMI TV content-type setting.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
>  drivers/gpu/drm/i915/intel_hdmi.c   | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 40285d1b91b7..61ddb5871d8a 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -124,6 +124,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
>  	if (new_conn_state->force_audio != old_conn_state->force_audio ||
>  	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
>  	    new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
> +	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
>  	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
>  		crtc_state->mode_changed = true;
>  
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index ee929f31f7db..5cc72da9c086 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -491,6 +491,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
>  					   intel_hdmi->rgb_quant_range_selectable,
>  					   is_hdmi2_sink);
>  
> +	frame.avi.content_type = connector->state->content_type;
> +

Is the ITC bit set in the AVI InfoFrame? The content type bits are only valid if
the ITC bit is 1. And if there is no content type property, then ITC should be 0.

>  	/* TODO: handle pixel repetition for YCBCR420 outputs */
>  	intel_write_infoframe(encoder, crtc_state, &frame);
>  }
> @@ -2065,6 +2067,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
>  	intel_attach_force_audio_property(connector);
>  	intel_attach_broadcast_rgb_property(connector);
>  	intel_attach_aspect_ratio_property(connector);
> +	drm_connector_attach_content_type_property(connector);
>  	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>  }
>  
> 

Regards,

	Hans
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] drm: content-type property for HDMI connector
  2018-04-18 16:51 ` [PATCH v2 1/2] drm: content-type property for HDMI connector StanLis
@ 2018-04-18 11:36   ` Hans Verkuil
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2018-04-18 11:36 UTC (permalink / raw)
  To: StanLis, dri-devel; +Cc: intel-gfx

On 04/18/18 18:51, StanLis wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> Added content_type property to
> drm_connector_state in order to properly handle
> external HDMI TV content-type setting.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  Documentation/gpu/kms-properties.csv |  1 +
>  drivers/gpu/drm/drm_atomic.c         |  4 +++
>  drivers/gpu/drm/drm_connector.c      | 50 ++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_edid.c           |  1 +
>  include/drm/drm_connector.h          | 11 ++++++
>  include/drm/drm_mode_config.h        |  5 +++
>  include/uapi/drm/drm_mode.h          |  5 +++
>  7 files changed, 77 insertions(+)
> 
> diff --git a/Documentation/gpu/kms-properties.csv b/Documentation/gpu/kms-properties.csv
> index 6b28b014cb7d..7a02b2782f33 100644
> --- a/Documentation/gpu/kms-properties.csv
> +++ b/Documentation/gpu/kms-properties.csv
> @@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
>  ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
>  ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
>  ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
> +,Optional,"""content type""",ENUM,"{ ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TDB
>  i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
>  ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
>  ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7d25c42f22db..72fd2a1c801f 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1266,6 +1266,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
>  			state->link_status = val;
>  	} else if (property == config->aspect_ratio_property) {
>  		state->picture_aspect_ratio = val;
> +	} else if (property == config->content_type_property) {
> +		state->content_type = val;
>  	} else if (property == connector->scaling_mode_property) {
>  		state->scaling_mode = val;
>  	} else if (property == connector->content_protection_property) {
> @@ -1351,6 +1353,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
>  		*val = state->link_status;
>  	} else if (property == config->aspect_ratio_property) {
>  		*val = state->picture_aspect_ratio;
> +	} else if (property == config->content_type_property) {
> +		*val = state->content_type;
>  	} else if (property == connector->scaling_mode_property) {
>  		*val = state->scaling_mode;
>  	} else if (property == connector->content_protection_property) {
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index b3cde897cd80..5633494f6d78 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -720,6 +720,13 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
>  	{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
>  };
>  
> +static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
> +	{ DRM_MODE_CONTENT_TYPE_GRAPHICS, "GRAPHICS" },
> +	{ DRM_MODE_CONTENT_TYPE_PHOTO, "PHOTO" },
> +	{ DRM_MODE_CONTENT_TYPE_CINEMA, "CINEMA" },
> +	{ DRM_MODE_CONTENT_TYPE_GAME, "GAME" },

Just use "Graphics", "Photo", etc. Same as is used in drivers/video/hdmi.c
for logging the AVI InfoFrame.

Regards,

	Hans

> +};
> +
>  static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
>  	{ DRM_MODE_PANEL_ORIENTATION_NORMAL,	"Normal"	},
>  	{ DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,	"Upside Down"	},
> @@ -996,6 +1003,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
>  
> +/**
> + * drm_connector_attach_content_type_property - attach content-type property
> + * @dev: DRM device
> + *
> + * Called by a driver the first time a HDMI connector is made.
> + */
> +int drm_connector_attach_content_type_property(struct drm_connector *connector)
> +{
> +	if (!drm_mode_create_content_type_property(connector->dev))
> +		drm_object_attach_property(&connector->base,
> +			connector->dev->mode_config.content_type_property,
> +			DRM_MODE_CONTENT_TYPE_GRAPHICS);
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_connector_attach_content_type_property);
> +
>  /**
>   * drm_create_tv_properties - create TV specific connector properties
>   * @dev: DRM device
> @@ -1260,6 +1283,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
>  
> +/**
> + * drm_mode_create_content_type_property - create content type property
> + * @dev: DRM device
> + *
> + * Called by a driver the first time it's needed, must be attached to desired
> + * connectors.
> + *
> + * Returns:
> + * Zero on success, negative errno on failure.
> + */
> +int drm_mode_create_content_type_property(struct drm_device *dev)
> +{
> +	if (dev->mode_config.content_type_property)
> +		return 0;
> +
> +	dev->mode_config.content_type_property =
> +		drm_property_create_enum(dev, 0, "content type",
> +				drm_content_type_enum_list,
> +				ARRAY_SIZE(drm_content_type_enum_list));
> +
> +	if (dev->mode_config.content_type_property == NULL)
> +		return -ENOMEM;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_create_content_type_property);
> +
>  /**
>   * drm_mode_create_suggested_offset_properties - create suggests offset properties
>   * @dev: DRM device
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 134069f36482..946a182e0201 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4867,6 +4867,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
>  	}
>  
>  	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
> +	frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
>  
>  	/*
>  	 * Populate picture aspect ratio from either
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 675cc3f8cf85..5399512ed3c1 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -418,6 +418,15 @@ struct drm_connector_state {
>  	 */
>  	enum hdmi_picture_aspect picture_aspect_ratio;
>  
> +	/**
> +	 * @content_type: Connector property to control the
> +	 * HDMI infoframe content type setting.
> +	 *
> +	 * The %DRM_MODE_CONTENT_TYPE_\* values much match the
> +	 * values for &enum hdmi_content_type
> +	 */
> +	enum hdmi_content_type   content_type;
> +
>  	/**
>  	 * @scaling_mode: Connector property to control the
>  	 * upscaling, mostly used for built-in panels.
> @@ -1089,11 +1098,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
>  				  unsigned int num_modes,
>  				  const char * const modes[]);
>  int drm_mode_create_scaling_mode_property(struct drm_device *dev);
> +int drm_connector_attach_content_type_property(struct drm_connector *dev);
>  int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
>  					       u32 scaling_mode_mask);
>  int drm_connector_attach_content_protection_property(
>  		struct drm_connector *connector);
>  int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
> +int drm_mode_create_content_type_property(struct drm_device *dev);
>  int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
>  
>  int drm_mode_connector_set_path_property(struct drm_connector *connector,
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 33b3a96d66d0..fb45839179dd 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -726,6 +726,11 @@ struct drm_mode_config {
>  	 * HDMI infoframe aspect ratio setting.
>  	 */
>  	struct drm_property *aspect_ratio_property;
> +	/**
> +	 * @content_type_property: Optional connector property to control the
> +	 * HDMI infoframe content type setting.
> +	 */
> +	struct drm_property *content_type_property;
>  	/**
>  	 * @degamma_lut_property: Optional CRTC property to set the LUT used to
>  	 * convert the framebuffer's colors to linear gamma.
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 50bcf4214ff9..d9f1b290d2a6 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -94,6 +94,11 @@ extern "C" {
>  #define DRM_MODE_PICTURE_ASPECT_4_3		1
>  #define DRM_MODE_PICTURE_ASPECT_16_9		2
>  
> +#define DRM_MODE_CONTENT_TYPE_GRAPHICS		0
> +#define DRM_MODE_CONTENT_TYPE_PHOTO		1
> +#define DRM_MODE_CONTENT_TYPE_CINEMA		2
> +#define DRM_MODE_CONTENT_TYPE_GAME		3
> +
>  /* Aspect ratio flag bitmask (4 bits 22:19) */
>  #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
>  #define  DRM_MODE_FLAG_PIC_AR_NONE \
> 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] i915: content-type property for HDMI connector
  2018-04-18 11:35   ` Hans Verkuil
@ 2018-04-18 12:01     ` Lisovskiy, Stanislav
  2018-04-18 12:35       ` Hans Verkuil
  0 siblings, 1 reply; 12+ messages in thread
From: Lisovskiy, Stanislav @ 2018-04-18 12:01 UTC (permalink / raw)
  To: Hans Verkuil, dri-devel; +Cc: intel-gfx

Hi, 

Please see my reply inline:
________________________________________
From: dri-devel [dri-devel-bounces@lists.freedesktop.org] on behalf of Hans Verkuil [hverkuil@xs4all.nl]
Sent: Wednesday, April 18, 2018 2:35 PM
To: Lisovskiy, Stanislav; dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] i915: content-type property for HDMI connector

On 04/18/18 18:51, StanLis wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
>
> Added encoding of drm content_type property from
> drm_connector_state within AVI infoframe in order to properly handle
> external HDMI TV content-type setting.
>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
>  drivers/gpu/drm/i915/intel_hdmi.c   | 3 +++
>  2 files changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 40285d1b91b7..61ddb5871d8a 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -124,6 +124,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
>       if (new_conn_state->force_audio != old_conn_state->force_audio ||
>           new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
>           new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
> +         new_conn_state->base.content_type != old_conn_state->base.content_type ||
>           new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
>               crtc_state->mode_changed = true;
>
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index ee929f31f7db..5cc72da9c086 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -491,6 +491,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
>                                          intel_hdmi->rgb_quant_range_selectable,
>                                          is_hdmi2_sink);
>
> +     frame.avi.content_type = connector->state->content_type;
> +

>Is the ITC bit set in the AVI InfoFrame? The content type bits are only valid if
>the ITC bit is 1. And if there is no content type property, then ITC should be 0.

That's a good question, as I understood it is not set, however the HDMI 1.4 spec
says:

ITC CN1, CN0     Content Type
 0        0,  0          No Data

 1        0,  0          IT content

 X       0,  1          Photo
 X       1,  0          Cinema
 X       1,  1          Game

"X denotes don't care"

So I wonder, should I probably add additional property to control the itc bit?

>       /* TODO: handle pixel repetition for YCBCR420 outputs */
>       intel_write_infoframe(encoder, crtc_state, &frame);
>  }
> @@ -2065,6 +2067,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
>       intel_attach_force_audio_property(connector);
>       intel_attach_broadcast_rgb_property(connector);
>       intel_attach_aspect_ratio_property(connector);
> +     drm_connector_attach_content_type_property(connector);
>       connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>  }
>
>

Regards,

        Hans
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] i915: content-type property for HDMI connector
  2018-04-18 12:01     ` Lisovskiy, Stanislav
@ 2018-04-18 12:35       ` Hans Verkuil
  2018-04-18 12:48         ` Lisovskiy, Stanislav
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Verkuil @ 2018-04-18 12:35 UTC (permalink / raw)
  To: Lisovskiy, Stanislav, dri-devel; +Cc: intel-gfx

On 04/18/18 14:01, Lisovskiy, Stanislav wrote:
> Hi, 
> 
> Please see my reply inline:
> ________________________________________
> From: dri-devel [dri-devel-bounces@lists.freedesktop.org] on behalf of Hans Verkuil [hverkuil@xs4all.nl]
> Sent: Wednesday, April 18, 2018 2:35 PM
> To: Lisovskiy, Stanislav; dri-devel@lists.freedesktop.org
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [PATCH v2 2/2] i915: content-type property for HDMI connector
> 
> On 04/18/18 18:51, StanLis wrote:
>> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
>>
>> Added encoding of drm content_type property from
>> drm_connector_state within AVI infoframe in order to properly handle
>> external HDMI TV content-type setting.
>>
>> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_atomic.c | 1 +
>>  drivers/gpu/drm/i915/intel_hdmi.c   | 3 +++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
>> index 40285d1b91b7..61ddb5871d8a 100644
>> --- a/drivers/gpu/drm/i915/intel_atomic.c
>> +++ b/drivers/gpu/drm/i915/intel_atomic.c
>> @@ -124,6 +124,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
>>       if (new_conn_state->force_audio != old_conn_state->force_audio ||
>>           new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
>>           new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
>> +         new_conn_state->base.content_type != old_conn_state->base.content_type ||
>>           new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
>>               crtc_state->mode_changed = true;
>>
>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
>> index ee929f31f7db..5cc72da9c086 100644
>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
>> @@ -491,6 +491,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
>>                                          intel_hdmi->rgb_quant_range_selectable,
>>                                          is_hdmi2_sink);
>>
>> +     frame.avi.content_type = connector->state->content_type;
>> +
> 
>> Is the ITC bit set in the AVI InfoFrame? The content type bits are only valid if
>> the ITC bit is 1. And if there is no content type property, then ITC should be 0.
> 
> That's a good question, as I understood it is not set, however the HDMI 1.4 spec
> says:
> 
> ITC CN1, CN0     Content Type
>  0        0,  0          No Data
> 
>  1        0,  0          IT content
> 
>  X       0,  1          Photo
>  X       1,  0          Cinema
>  X       1,  1          Game
> 
> "X denotes don't care"
> 
> So I wonder, should I probably add additional property to control the itc bit?

Yeah, that's wrong in the HDMI Spec. The correct standard to use is the CEA (now CTA)
861. There it clearly defines that the CN bits are only valid if ITC=1.

I know, I'm in the CTA-861 working group :-)

I don't think anyone ever noticed this bug in the HDMI spec before (I didn't). The
2.1 HDMI spec kind of corrects it in Appendix G.1 where it copies the CTA-861-G
text.

Anyway, in V4L2 we implement this with an extra value "NO_ITC" which sets ITC to 0
and sets CN0 and CN1 to 0 as well:

https://hverkuil.home.xs4all.nl/spec/uapi/v4l/extended-controls.html#digital-video-control-ids

The NO_ITC case is usually used for YCbCr video encoding. Note that most displays will
just ignore the content type.

Regards,

	Hans

> 
>>       /* TODO: handle pixel repetition for YCBCR420 outputs */
>>       intel_write_infoframe(encoder, crtc_state, &frame);
>>  }
>> @@ -2065,6 +2067,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
>>       intel_attach_force_audio_property(connector);
>>       intel_attach_broadcast_rgb_property(connector);
>>       intel_attach_aspect_ratio_property(connector);
>> +     drm_connector_attach_content_type_property(connector);
>>       connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>>  }
>>
>>
> 
> Regards,
> 
>         Hans
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] i915: content-type property for HDMI connector
  2018-04-18 12:35       ` Hans Verkuil
@ 2018-04-18 12:48         ` Lisovskiy, Stanislav
  0 siblings, 0 replies; 12+ messages in thread
From: Lisovskiy, Stanislav @ 2018-04-18 12:48 UTC (permalink / raw)
  To: Hans Verkuil, dri-devel; +Cc: intel-gfx


________________________________________
From: Hans Verkuil [hverkuil@xs4all.nl]
Sent: Wednesday, April 18, 2018 3:35 PM
To: Lisovskiy, Stanislav; dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] i915: content-type property for HDMI connector

>> Is the ITC bit set in the AVI InfoFrame? The content type bits are only valid if
>> the ITC bit is 1. And if there is no content type property, then ITC should be 0.
>
> That's a good question, as I understood it is not set, however the HDMI 1.4 spec
> says:
>
> ITC CN1, CN0     Content Type
>  0        0,  0          No Data
>
>  1        0,  0          IT content
>
>  X       0,  1          Photo
>  X       1,  0          Cinema
>  X       1,  1          Game
>
> "X denotes don't care"
>
> So I wonder, should I probably add additional property to control the itc bit?

> Yeah, that's wrong in the HDMI Spec. The correct standard to use is the CEA (now CTA)
> 861. There it clearly defines that the CN bits are only valid if ITC=1.

> I know, I'm in the CTA-861 working group :-)

> I don't think anyone ever noticed this bug in the HDMI spec before (I didn't). The
> 2.1 HDMI spec kind of corrects it in Appendix G.1 where it copies the CTA-861-G
text.

> Anyway, in V4L2 we implement this with an extra value "NO_ITC" which sets ITC to 0
> and sets CN0 and CN1 to 0 as well:

> https://hverkuil.home.xs4all.nl/spec/uapi/v4l/extended-controls.html#digital-video-control-ids

> The NO_ITC case is usually used for YCbCr video encoding. Note that most displays will
> just ignore the content type.

Wow, I wouldn't even assume that this spec is wrong. Probably then I need to add some way 
to manipulate an ITC bit also. I will have a look, however so far I didn't see any property responsible
for this. 

>
>>       /* TODO: handle pixel repetition for YCBCR420 outputs */
>>       intel_write_infoframe(encoder, crtc_state, &frame);
>>  }
>> @@ -2065,6 +2067,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
>>       intel_attach_force_audio_property(connector);
>>       intel_attach_broadcast_rgb_property(connector);
>>       intel_attach_aspect_ratio_property(connector);
>> +     drm_connector_attach_content_type_property(connector);
>>       connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
>>  }
>>
>>
>
> Regards,
>
>         Hans
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for Enabling content-type setting for HDMI displays.
  2018-04-18 16:51 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis
@ 2018-04-18 13:35 ` Patchwork
  2018-04-18 13:52 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2018-04-18 13:35 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: intel-gfx

== Series Details ==

Series: Enabling content-type setting for HDMI displays.
URL   : https://patchwork.freedesktop.org/series/41876/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
ffb3db0b7c7e drm: content-type property for HDMI connector
-:78: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#78: FILE: drivers/gpu/drm/drm_connector.c:1016:
+		drm_object_attach_property(&connector->base,
+			connector->dev->mode_config.content_type_property,

-:108: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#108: FILE: drivers/gpu/drm/drm_connector.c:1303:
+		drm_property_create_enum(dev, 0, "content type",
+				drm_content_type_enum_list,

-:111: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!dev->mode_config.content_type_property"
#111: FILE: drivers/gpu/drm/drm_connector.c:1306:
+	if (dev->mode_config.content_type_property == NULL)

total: 0 errors, 0 warnings, 3 checks, 148 lines checked
73070dc1a0d9 i915: content-type property for HDMI connector

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✓ Fi.CI.BAT: success for Enabling content-type setting for HDMI displays.
  2018-04-18 16:51 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis
  2018-04-18 13:35 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2018-04-18 13:52 ` Patchwork
  2018-04-18 16:44 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2018-04-18 13:52 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: intel-gfx

== Series Details ==

Series: Enabling content-type setting for HDMI displays.
URL   : https://patchwork.freedesktop.org/series/41876/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4065 -> Patchwork_8730 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/41876/revisions/1/mbox/

== Known issues ==

  Here are the changes found in Patchwork_8730 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-ivb-3520m:       PASS -> DMESG-WARN (fdo#106084) +1

    
  fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084


== Participating hosts (34 -> 31) ==

  Additional (1): fi-bxt-dsi 
  Missing    (4): fi-ctg-p8600 fi-ilk-m540 fi-cnl-psr fi-skl-6700hq 


== Build changes ==

    * Linux: CI_DRM_4065 -> Patchwork_8730

  CI_DRM_4065: c7cec67f9e1da120bc3b8782bb8013b285789c96 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4441: 83ba5b7d3bde48b383df41792fc9c955a5a23bdb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8730: 73070dc1a0d9ce14dcda607deb37f2eb9e4f6061 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4441: e60d247eb359f044caf0c09904da14e39d7adca1 @ git://anongit.freedesktop.org/piglit


== Linux commits ==

73070dc1a0d9 i915: content-type property for HDMI connector
ffb3db0b7c7e drm: content-type property for HDMI connector

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8730/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✓ Fi.CI.IGT: success for Enabling content-type setting for HDMI displays.
  2018-04-18 16:51 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis
  2018-04-18 13:35 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
  2018-04-18 13:52 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-04-18 16:44 ` Patchwork
  2018-04-18 16:51 ` [PATCH v2 1/2] drm: content-type property for HDMI connector StanLis
  2018-04-18 16:51 ` [PATCH v2 2/2] i915: " StanLis
  4 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2018-04-18 16:44 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: intel-gfx

== Series Details ==

Series: Enabling content-type setting for HDMI displays.
URL   : https://patchwork.freedesktop.org/series/41876/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4065_full -> Patchwork_8730_full =

== Summary - WARNING ==

  Minor unknown changes coming with Patchwork_8730_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_8730_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/41876/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_8730_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-vebox:
      shard-kbl:          PASS -> SKIP +1

    igt@gem_mocs_settings@mocs-rc6-vebox:
      shard-kbl:          SKIP -> PASS +3

    
== Known issues ==

  Here are the changes found in Patchwork_8730_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_color@pipe-a-legacy-gamma:
      shard-kbl:          PASS -> DMESG-WARN (fdo#105602, fdo#103558) +18

    igt@kms_flip@modeset-vs-vblank-race:
      shard-hsw:          PASS -> FAIL (fdo#103060)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    igt@kms_sysfs_edid_timing:
      shard-apl:          PASS -> WARN (fdo#100047)

    
    ==== Possible fixes ====

    igt@gem_eio@in-flight-suspend:
      shard-kbl:          DMESG-WARN (fdo#103313) -> PASS

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023) -> PASS

    igt@kms_cursor_crc@cursor-256x85-offscreen:
      shard-hsw:          DMESG-FAIL -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-pgflip-blt:
      shard-kbl:          DMESG-WARN (fdo#105602, fdo#103558) -> PASS +20

    igt@kms_frontbuffer_tracking@fbc-farfromfence:
      shard-kbl:          DMESG-WARN (fdo#105602, fdo#103313, fdo#103558) -> PASS +4

    
  fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103313 https://bugs.freedesktop.org/show_bug.cgi?id=103313
  fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (9 -> 4) ==

  Missing    (5): shard-glk8 shard-glk6 shard-glk7 shard-glk shard-glkb 


== Build changes ==

    * Linux: CI_DRM_4065 -> Patchwork_8730

  CI_DRM_4065: c7cec67f9e1da120bc3b8782bb8013b285789c96 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4441: 83ba5b7d3bde48b383df41792fc9c955a5a23bdb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8730: 73070dc1a0d9ce14dcda607deb37f2eb9e4f6061 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4441: e60d247eb359f044caf0c09904da14e39d7adca1 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8730/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 0/2] Enabling content-type setting for HDMI displays.
@ 2018-04-18 16:51 StanLis
  2018-04-18 13:35 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: StanLis @ 2018-04-18 16:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Added content type setting property to drm_connector(part 1)
and enabled transmitting it with HDMI AVI infoframes
for i915(part 2).

rev 2:
Moved helper function which attaches content type property
to the drm core, as was suggested.
Removed redundant connector state initialization.

Stanislav Lisovskiy (2):
  drm: content-type property for HDMI connector
  i915: content-type property for HDMI connector

 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         |  4 +++
 drivers/gpu/drm/drm_connector.c      | 50 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  1 +
 drivers/gpu/drm/i915/intel_atomic.c  |  1 +
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 ++
 include/drm/drm_connector.h          | 11 ++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  5 +++
 9 files changed, 81 insertions(+)

-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] drm: content-type property for HDMI connector
  2018-04-18 16:51 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis
                   ` (2 preceding siblings ...)
  2018-04-18 16:44 ` ✓ Fi.CI.IGT: " Patchwork
@ 2018-04-18 16:51 ` StanLis
  2018-04-18 11:36   ` Hans Verkuil
  2018-04-18 16:51 ` [PATCH v2 2/2] i915: " StanLis
  4 siblings, 1 reply; 12+ messages in thread
From: StanLis @ 2018-04-18 16:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Added content_type property to
drm_connector_state in order to properly handle
external HDMI TV content-type setting.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         |  4 +++
 drivers/gpu/drm/drm_connector.c      | 50 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  1 +
 include/drm/drm_connector.h          | 11 ++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  5 +++
 7 files changed, 77 insertions(+)

diff --git a/Documentation/gpu/kms-properties.csv b/Documentation/gpu/kms-properties.csv
index 6b28b014cb7d..7a02b2782f33 100644
--- a/Documentation/gpu/kms-properties.csv
+++ b/Documentation/gpu/kms-properties.csv
@@ -17,6 +17,7 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
+,Optional,"""content type""",ENUM,"{ ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TDB
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 7d25c42f22db..72fd2a1c801f 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1266,6 +1266,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 			state->link_status = val;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
+	} else if (property == config->content_type_property) {
+		state->content_type = val;
 	} else if (property == connector->scaling_mode_property) {
 		state->scaling_mode = val;
 	} else if (property == connector->content_protection_property) {
@@ -1351,6 +1353,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = state->link_status;
 	} else if (property == config->aspect_ratio_property) {
 		*val = state->picture_aspect_ratio;
+	} else if (property == config->content_type_property) {
+		*val = state->content_type;
 	} else if (property == connector->scaling_mode_property) {
 		*val = state->scaling_mode;
 	} else if (property == connector->content_protection_property) {
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index b3cde897cd80..5633494f6d78 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -720,6 +720,13 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
 	{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
 };
 
+static const struct drm_prop_enum_list drm_content_type_enum_list[] = {
+	{ DRM_MODE_CONTENT_TYPE_GRAPHICS, "GRAPHICS" },
+	{ DRM_MODE_CONTENT_TYPE_PHOTO, "PHOTO" },
+	{ DRM_MODE_CONTENT_TYPE_CINEMA, "CINEMA" },
+	{ DRM_MODE_CONTENT_TYPE_GAME, "GAME" },
+};
+
 static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {
 	{ DRM_MODE_PANEL_ORIENTATION_NORMAL,	"Normal"	},
 	{ DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,	"Upside Down"	},
@@ -996,6 +1003,22 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_dvi_i_properties);
 
+/**
+ * drm_connector_attach_content_type_property - attach content-type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time a HDMI connector is made.
+ */
+int drm_connector_attach_content_type_property(struct drm_connector *connector)
+{
+	if (!drm_mode_create_content_type_property(connector->dev))
+		drm_object_attach_property(&connector->base,
+			connector->dev->mode_config.content_type_property,
+			DRM_MODE_CONTENT_TYPE_GRAPHICS);
+	return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_type_property);
+
 /**
  * drm_create_tv_properties - create TV specific connector properties
  * @dev: DRM device
@@ -1260,6 +1283,33 @@ int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
 
+/**
+ * drm_mode_create_content_type_property - create content type property
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to desired
+ * connectors.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_create_content_type_property(struct drm_device *dev)
+{
+	if (dev->mode_config.content_type_property)
+		return 0;
+
+	dev->mode_config.content_type_property =
+		drm_property_create_enum(dev, 0, "content type",
+				drm_content_type_enum_list,
+				ARRAY_SIZE(drm_content_type_enum_list));
+
+	if (dev->mode_config.content_type_property == NULL)
+		return -ENOMEM;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_content_type_property);
+
 /**
  * drm_mode_create_suggested_offset_properties - create suggests offset properties
  * @dev: DRM device
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 134069f36482..946a182e0201 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4867,6 +4867,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 	}
 
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+	frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
 
 	/*
 	 * Populate picture aspect ratio from either
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 675cc3f8cf85..5399512ed3c1 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -418,6 +418,15 @@ struct drm_connector_state {
 	 */
 	enum hdmi_picture_aspect picture_aspect_ratio;
 
+	/**
+	 * @content_type: Connector property to control the
+	 * HDMI infoframe content type setting.
+	 *
+	 * The %DRM_MODE_CONTENT_TYPE_\* values much match the
+	 * values for &enum hdmi_content_type
+	 */
+	enum hdmi_content_type   content_type;
+
 	/**
 	 * @scaling_mode: Connector property to control the
 	 * upscaling, mostly used for built-in panels.
@@ -1089,11 +1098,13 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 				  unsigned int num_modes,
 				  const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_connector_attach_content_type_property(struct drm_connector *dev);
 int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 					       u32 scaling_mode_mask);
 int drm_connector_attach_content_protection_property(
 		struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
+int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
 int drm_mode_connector_set_path_property(struct drm_connector *connector,
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 33b3a96d66d0..fb45839179dd 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -726,6 +726,11 @@ struct drm_mode_config {
 	 * HDMI infoframe aspect ratio setting.
 	 */
 	struct drm_property *aspect_ratio_property;
+	/**
+	 * @content_type_property: Optional connector property to control the
+	 * HDMI infoframe content type setting.
+	 */
+	struct drm_property *content_type_property;
 	/**
 	 * @degamma_lut_property: Optional CRTC property to set the LUT used to
 	 * convert the framebuffer's colors to linear gamma.
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 50bcf4214ff9..d9f1b290d2a6 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -94,6 +94,11 @@ extern "C" {
 #define DRM_MODE_PICTURE_ASPECT_4_3		1
 #define DRM_MODE_PICTURE_ASPECT_16_9		2
 
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS		0
+#define DRM_MODE_CONTENT_TYPE_PHOTO		1
+#define DRM_MODE_CONTENT_TYPE_CINEMA		2
+#define DRM_MODE_CONTENT_TYPE_GAME		3
+
 /* Aspect ratio flag bitmask (4 bits 22:19) */
 #define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
 #define  DRM_MODE_FLAG_PIC_AR_NONE \
-- 
2.17.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] i915: content-type property for HDMI connector
  2018-04-18 16:51 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis
                   ` (3 preceding siblings ...)
  2018-04-18 16:51 ` [PATCH v2 1/2] drm: content-type property for HDMI connector StanLis
@ 2018-04-18 16:51 ` StanLis
  2018-04-18 11:35   ` Hans Verkuil
  4 siblings, 1 reply; 12+ messages in thread
From: StanLis @ 2018-04-18 16:51 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Added encoding of drm content_type property from
drm_connector_state within AVI infoframe in order to properly handle
external HDMI TV content-type setting.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c | 1 +
 drivers/gpu/drm/i915/intel_hdmi.c   | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 40285d1b91b7..61ddb5871d8a 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -124,6 +124,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
 	if (new_conn_state->force_audio != old_conn_state->force_audio ||
 	    new_conn_state->broadcast_rgb != old_conn_state->broadcast_rgb ||
 	    new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio ||
+	    new_conn_state->base.content_type != old_conn_state->base.content_type ||
 	    new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode)
 		crtc_state->mode_changed = true;
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index ee929f31f7db..5cc72da9c086 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -491,6 +491,8 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 					   intel_hdmi->rgb_quant_range_selectable,
 					   is_hdmi2_sink);
 
+	frame.avi.content_type = connector->state->content_type;
+
 	/* TODO: handle pixel repetition for YCBCR420 outputs */
 	intel_write_infoframe(encoder, crtc_state, &frame);
 }
@@ -2065,6 +2067,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
 	intel_attach_aspect_ratio_property(connector);
+	drm_connector_attach_content_type_property(connector);
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 0/2] Enabling content-type setting for HDMI displays.
@ 2018-04-18 16:49 StanLis
  0 siblings, 0 replies; 12+ messages in thread
From: StanLis @ 2018-04-18 16:49 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Added content type setting property to drm_connector(part 1)
and enabled transmitting it with HDMI AVI infoframes
for i915(part 2).

rev 2:
Moved helper function which attaches content type property
to the drm core, as was suggested.
Removed redundant connector state initialization.

Stanislav Lisovskiy (2):
  drm: content-type property for HDMI connector
  i915: content-type property for HDMI connector

 Documentation/gpu/kms-properties.csv |  1 +
 drivers/gpu/drm/drm_atomic.c         |  4 +++
 drivers/gpu/drm/drm_connector.c      | 50 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_edid.c           |  1 +
 drivers/gpu/drm/i915/intel_atomic.c  |  1 +
 drivers/gpu/drm/i915/intel_hdmi.c    |  3 ++
 include/drm/drm_connector.h          | 11 ++++++
 include/drm/drm_mode_config.h        |  5 +++
 include/uapi/drm/drm_mode.h          |  5 +++
 9 files changed, 81 insertions(+)

-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-04-18 16:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 16:51 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis
2018-04-18 13:35 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-04-18 13:52 ` ✓ Fi.CI.BAT: success " Patchwork
2018-04-18 16:44 ` ✓ Fi.CI.IGT: " Patchwork
2018-04-18 16:51 ` [PATCH v2 1/2] drm: content-type property for HDMI connector StanLis
2018-04-18 11:36   ` Hans Verkuil
2018-04-18 16:51 ` [PATCH v2 2/2] i915: " StanLis
2018-04-18 11:35   ` Hans Verkuil
2018-04-18 12:01     ` Lisovskiy, Stanislav
2018-04-18 12:35       ` Hans Verkuil
2018-04-18 12:48         ` Lisovskiy, Stanislav
  -- strict thread matches above, loose matches on Subject: below --
2018-04-18 16:49 [PATCH v2 0/2] Enabling content-type setting for HDMI displays StanLis

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.