From: 김승우 <sw0312.kim@samsung.com>
To: Rahul Sharma <rahul.sharma@samsung.com>
Cc: dri-devel@lists.freedesktop.org,
linux-samsung-soc@vger.kernel.org, seanpaul@google.com,
joshi@samsung.com, sw0312.kim@samsung.com,
대인기 <inki.dae@samsung.com>
Subject: Re: [PATCH v2] drm/exynos: hdmi: use drm_display_mode to check the supported modes
Date: Mon, 29 Apr 2013 13:34:07 +0900 [thread overview]
Message-ID: <517DF83F.4020405@samsung.com> (raw)
In-Reply-To: <1366985038-2801-1-git-send-email-rahul.sharma@samsung.com>
Hello Rahul,
I agree with basic idea of this patch.
However, to avoid confusion, how do you think about fixing all
check_timing as check_mode and its second parameter as mode including
struct exynos_drm_display_ops?
Regards,
- Seung-Woo Kim
On 2013년 04월 26일 23:03, Rahul Sharma wrote:
> Exynos hdmi driver is using drm_display_mode for setting timing values
> for a supported resolution. Conversion to fb_videomode and then comparing
> with the mixer/hdmi/phy limits is not required. Instead, drm_display_mode
> fields cane be directly compared.
>
> v2:
> 1) Removed convert_to_video_timing().
> 2) Corrected DRM_DEBUG_KMS to print the resolution properly.
>
> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_connector.c | 36 +------------------------
> drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 6 ++---
> drivers/gpu/drm/exynos/exynos_hdmi.c | 15 +++++------
> drivers/gpu/drm/exynos/exynos_mixer.c | 13 ++++-----
> 4 files changed, 18 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
> index 8bcc13a..7259fff 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
> @@ -58,37 +58,6 @@ convert_to_display_mode(struct drm_display_mode *mode,
> mode->flags |= DRM_MODE_FLAG_DBLSCAN;
> }
>
> -/* convert drm_display_mode to exynos_video_timings */
> -static inline void
> -convert_to_video_timing(struct fb_videomode *timing,
> - struct drm_display_mode *mode)
> -{
> - DRM_DEBUG_KMS("%s\n", __FILE__);
> -
> - memset(timing, 0, sizeof(*timing));
> -
> - timing->pixclock = mode->clock * 1000;
> - timing->refresh = drm_mode_vrefresh(mode);
> -
> - timing->xres = mode->hdisplay;
> - timing->right_margin = mode->hsync_start - mode->hdisplay;
> - timing->hsync_len = mode->hsync_end - mode->hsync_start;
> - timing->left_margin = mode->htotal - mode->hsync_end;
> -
> - timing->yres = mode->vdisplay;
> - timing->lower_margin = mode->vsync_start - mode->vdisplay;
> - timing->vsync_len = mode->vsync_end - mode->vsync_start;
> - timing->upper_margin = mode->vtotal - mode->vsync_end;
> -
> - if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> - timing->vmode = FB_VMODE_INTERLACED;
> - else
> - timing->vmode = FB_VMODE_NONINTERLACED;
> -
> - if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
> - timing->vmode |= FB_VMODE_DOUBLE;
> -}
> -
> static int exynos_drm_connector_get_modes(struct drm_connector *connector)
> {
> struct exynos_drm_connector *exynos_connector =
> @@ -168,15 +137,12 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
> to_exynos_connector(connector);
> struct exynos_drm_manager *manager = exynos_connector->manager;
> struct exynos_drm_display_ops *display_ops = manager->display_ops;
> - struct fb_videomode timing;
> int ret = MODE_BAD;
>
> DRM_DEBUG_KMS("%s\n", __FILE__);
>
> - convert_to_video_timing(&timing, mode);
> -
> if (display_ops && display_ops->check_timing)
> - if (!display_ops->check_timing(manager->dev, (void *)&timing))
> + if (!display_ops->check_timing(manager->dev, (void *)mode))
> ret = MODE_OK;
>
> return ret;
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> index 6b70944..fd2ff9f 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
> @@ -32,11 +32,11 @@ struct exynos_hdmi_ops {
> bool (*is_connected)(void *ctx);
> struct edid *(*get_edid)(void *ctx,
> struct drm_connector *connector);
> - int (*check_timing)(void *ctx, struct fb_videomode *timing);
> + int (*check_timing)(void *ctx, struct drm_display_mode *mode);
> int (*power_on)(void *ctx, int mode);
>
> /* manager */
> - void (*mode_set)(void *ctx, void *mode);
> + void (*mode_set)(void *ctx, struct drm_display_mode *mode);
> void (*get_max_resol)(void *ctx, unsigned int *width,
> unsigned int *height);
> void (*commit)(void *ctx);
> @@ -57,7 +57,7 @@ struct exynos_mixer_ops {
> void (*win_disable)(void *ctx, int zpos);
>
> /* display */
> - int (*check_timing)(void *ctx, struct fb_videomode *timing);
> + int (*check_timing)(void *ctx, struct drm_display_mode *mode);
> };
>
> void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx);
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 93b70e9..aeca603 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -796,18 +796,17 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
> return -EINVAL;
> }
>
> -static int hdmi_check_timing(void *ctx, struct fb_videomode *timing)
> +static int hdmi_check_timing(void *ctx, struct drm_display_mode *mode)
> {
> struct hdmi_context *hdata = ctx;
> int ret;
>
> - DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
> -
> - DRM_DEBUG_KMS("[%d]x[%d] [%d]Hz [%x]\n", timing->xres,
> - timing->yres, timing->refresh,
> - timing->vmode);
> + DRM_DEBUG_KMS("[WxH@HzI/P at Pixel Clk]: %dx%d@%d%s at %d\n",
> + mode->hdisplay, mode->vdisplay, mode->vrefresh,
> + (mode->flags & DRM_MODE_FLAG_INTERLACE) ? "I" : "P",
> + mode->clock * 1000);
>
> - ret = hdmi_find_phy_conf(hdata, timing->pixclock);
> + ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
> if (ret < 0)
> return ret;
> return 0;
> @@ -1643,7 +1642,7 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata,
> hdmi_set_reg(tg->tg_3d, 1, 0x0);
> }
>
> -static void hdmi_mode_set(void *ctx, void *mode)
> +static void hdmi_mode_set(void *ctx, struct drm_display_mode *mode)
> {
> struct hdmi_context *hdata = ctx;
> struct drm_display_mode *m = mode;
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
> index f08e251..67c4fd8 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -818,17 +818,17 @@ static void mixer_win_disable(void *ctx, int win)
> mixer_ctx->win_data[win].enabled = false;
> }
>
> -static int mixer_check_timing(void *ctx, struct fb_videomode *timing)
> +static int mixer_check_timing(void *ctx, struct drm_display_mode *mode)
> {
> u32 w, h;
>
> - w = timing->xres;
> - h = timing->yres;
> + w = mode->hdisplay;
> + h = mode->vdisplay;
>
> DRM_DEBUG_KMS("%s : xres=%d, yres=%d, refresh=%d, intl=%d\n",
> - __func__, timing->xres, timing->yres,
> - timing->refresh, (timing->vmode &
> - FB_VMODE_INTERLACED) ? true : false);
> + __func__, mode->hdisplay, mode->vdisplay,
> + mode->vrefresh, (mode->flags &
> + DRM_MODE_FLAG_INTERLACE) ? true : false);
>
> if ((w >= 464 && w <= 720 && h >= 261 && h <= 576) ||
> (w >= 1024 && w <= 1280 && h >= 576 && h <= 720) ||
> @@ -837,6 +837,7 @@ static int mixer_check_timing(void *ctx, struct fb_videomode *timing)
>
> return -EINVAL;
> }
> +
> static void mixer_wait_for_vblank(void *ctx)
> {
> struct mixer_context *mixer_ctx = ctx;
>
--
Seung-Woo Kim
Samsung Software R&D Center
--
next prev parent reply other threads:[~2013-04-29 4:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 14:03 [PATCH v2] drm/exynos: hdmi: use drm_display_mode to check the supported modes Rahul Sharma
2013-04-29 4:34 ` 김승우 [this message]
2013-04-29 5:41 ` Rahul Sharma
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=517DF83F.4020405@samsung.com \
--to=sw0312.kim@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=joshi@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=rahul.sharma@samsung.com \
--cc=seanpaul@google.com \
/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.