From patchwork Wed Sep 5 21:48:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11202 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D60A823F26 for ; Wed, 5 Sep 2012 21:48:57 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 27F7FA1869E for ; Wed, 5 Sep 2012 21:48:03 +0000 (UTC) Received: by iafj25 with SMTP id j25so1196064iaf.11 for ; Wed, 05 Sep 2012 14:48:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=CNS+cUQFpPuftBiarb9d+1YvFkMF2BPP8VncIXvvtw8=; b=XMD6UcW1wSa061DUFOkWrBTLONo8HU07PYy1vs9wpHmEP1cubm0AuEs9VGUwu7Nfpo bM9lwGdyuk7WtB03bAFS5u2kBAe8Ksno0RCZV8IzPYQ3nD0YLmmlGeCk7aupkgu9XvCJ u5hoRmovorEW6ZB/NfiBmfFoJTF83ih1QGaEhlc6VnqUrApXn/j8peRUbzpkPp8ymFvk O6yy/IrDIy8Fx7ePD7YbiZcl6Olo7P/NqFsSS+yMec6rQ70zqOHwDIx5hLmxB/U6keUp OPa+l16qp/CETh64MgQG55sYmOdEb+Vts1pt0cmlAFGSFrndTK6wI2kRnu/cbPo5Y4WA fzIQ== Received: by 10.42.60.139 with SMTP id q11mr22381435ich.53.1346881736825; Wed, 05 Sep 2012 14:48:56 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp281478igc; Wed, 5 Sep 2012 14:48:56 -0700 (PDT) Received: by 10.182.111.39 with SMTP id if7mr18099021obb.56.1346881736384; Wed, 05 Sep 2012 14:48:56 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id r4si138459obz.104.2012.09.05.14.48.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 14:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id wd20so1365819obb.37 for ; Wed, 05 Sep 2012 14:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=CNS+cUQFpPuftBiarb9d+1YvFkMF2BPP8VncIXvvtw8=; b=SJWCtHl36NfQn8hNoN84v76H784HAKS2H2N7In55PgR+vnA9g9tf9s+N6ShPu8Tn25 1kEurT23ykcpdLNoOVSqJxnHI2j9xbqA5WbyA3bx6maGggPoRK9P5IcWYiZMuJm+tx/Y nhOxTsNwjew5v4vYTP6DRIueV2xKstK5LK1ku+881OjrBFO44rYQkjwft0l/KJ/OqgFP xnH9qf/CzuXvKLw9pssjzJHypP6nNOelGliM/dsYT9ty6rNr7UtobqsnTjgZUnZ15aux Xn3ignuG184d/T32HRUH4IAck2lEwJjK8i9AfUcPc9+kBuz9+m/k7IjY20dWY9Lh9NN/ 4cjw== Received: by 10.60.29.40 with SMTP id g8mr18142030oeh.25.1346881736256; Wed, 05 Sep 2012 14:48:56 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id hz6sm186735obb.1.2012.09.05.14.48.55 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 14:48:55 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org Cc: patches@linaro.org, Greg KH , Tomi Valkeinen , Andy Gross , Rob Clark Subject: [PATCH] drm/omap: update for interlaced Date: Wed, 5 Sep 2012 16:48:53 -0500 Message-Id: <1346881733-31970-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnKECD+wUwokDFPqOnpI9jOVcFXnlFaPOQlAalitZ6G9yl8ArhkeuJNcI3XVOcpxBwebDXz From: Rob Clark '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 Reviewed-by: Sumit Semwal --- 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);