diff mbox

[v2,08/10] drm/rockchip: analogix_dp: correct the connector display color format and bpc

Message ID 1464066164-22863-1-git-send-email-ykk@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yakir Yang May 24, 2016, 5:02 a.m. UTC
Rockchip VOP couldn't output YUV video format for eDP controller, so
when driver detect connector support YUV video format, we need to hack
it down to RGB888.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
---
Changes in v2: None

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

yao mark June 1, 2016, 3:52 a.m. UTC | #1
On 2016年05月24日 13:02, Yakir Yang wrote:
> Rockchip VOP couldn't output YUV video format for eDP controller, so
> when driver detect connector support YUV video format, we need to hack
> it down to RGB888.
>
> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
> ---
> Changes in v2: None
>
>   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> index f29ca3d..910cceb 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -97,6 +97,24 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)
>   	return 0;
>   }
>   
> +static enum drm_mode_status
> +rockchip_dp_mode_valid(struct analogix_dp_plat_data *plat_data,
> +		       struct drm_connector *connector,
> +		       struct drm_display_mode *mode)
> +{
> +	struct drm_display_info *di = &connector->display_info;
> +
> +	if (di->color_formats & DRM_COLOR_FORMAT_YCRCB444 ||
> +	    di->color_formats & DRM_COLOR_FORMAT_YCRCB422) {
> +		di->color_formats &= ~(DRM_COLOR_FORMAT_YCRCB422 |
> +				       DRM_COLOR_FORMAT_YCRCB444);
> +		di->color_formats |= DRM_COLOR_FORMAT_RGB444;
> +		di->bpc = 8;
> +	}
> +
> +	return MODE_OK;
> +}
> +
>   static bool
>   rockchip_dp_drm_encoder_mode_fixup(struct drm_encoder *encoder,
>   				   const struct drm_display_mode *mode,
> @@ -306,6 +324,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
>   	dp->plat_data.subdev_type = dp_data->chip_type;
>   	dp->plat_data.power_on = rockchip_dp_poweron;
>   	dp->plat_data.power_off = rockchip_dp_powerdown;
> +	dp->plat_data.mode_valid = rockchip_dp_mode_valid;
>   
>   	return analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
>   }
Looks for me, So:

Acked-by: Mark Yao <mark.yao@rock-chips.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index f29ca3d..910cceb 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -97,6 +97,24 @@  static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)
 	return 0;
 }
 
+static enum drm_mode_status
+rockchip_dp_mode_valid(struct analogix_dp_plat_data *plat_data,
+		       struct drm_connector *connector,
+		       struct drm_display_mode *mode)
+{
+	struct drm_display_info *di = &connector->display_info;
+
+	if (di->color_formats & DRM_COLOR_FORMAT_YCRCB444 ||
+	    di->color_formats & DRM_COLOR_FORMAT_YCRCB422) {
+		di->color_formats &= ~(DRM_COLOR_FORMAT_YCRCB422 |
+				       DRM_COLOR_FORMAT_YCRCB444);
+		di->color_formats |= DRM_COLOR_FORMAT_RGB444;
+		di->bpc = 8;
+	}
+
+	return MODE_OK;
+}
+
 static bool
 rockchip_dp_drm_encoder_mode_fixup(struct drm_encoder *encoder,
 				   const struct drm_display_mode *mode,
@@ -306,6 +324,7 @@  static int rockchip_dp_bind(struct device *dev, struct device *master,
 	dp->plat_data.subdev_type = dp_data->chip_type;
 	dp->plat_data.power_on = rockchip_dp_poweron;
 	dp->plat_data.power_off = rockchip_dp_powerdown;
+	dp->plat_data.mode_valid = rockchip_dp_mode_valid;
 
 	return analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
 }