diff mbox

[1/4] drm/exynos: add display-mode-check operation to exynos_mixer_ops struct

Message ID 1356608328-5847-2-git-send-email-rahul.sharma@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rahul Sharma Dec. 27, 2012, 11:38 a.m. UTC
This patch adds the display mode check operation to exynos_mixer_ops
in drm-common-hdmi. In Exynos SoCs, mixer IP can put certain restrictions
on the proposed display modes. These restriction needs to be considered
during mode negotiation, which happens immediately after edid parsing.

Both, mixer check-mode and hdmi check-timing callbacks are called one after
another and ANDed result is returned back.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 12 ++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h |  3 +++
 2 files changed, 15 insertions(+)

Comments

Sean Paul Jan. 2, 2013, 5:07 p.m. UTC | #1
On Thu, Dec 27, 2012 at 6:38 AM, Rahul Sharma <rahul.sharma@samsung.com> wrote:
> This patch adds the display mode check operation to exynos_mixer_ops
> in drm-common-hdmi. In Exynos SoCs, mixer IP can put certain restrictions
> on the proposed display modes. These restriction needs to be considered
> during mode negotiation, which happens immediately after edid parsing.
>
> Both, mixer check-mode and hdmi check-timing callbacks are called one after
> another and ANDed result is returned back.
>

This looks good, thanks for making the change.

> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 12 ++++++++++++
>  drivers/gpu/drm/exynos/exynos_drm_hdmi.h |  3 +++
>  2 files changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> index 55793c4..3a8eea6 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> @@ -125,9 +125,21 @@ static int drm_hdmi_get_edid(struct device *dev,
>  static int drm_hdmi_check_timing(struct device *dev, void *timing)
>  {
>         struct drm_hdmi_context *ctx = to_context(dev);
> +       int ret = 0;
>
>         DRM_DEBUG_KMS("%s\n", __FILE__);
>
> +       /*
> +       * Both, mixer and hdmi should be able to handle the requested mode.
> +       * If any of the two fails, return mode as BAD.
> +       */
> +
> +       if (mixer_ops && mixer_ops->check_mode)
> +               ret = mixer_ops->check_mode(ctx->mixer_ctx->ctx, timing);
> +
> +       if (ret)
> +               return ret;
> +
>         if (hdmi_ops && hdmi_ops->check_timing)
>                 return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> index 784a7e9..ae4b6ae 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> @@ -58,6 +58,9 @@ struct exynos_mixer_ops {
>         void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
>         void (*win_commit)(void *ctx, int zpos);
>         void (*win_disable)(void *ctx, int zpos);
> +
> +       /* display */
> +       int (*check_mode)(void *ctx, void *mode);

Minor nit: I think check_timing would be better here, it's more consistent.

Sean

>  };
>
>  void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx);
> --
> 1.8.0
>
Rahul Sharma Jan. 3, 2013, 3:23 a.m. UTC | #2
On Wed, Jan 2, 2013 at 10:37 PM, Sean Paul <seanpaul@google.com> wrote:
> On Thu, Dec 27, 2012 at 6:38 AM, Rahul Sharma <rahul.sharma@samsung.com> wrote:
>> This patch adds the display mode check operation to exynos_mixer_ops
>> in drm-common-hdmi. In Exynos SoCs, mixer IP can put certain restrictions
>> on the proposed display modes. These restriction needs to be considered
>> during mode negotiation, which happens immediately after edid parsing.
>>
>> Both, mixer check-mode and hdmi check-timing callbacks are called one after
>> another and ANDed result is returned back.
>>
>
> This looks good, thanks for making the change.
>
>> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 12 ++++++++++++
>>  drivers/gpu/drm/exynos/exynos_drm_hdmi.h |  3 +++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
>> index 55793c4..3a8eea6 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
>> @@ -125,9 +125,21 @@ static int drm_hdmi_get_edid(struct device *dev,
>>  static int drm_hdmi_check_timing(struct device *dev, void *timing)
>>  {
>>         struct drm_hdmi_context *ctx = to_context(dev);
>> +       int ret = 0;
>>
>>         DRM_DEBUG_KMS("%s\n", __FILE__);
>>
>> +       /*
>> +       * Both, mixer and hdmi should be able to handle the requested mode.
>> +       * If any of the two fails, return mode as BAD.
>> +       */
>> +
>> +       if (mixer_ops && mixer_ops->check_mode)
>> +               ret = mixer_ops->check_mode(ctx->mixer_ctx->ctx, timing);
>> +
>> +       if (ret)
>> +               return ret;
>> +
>>         if (hdmi_ops && hdmi_ops->check_timing)
>>                 return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
>> index 784a7e9..ae4b6ae 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
>> @@ -58,6 +58,9 @@ struct exynos_mixer_ops {
>>         void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
>>         void (*win_commit)(void *ctx, int zpos);
>>         void (*win_disable)(void *ctx, int zpos);
>> +
>> +       /* display */
>> +       int (*check_mode)(void *ctx, void *mode);
>
> Minor nit: I think check_timing would be better here, it's more consistent.

ok. I will change to check_timing in v2.

regards,
Rahul Sharma.
>
> Sean
>
>>  };
>>
>>  void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx);
>> --
>> 1.8.0
>>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 55793c4..3a8eea6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -125,9 +125,21 @@  static int drm_hdmi_get_edid(struct device *dev,
 static int drm_hdmi_check_timing(struct device *dev, void *timing)
 {
 	struct drm_hdmi_context *ctx = to_context(dev);
+	int ret = 0;
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
+	/*
+	* Both, mixer and hdmi should be able to handle the requested mode.
+	* If any of the two fails, return mode as BAD.
+	*/
+
+	if (mixer_ops && mixer_ops->check_mode)
+		ret = mixer_ops->check_mode(ctx->mixer_ctx->ctx, timing);
+
+	if (ret)
+		return ret;
+
 	if (hdmi_ops && hdmi_ops->check_timing)
 		return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
index 784a7e9..ae4b6ae 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
@@ -58,6 +58,9 @@  struct exynos_mixer_ops {
 	void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
 	void (*win_commit)(void *ctx, int zpos);
 	void (*win_disable)(void *ctx, int zpos);
+
+	/* display */
+	int (*check_mode)(void *ctx, void *mode);
 };
 
 void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx);