From patchwork Tue Nov 18 02:10:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 5325221 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DFE8E9F4D4 for ; Tue, 18 Nov 2014 02:11:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1264120107 for ; Tue, 18 Nov 2014 02:11:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 329FE20160 for ; Tue, 18 Nov 2014 02:11:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBAAA6E275; Mon, 17 Nov 2014 18:11:48 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 88D3C6E270; Mon, 17 Nov 2014 18:11:47 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 17 Nov 2014 18:09:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,407,1413270000"; d="scan'208";a="638666651" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga002.jf.intel.com with ESMTP; 17 Nov 2014 18:11:47 -0800 Received: from mattrope by mdroper-hswdev with local (Exim 4.82) (envelope-from ) id 1XqYGg-0007to-RA; Mon, 17 Nov 2014 18:11:46 -0800 From: Matt Roper To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/5] drm: Refactor mode stereo doubling into its own function Date: Mon, 17 Nov 2014 18:10:35 -0800 Message-Id: <1416276639-30297-2-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1416276639-30297-1-git-send-email-matthew.d.roper@intel.com> References: <1416276639-30297-1-git-send-email-matthew.d.roper@intel.com> MIME-Version: 1.0 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are places where we want to perform vertical doubling for stereo modes without the other adjustments (doublescan, vscan > 1, etc.) that drm_mode_set_crtcinfo() performs. Refactor this logic into its own function so that it can be called directly in such places. Cc: dri-devel@lists.freedesktop.org Suggested-by: Ville Syrjälä Signed-off-by: Matt Roper --- drivers/gpu/drm/drm_modes.c | 39 ++++++++++++++++++++++++++------------- include/drm/drm_modes.h | 1 + 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 6d8b941..8c25de3 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -728,6 +728,30 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode) EXPORT_SYMBOL(drm_mode_vrefresh); /** + * drm_mode_stereo_double - Adjust mode timings for stereo modes + * @p: mode to adjust vertical timings of + * + * Performs stereo doubling of mode parameters when required by the stereo + * layout. This may be used directly in places where the additional + * adjustments of drm_mode_set_crtcinfo() are undesired. + */ +void drm_mode_stereo_double(struct drm_display_mode *p) +{ + unsigned int layout = p->flags & DRM_MODE_FLAG_3D_MASK; + + switch (layout) { + case DRM_MODE_FLAG_3D_FRAME_PACKING: + p->crtc_clock *= 2; + p->crtc_vdisplay += p->crtc_vtotal; + p->crtc_vsync_start += p->crtc_vtotal; + p->crtc_vsync_end += p->crtc_vtotal; + p->crtc_vtotal += p->crtc_vtotal; + break; + } +} +EXPORT_SYMBOL(drm_mode_stereo_double); + +/** * drm_mode_set_crtcinfo - set CRTC modesetting timing parameters * @p: mode * @adjust_flags: a combination of adjustment flags @@ -779,19 +803,8 @@ void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags) p->crtc_vtotal *= p->vscan; } - if (adjust_flags & CRTC_STEREO_DOUBLE) { - unsigned int layout = p->flags & DRM_MODE_FLAG_3D_MASK; - - switch (layout) { - case DRM_MODE_FLAG_3D_FRAME_PACKING: - p->crtc_clock *= 2; - p->crtc_vdisplay += p->crtc_vtotal; - p->crtc_vsync_start += p->crtc_vtotal; - p->crtc_vsync_end += p->crtc_vtotal; - p->crtc_vtotal += p->crtc_vtotal; - break; - } - } + if (adjust_flags & CRTC_STEREO_DOUBLE) + drm_mode_stereo_double(p); p->crtc_vblank_start = min(p->crtc_vsync_start, p->crtc_vdisplay); p->crtc_vblank_end = max(p->crtc_vsync_end, p->crtc_vtotal); diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index 91d0582..2b3d05e 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -205,6 +205,7 @@ void drm_mode_set_name(struct drm_display_mode *mode); int drm_mode_hsync(const struct drm_display_mode *mode); int drm_mode_vrefresh(const struct drm_display_mode *mode); +void drm_mode_stereo_double(struct drm_display_mode *p); void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags); void drm_mode_copy(struct drm_display_mode *dst,