Merge "msm: mdss: Add HDR Metadata Interface"

This commit is contained in:
Linux Build Service Account 2017-02-15 17:01:37 -08:00 committed by Gerrit - the friendly Code Review server
commit 70d13ef76a
3 changed files with 109 additions and 44 deletions

View file

@ -1251,7 +1251,6 @@ static ssize_t hdmi_tx_sysfs_wta_hdr_stream(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int ret = 0;
u32 const hdr_param_count = 13;
struct hdmi_tx_ctrl *ctrl = NULL;
ctrl = hdmi_tx_get_drvdata_from_sysfs_dev(dev);
@ -1267,26 +1266,14 @@ static ssize_t hdmi_tx_sysfs_wta_hdr_stream(struct device *dev,
goto end;
}
if (sscanf(buf, "%u %u %u %u %u %u %u %u %u %u %u %u %u",
&ctrl->hdr_data.eotf,
&ctrl->hdr_data.display_primaries_x[0],
&ctrl->hdr_data.display_primaries_y[0],
&ctrl->hdr_data.display_primaries_x[1],
&ctrl->hdr_data.display_primaries_y[1],
&ctrl->hdr_data.display_primaries_x[2],
&ctrl->hdr_data.display_primaries_y[2],
&ctrl->hdr_data.white_point_x,
&ctrl->hdr_data.white_point_y,
&ctrl->hdr_data.max_luminance,
&ctrl->hdr_data.min_luminance,
&ctrl->hdr_data.max_content_light_level,
&ctrl->hdr_data.max_average_light_level)
!= hdr_param_count) {
pr_err("%s: Invalid HDR stream data\n", __func__);
if (buf == NULL) {
pr_err("%s: hdr stream is NULL\n", __func__);
ret = -EINVAL;
goto end;
}
memcpy(&ctrl->hdr_data, buf, sizeof(struct mdp_hdr_stream));
pr_debug("%s: 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n",
__func__,
ctrl->hdr_data.eotf,
@ -1306,6 +1293,14 @@ static ssize_t hdmi_tx_sysfs_wta_hdr_stream(struct device *dev,
ctrl->hdr_data.max_content_light_level,
ctrl->hdr_data.max_average_light_level);
pr_debug("%s: 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n",
__func__,
ctrl->hdr_data.pixel_encoding,
ctrl->hdr_data.colorimetry,
ctrl->hdr_data.range,
ctrl->hdr_data.bits_per_component,
ctrl->hdr_data.content_type);
hdmi_panel_set_hdr_infoframe(ctrl);
ret = strnlen(buf, PAGE_SIZE);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -14,13 +14,13 @@
#define __MDSS_HDMI_TX_H__
#include <linux/switch.h>
#include <linux/msm_mdp_ext.h>
#include "mdss_hdmi_util.h"
#include "mdss_hdmi_panel.h"
#include "mdss_cec_core.h"
#include "mdss_hdmi_audio.h"
#define MAX_SWITCH_NAME_SIZE 5
#define HDR_PRIMARIES_COUNT 3
enum hdmi_tx_io_type {
HDMI_TX_CORE_IO,
@ -62,30 +62,6 @@ struct hdmi_tx_pinctrl {
struct hdmi_tx_ctrl;
typedef int (*hdmi_tx_evt_handler) (struct hdmi_tx_ctrl *);
/*
* struct hdmi_tx_hdr_stream - HDR video stream characteristics
* @eotf: Electro-Optical Transfer Function
* @display_primaries_x: display primaries data for x-coordinate
* @display_primaries_y: display primaries data for y-coordinate
* @white_point_x: white point data for x-coordinate
* @white_point_y: white point data for y-coordinate
* @max_luminance: content maximum luminance
* @min_luminance: content minimum luminance
* @max_content_light_level: content maximum light level
* @max_average_light_level: content average light level
*/
struct hdmi_tx_hdr_stream_data {
u32 eotf;
u32 display_primaries_x[HDR_PRIMARIES_COUNT];
u32 display_primaries_y[HDR_PRIMARIES_COUNT];
u32 white_point_x;
u32 white_point_y;
u32 max_luminance;
u32 min_luminance;
u32 max_content_light_level;
u32 max_average_light_level;
};
struct hdmi_tx_ctrl {
struct platform_device *pdev;
struct platform_device *ext_pdev;
@ -114,7 +90,7 @@ struct hdmi_tx_ctrl {
struct msm_ext_disp_audio_setup_params audio_params;
struct msm_ext_disp_init_data ext_audio_data;
struct work_struct fps_work;
struct hdmi_tx_hdr_stream_data hdr_data;
struct mdp_hdr_stream hdr_data;
spinlock_t hpd_state_lock;

View file

@ -179,6 +179,77 @@ VALIDATE/COMMIT FLAG CONFIGURATION
#define OUT_LAYER_COLOR_SPACE
/* From CEA.861.3 */
#define MDP_HDR_EOTF_SMTPE_ST2084 0x2
#define MDP_HDR_EOTF_HLG 0x3
/* From Vesa DPv1.4 - Pixel Encoding - Table 2-120 */
#define MDP_PIXEL_ENCODING_RGB 0x0
#define MDP_PIXEL_ENCODING_YCBCR_444 0x1
#define MDP_PIXEL_ENCODING_YCBCR_422 0x2
#define MDP_PIXEL_ENCODING_YCBCR_420 0x3
#define MDP_PIXEL_ENCODING_Y_ONLY 0x4
#define MDP_PIXEL_ENCODING_RAW 0x5
/* From Vesa DPv1.4 - Colorimetry Formats - Table 2-120 */
/* RGB - used with MDP_DP_PIXEL_ENCODING_RGB */
#define MDP_COLORIMETRY_RGB_SRGB 0x0
#define MDP_COLORIMETRY_RGB_WIDE_FIXED_POINT 0x1
#define MDP_COLORIMETRY_RGB_WIDE_FLOAT_POINT 0x2
#define MDP_COLORIMETRY_RGB_ADOBE 0x3
#define MDP_COLORIMETRY_RGB_DPI_P3 0x4
#define MDP_COLORIMETRY_RGB_CUSTOM 0x5
#define MDP_COLORIMETRY_RGB_ITU_R_BT_2020 0x6
/* YUV - used with MDP_DP_PIXEL_ENCODING_YCBCR(444 or 422 or 420) */
#define MDP_COLORIMETRY_YCBCR_ITU_R_BT_601 0x0
#define MDP_COLORIMETRY_YCBCR_ITU_R_BT_709 0x1
#define MDP_COLORIMETRY_YCBCR_XV_YCC_601 0x2
#define MDP_COLORIMETRY_YCBCR_XV_YCC_709 0x3
#define MDP_COLORIMETRY_YCBCR_S_YCC_601 0x4
#define MDP_COLORIMETRY_YCBCR_ADOBE_YCC_601 0x5
#define MDP_COLORIMETRY_YCBCR_ITU_R_BT_2020_YCBCR_CONST 0x6
#define MDP_COLORIMETRY_YCBCR_ITU_R_BT_2020_YCBCR 0x7
/* Dynamic Range - Table 2-120 */
/* Full range */
#define MDP_DYNAMIC_RANGE_VESA 0x0
/* Limited range */
#define MDP_DYNAMIC_RANGE_CEA 0x1
/* Bits per component(bpc) for Pixel encoding format RGB from Table 2-120 */
#define MDP_RGB_6_BPC 0x0
#define MDP_RGB_8_BPC 0x1
#define MDP_RGB_10_BPC 0x2
#define MDP_RGB_12_BPC 0x3
#define MDP_RGB_16_BPC 0x4
/*
* Bits per component(bpc) for Pixel encoding format YCbCr444, YCbCr422,
* YCbCr420 and Y only
* from Table 2-120
*/
#define MDP_YUV_8_BPC 0x1
#define MDP_YUV_10_BPC 0x2
#define MDP_YUV_12_BPC 0x3
#define MDP_YUV_16_BPC 0x4
/* Bits per component(bpc) for Pixel encoding format RAW from Table 2-120 */
#define MDP_RAW_6_BPC 0x1
#define MDP_RAW_7_BPC 0x2
#define MDP_RAW_8_BPC 0x3
#define MDP_RAW_10_BPC 0x4
#define MDP_RAW_12_BPC 0x5
#define MDP_RAW_14_BPC 0x6
#define MDP_RAW16_BPC 0x7
/* Content Type - Table 2-120 */
#define MDP_CONTENT_TYPE_NOT_DEFINED 0x0
#define MDP_CONTENT_TYPE_GRAPHICS 0x1
#define MDP_CONTENT_TYPE_PHOTO 0x2
#define MDP_CONTENT_TYPE_VIDEO 0x3
#define MDP_CONTENT_TYPE_GAME 0x4
/**********************************************************************
Configuration structures
All parameters are input to driver unless mentioned output parameter
@ -709,4 +780,27 @@ struct mdp_set_cfg {
uint32_t len;
uint64_t __user payload;
};
#define HDR_PRIMARIES_COUNT 3
#define MDP_HDR_STREAM
struct mdp_hdr_stream {
uint32_t eotf;
uint32_t display_primaries_x[HDR_PRIMARIES_COUNT];
uint32_t display_primaries_y[HDR_PRIMARIES_COUNT];
uint32_t white_point_x;
uint32_t white_point_y;
uint32_t max_luminance;
uint32_t min_luminance;
uint32_t max_content_light_level;
uint32_t max_average_light_level;
/* DP related */
uint32_t pixel_encoding;
uint32_t colorimetry;
uint32_t range;
uint32_t bits_per_component;
uint32_t content_type;
uint32_t reserved[5];
};
#endif