From patchwork Mon Feb 21 04:42:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 576691 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1L4iG0F032423 for ; Mon, 21 Feb 2011 04:44:36 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6E899E9F3 for ; Sun, 20 Feb 2011 20:44:16 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx4.gwdg.de (mx4.gwdg.de [134.76.10.17]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FDAA9E9BA for ; Sun, 20 Feb 2011 20:43:14 -0800 (PST) X-IronPort-Reputation-Score: None X-IronPort-AV: E=McAfee;i="5400,1158,6263"; a="21073135" X-IronPort-AV: E=Sophos;i="4.62,198,1297033200"; d="scan'208";a="21073135" Received: from smtp-out.tuebingen.mpg.de (HELO tuebingen.mpg.de) ([192.124.26.249]) by mailer2.mpg.de with ESMTP; 21 Feb 2011 05:43:13 +0100 Received: from [10.38.138.43] (account mario.kleiner@tuebingen.mpg.de HELO funky.kyb.local) by tuebingen.mpg.de (CommuniGate Pro SMTP 5.3.10) with ESMTPA id 14367921; Mon, 21 Feb 2011 05:43:13 +0100 From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/vblank: Enable precise vblank timestamps for interlaced and doublescan modes. Date: Mon, 21 Feb 2011 05:42:02 +0100 Message-Id: <1298263322-28605-4-git-send-email-mario.kleiner@tuebingen.mpg.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298263322-28605-1-git-send-email-mario.kleiner@tuebingen.mpg.de> References: <1298263322-28605-1-git-send-email-mario.kleiner@tuebingen.mpg.de> Cc: airlied@redhat.com, Mario Kleiner X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 21 Feb 2011 04:44:36 +0000 (UTC) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 891bf6d..2abcd15 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -493,6 +493,12 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc) /* Dot clock in Hz: */ dotclock = (u64) crtc->hwmode.clock * 1000; + /* Fields of interlaced scanout modes are only halve a frame duration. + * Double the dotclock to get halve the frame-/line-/pixelduration. + */ + if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE) + dotclock *= 2; + /* Valid dotclock? */ if (dotclock > 0) { /* Convert scanline length in pixels and video dot clock to @@ -605,14 +611,6 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, return -EAGAIN; } - /* Don't know yet how to handle interlaced or - * double scan modes. Just no-op for now. - */ - if (mode->flags & (DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLSCAN)) { - DRM_DEBUG("crtc %d: Noop due to unsupported mode.\n", crtc); - return -ENOTSUPP; - } - /* Get current scanout position with system timestamp. * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times * if single query takes longer than max_error nanoseconds.