From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 2/3] drm/i915/sdvo: Robustify the dtd<->drm_mode conversions
Date: Tue, 10 Sep 2013 13:26:20 +0300 [thread overview]
Message-ID: <20130910102620.GL11428@intel.com> (raw)
In-Reply-To: <1378807612-18399-2-git-send-email-daniel.vetter@ffwll.ch>
On Tue, Sep 10, 2013 at 12:06:51PM +0200, Daniel Vetter wrote:
> We've failed to properly clear out the flags when converting a dtd to
> a drm mode. For more paranoia just memset the entire structure (and
> drop the now redundant clears).
>
> Also since
>
> commit 135c81b8c3c9a70d7b55758c9c2a247a4abb7b64
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date: Sun Jul 21 21:37:09 2013 +0200
>
> drm/i915: clean up crtc timings computation
>
> we don't update the crtc timings any more properly, so do that again.
>
> Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/i915/intel_sdvo.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 5033c74..d4a046d 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -788,6 +788,8 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
> uint16_t h_sync_offset, v_sync_offset;
> int mode_clock;
>
> + memset(dtd, 0, sizeof(*dtd));
> +
> width = mode->hdisplay;
> height = mode->vdisplay;
>
> @@ -830,14 +832,14 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
> if (mode->flags & DRM_MODE_FLAG_PVSYNC)
> dtd->part2.dtd_flags |= DTD_FLAG_VSYNC_POSITIVE;
>
> - dtd->part2.sdvo_flags = 0;
> dtd->part2.v_sync_off_high = v_sync_offset & 0xc0;
> - dtd->part2.reserved = 0;
> }
>
> static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode,
> const struct intel_sdvo_dtd *dtd)
> {
> + memset(mode, 0, sizeof(*mode));
I have a theoretical worry that someone might end up calling this on a
mode that sits on some list or was actually allocated and has a proper
object id which we'd leak here.
To make it totally safe you could populate a pristine mode struct and
use drm_mode_copy() to overwrite adjusted_mode. Assuming we're not so
short on stack space that our oversized mode struct would cause issues.
Other options would be to add some WARNs to catch wrongdoers, or embed
a temp mode for this purpose inside the intel_sdvo struct.
> +
> mode->hdisplay = dtd->part1.h_active;
> mode->hdisplay += ((dtd->part1.h_high >> 4) & 0x0f) << 8;
> mode->hsync_start = mode->hdisplay + dtd->part2.h_sync_off;
> @@ -872,6 +874,8 @@ static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode,
Somewhere around these parts we have:
'mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);'
It can now be eliminated.
> mode->flags |= DRM_MODE_FLAG_PVSYNC;
> else
> mode->flags |= DRM_MODE_FLAG_NVSYNC;
> +
> + drm_mode_set_crtcinfo(mode);
> }
>
> static bool intel_sdvo_check_supp_encode(struct intel_sdvo *intel_sdvo)
> --
> 1.8.4.rc3
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2013-09-10 10:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 10:06 [PATCH 1/3] drm/i915/sdvo: Fully translate sync flags in the dtd->mode conversion Daniel Vetter
2013-09-10 10:06 ` [PATCH 2/3] drm/i915/sdvo: Robustify the dtd<->drm_mode conversions Daniel Vetter
2013-09-10 10:26 ` Ville Syrjälä [this message]
2013-09-10 10:50 ` Daniel Vetter
2013-09-10 11:00 ` Ville Syrjälä
2013-09-10 12:26 ` Daniel Vetter
2013-09-10 12:44 ` Ville Syrjälä
2013-09-10 10:51 ` [PATCH] " Daniel Vetter
2013-09-10 10:54 ` [PATCH 1/2] " Daniel Vetter
2013-09-10 10:54 ` [PATCH 2/2] drm/i915/dvo: set crtc timings again for panel fixed modes Daniel Vetter
2013-09-10 10:06 ` [PATCH 3/3] " Daniel Vetter
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=20130910102620.GL11428@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--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.