All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shashank Sharma <shashank.sharma@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Subject: [PATCH 07/11] drm: set output colorspace in AVI infoframe
Date: Fri,  7 Apr 2017 19:39:24 +0300	[thread overview]
Message-ID: <1491583168-20042-8-git-send-email-shashank.sharma@intel.com> (raw)
In-Reply-To: <1491583168-20042-1-git-send-email-shashank.sharma@intel.com>

HDMI source must set output colorspace information in AVI
infoframes, so that the sink can decode upcoming frames
accordingly.

As this patch series is adding support for HDMI output modes
other than RGB, this patch adds a function in DRM layer, to
add the output colorspace information in the AVI infoframes.

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_edid.h     |  5 +++++
 2 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 828b781..a02d35b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4734,6 +4734,46 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
 
 /**
+ * drm_hdmi_avi_infoframe_set_colorspace() - fill an HDMI AVI infoframe with
+ * colorspace data of the output type
+ *
+ * @frame: HDMI AVI infoframe
+ * @mode: DRM display mode
+ * @hdmi_output: HDMI output colorspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output)
+{
+	switch (hdmi_output) {
+	case DRM_HDMI_OUTPUT_YCBCR444:
+		frame->colorspace = HDMI_COLORSPACE_YUV444;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR422:
+		frame->colorspace = HDMI_COLORSPACE_YUV422;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR420:
+		frame->colorspace = HDMI_COLORSPACE_YUV420;
+		frame->pixel_repeat = 0;
+		break;
+	case DRM_HDMI_OUTPUT_DEFAULT_RGB:
+		frame->colorspace = HDMI_COLORSPACE_RGB;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR_HQ:
+	case DRM_HDMI_OUTPUT_YCBCR_LQ:
+	case DRM_HDMI_OUTPUT_INVALID:
+		DRM_ERROR("Invalid HDMI output type\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_avi_infoframe_set_colorspace);
+
+/**
  * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
  *                                        quantization range information
  * @frame: HDMI AVI infoframe
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index a4d174e7..8980366 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -329,6 +329,7 @@ struct cea_sad {
 struct drm_encoder;
 struct drm_connector;
 struct drm_display_mode;
+enum drm_hdmi_output_type;
 
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
@@ -351,6 +352,10 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 					 const struct drm_display_mode *mode,
 					 bool is_hdmi2);
 int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output);
+int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
 void
-- 
2.7.4

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

  parent reply	other threads:[~2017-04-07 16:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 16:39 [PATCH 00/11] HDMI YCBCR output handling in DRM layer Shashank Sharma
2017-04-07 16:39 ` [PATCH 01/11] drm: Add HDMI 2.0 VIC support for AVI info-frames Shashank Sharma
2017-04-10  9:47   ` Andrzej Hajda
2017-04-19 16:02     ` Sharma, Shashank
2017-04-07 16:39 ` [PATCH 02/11] drm/edid: Complete CEA modedb(VIC 1-107) Shashank Sharma
2017-05-08 16:22   ` Ville Syrjälä
2017-05-08 16:44     ` Sharma, Shashank
2017-04-07 16:39 ` [PATCH 03/11] drm: parse ycbcr 420 vdb block Shashank Sharma
2017-05-08 16:24   ` Ville Syrjälä
2017-05-08 16:41     ` Sharma, Shashank
2017-05-08 17:09       ` Ville Syrjälä
2017-05-09  8:34         ` Sharma, Shashank
2017-05-09 15:28           ` Ville Syrjälä
2017-05-10  5:01             ` Sharma, Shashank
2017-04-07 16:39 ` [PATCH 04/11] drm: parse ycbcr420 vcb block Shashank Sharma
2017-04-08 15:14   ` kbuild test robot
2017-04-08 17:43   ` Emil Velikov
2017-04-19 16:04     ` Sharma, Shashank
2017-05-08 16:58   ` Ville Syrjälä
2017-05-09  8:19     ` Sharma, Shashank
2017-04-07 16:39 ` [PATCH 05/11] drm: parse ycbcr 420 deep color information Shashank Sharma
2017-04-08 18:29   ` kbuild test robot
2017-04-07 16:39 ` [PATCH 06/11] drm: create hdmi output property Shashank Sharma
2017-04-08 20:53   ` kbuild test robot
2017-04-12  9:58   ` Jose Abreu
2017-04-19 15:50     ` Sharma, Shashank
2017-04-07 16:39 ` Shashank Sharma [this message]
2017-04-12  9:49   ` [PATCH 07/11] drm: set output colorspace in AVI infoframe Jose Abreu
2017-04-19 15:55     ` Sharma, Shashank
2017-04-07 16:39 ` [PATCH 08/11] drm/i915: handle ycbcr outputs Shashank Sharma
2017-04-07 16:39 ` [PATCH 09/11] drm/i915: handle csc for ycbcr HDMI output Shashank Sharma
2017-04-07 16:39 ` [PATCH 10/11] drm/i915: prepare ycbcr420 modeset Shashank Sharma
2017-04-07 16:39 ` [PATCH 11/11] drm/i915: set colorspace for ycbcr outputs Shashank Sharma
2017-04-07 17:41 ` ✓ Fi.CI.BAT: success for HDMI YCBCR output handling in DRM layer Patchwork

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=1491583168-20042-8-git-send-email-shashank.sharma@intel.com \
    --to=shashank.sharma@intel.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.