linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/omap: update for interlaced
@ 2012-09-05 21:48 Rob Clark
  2012-09-06  5:42 ` Semwal, Sumit
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Clark @ 2012-09-05 21:48 UTC (permalink / raw)
  To: dri-devel, linux-omap
  Cc: patches, Greg KH, Tomi Valkeinen, Andy Gross, Rob Clark

From: Rob Clark <rob@ti.com>

'struct omap_video_timings' was updated w/ a 'bool interlaced'.  Without
a matching update in omap_connector, this field could have undefined
values from the stack, which isn't quite ideal.

Update the fxns to convert omapdss<->drm timings structs, and zero-init
'struct omap_video_timings' when it is declared on stack to avoid issues
like this in the future.

Signed-off-by: Rob Clark <rob@ti.com>
---
 drivers/staging/omapdrm/omap_connector.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/omapdrm/omap_connector.c b/drivers/staging/omapdrm/omap_connector.c
index 5e2856c..5f4a89b 100644
--- a/drivers/staging/omapdrm/omap_connector.c
+++ b/drivers/staging/omapdrm/omap_connector.c
@@ -48,13 +48,10 @@ static inline void copy_timings_omap_to_drm(struct drm_display_mode *mode,
 	mode->vsync_end = mode->vsync_start + timings->vsw;
 	mode->vtotal = mode->vsync_end + timings->vbp;
 
-	/* note: whether or not it is interlaced, +/- h/vsync, etc,
-	 * which should be set in the mode flags, is not exposed in
-	 * the omap_video_timings struct.. but hdmi driver tracks
-	 * those separately so all we have to have to set the mode
-	 * is the way to recover these timings values, and the
-	 * omap_dss_driver would do the rest.
-	 */
+	mode->flags = 0;
+
+	if (timings->interlace)
+		mode->flags |= DRM_MODE_FLAG_INTERLACE;
 }
 
 static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
@@ -71,6 +68,8 @@ static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
 	timings->vfp = mode->vsync_start - mode->vdisplay;
 	timings->vsw = mode->vsync_end - mode->vsync_start;
 	timings->vbp = mode->vtotal - mode->vsync_end;
+
+	timings->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
 }
 
 static void omap_connector_dpms(struct drm_connector *connector, int mode)
@@ -187,7 +186,7 @@ static int omap_connector_get_modes(struct drm_connector *connector)
 		}
 	} else {
 		struct drm_display_mode *mode = drm_mode_create(dev);
-		struct omap_video_timings timings;
+		struct omap_video_timings timings = {0};
 
 		dssdrv->get_timings(dssdev, &timings);
 
@@ -291,7 +290,7 @@ void omap_connector_mode_set(struct drm_connector *connector,
 	struct omap_connector *omap_connector = to_omap_connector(connector);
 	struct omap_dss_device *dssdev = omap_connector->dssdev;
 	struct omap_dss_driver *dssdrv = dssdev->driver;
-	struct omap_video_timings timings;
+	struct omap_video_timings timings = {0};
 
 	copy_timings_drm_to_omap(&timings, mode);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/omap: update for interlaced
  2012-09-05 21:48 [PATCH] drm/omap: update for interlaced Rob Clark
@ 2012-09-06  5:42 ` Semwal, Sumit
  0 siblings, 0 replies; 2+ messages in thread
From: Semwal, Sumit @ 2012-09-06  5:42 UTC (permalink / raw)
  To: Rob Clark
  Cc: dri-devel, linux-omap, patches, Greg KH, Tomi Valkeinen,
	Andy Gross, Rob Clark

Hi Rob,
On Thu, Sep 6, 2012 at 3:18 AM, Rob Clark <rob.clark@linaro.org> wrote:
> From: Rob Clark <rob@ti.com>
>
> 'struct omap_video_timings' was updated w/ a 'bool interlaced'.  Without
> a matching update in omap_connector, this field could have undefined
> values from the stack, which isn't quite ideal.
>
> Update the fxns to convert omapdss<->drm timings structs, and zero-init
> 'struct omap_video_timings' when it is declared on stack to avoid issues
> like this in the future.
>
> Signed-off-by: Rob Clark <rob@ti.com>
Feel free to use
Reviewed-by: Sumit Semwal <sumit.semwal@ti.com>
> ---
>  drivers/staging/omapdrm/omap_connector.c |   17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/omapdrm/omap_connector.c b/drivers/staging/omapdrm/omap_connector.c
> index 5e2856c..5f4a89b 100644
> --- a/drivers/staging/omapdrm/omap_connector.c
> +++ b/drivers/staging/omapdrm/omap_connector.c
> @@ -48,13 +48,10 @@ static inline void copy_timings_omap_to_drm(struct drm_display_mode *mode,
>         mode->vsync_end = mode->vsync_start + timings->vsw;
>         mode->vtotal = mode->vsync_end + timings->vbp;
>
> -       /* note: whether or not it is interlaced, +/- h/vsync, etc,
> -        * which should be set in the mode flags, is not exposed in
> -        * the omap_video_timings struct.. but hdmi driver tracks
> -        * those separately so all we have to have to set the mode
> -        * is the way to recover these timings values, and the
> -        * omap_dss_driver would do the rest.
> -        */
> +       mode->flags = 0;
> +
> +       if (timings->interlace)
> +               mode->flags |= DRM_MODE_FLAG_INTERLACE;
>  }
>
>  static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
> @@ -71,6 +68,8 @@ static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
>         timings->vfp = mode->vsync_start - mode->vdisplay;
>         timings->vsw = mode->vsync_end - mode->vsync_start;
>         timings->vbp = mode->vtotal - mode->vsync_end;
> +
> +       timings->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
>  }
>
>  static void omap_connector_dpms(struct drm_connector *connector, int mode)
> @@ -187,7 +186,7 @@ static int omap_connector_get_modes(struct drm_connector *connector)
>                 }
>         } else {
>                 struct drm_display_mode *mode = drm_mode_create(dev);
> -               struct omap_video_timings timings;
> +               struct omap_video_timings timings = {0};
>
>                 dssdrv->get_timings(dssdev, &timings);
>
> @@ -291,7 +290,7 @@ void omap_connector_mode_set(struct drm_connector *connector,
>         struct omap_connector *omap_connector = to_omap_connector(connector);
>         struct omap_dss_device *dssdev = omap_connector->dssdev;
>         struct omap_dss_driver *dssdrv = dssdev->driver;
> -       struct omap_video_timings timings;
> +       struct omap_video_timings timings = {0};
>
>         copy_timings_drm_to_omap(&timings, mode);
>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-06  5:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 21:48 [PATCH] drm/omap: update for interlaced Rob Clark
2012-09-06  5:42 ` Semwal, Sumit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).