From patchwork Thu Jul 26 18:48:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1244701 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id D5BCFDFFCE for ; Thu, 26 Jul 2012 20:08:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA888A0ECE for ; Thu, 26 Jul 2012 13:08:04 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B95F9E790 for ; Thu, 26 Jul 2012 12:56:20 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id dr1so1724686wgb.12 for ; Thu, 26 Jul 2012 12:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=zFMtxnw36ImgQZb0uft5i5Na2+8KcMxIkeo2VYlnLT4=; b=U+CQoc/xWiyXryZ34lUOxwmDP7X/dU70l8ivfGF5uu7xOW4/nJhKRm+OVMNwwKcG1W Se3JlYgeyxyAghx7aimilWRiJATxirjfAY+rO5Ao/HuNDjiWKP1HGs1juTUrNzSHTjqv Ue/pzLxV2JeHasV+zdvE/I9Nzuoq3DdFKGqgk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=zFMtxnw36ImgQZb0uft5i5Na2+8KcMxIkeo2VYlnLT4=; b=nkHGvh5IoHGiq/mK2ndCOnqrEiAVr8KwMuWZGM5ODVil5qCyl5aoXnRpkRaSJ06nGW lk3qRf+gobHVKBJYQoDajH5pcC+sOz+AZjPAQ1GK3T9nbPCewAKeYhvbJ4PFnRal6STJ y0MtCzXQI2cXevjUF4899a0mS84TZXnvF6Dju7ArTAKl94yxo40WV02WoOPyxXvhHgJA You4kHWPGZXJvh/+/Efap0nfy4gjShu/M6wtXp2uHTBX3F2rn8BtHiYYZ2yA3ZVpxqdY /WM4MgAg4GS2+P//SZWEGaA6iLtnAhUEL3ltoHu5aWgj0LOwqhL/5TPlp4Fr3EUXkOxV p7bg== Received: by 10.180.92.194 with SMTP id co2mr113071wib.12.1343332580174; Thu, 26 Jul 2012 12:56:20 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id fr4sm391403wib.8.2012.07.26.12.56.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 12:56:19 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 26 Jul 2012 20:48:36 +0200 Message-Id: <1343328581-2324-12-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> References: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQn91kgq0eCADXciQxZ1q2C9qiaF6e5rRUhD1GJ063bzdoCBhlpYBaVpaGN21jQJYtvKr17K Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 11/76] drm/i915: add direct encoder disable/enable infrastructure X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Just prep work, not yet put to some use. Note that because we're still using the crtc helper to switch modes (and their complicated way to do partial modesets), we need to call the encoder's disable function unconditionally. But once this is cleaned up we shouldn't call the encoder's disable function unconditionally any more, because then we know that we'll only call it if the encoder is actually enabled. Also note that we then need to be careful about which crtc we're filtering the encoder list on: We want to filter on the crtc of the _current_ mode, not the one we're about to set up. For the enabling side we need to do the same trick. And again, we should be able to simplify this quite a bit when things have settled into place. Also note that this simply does not take cloning into account, so dpms needs to be handled specially for the few outputs where we even bother with it. Signed-Off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 38 ++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 83a1b41..c5adff6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3208,13 +3208,16 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct intel_encoder *encoder; int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; u32 temp; bool is_pch_port; + /* XXX: For compatability with the crtc helper code, call the encoder's + * enable function unconditionally for now. */ if (intel_crtc->active) - return; + goto encoders; intel_crtc->active = true; intel_update_watermarks(dev); @@ -3261,6 +3264,12 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) mutex_unlock(&dev->struct_mutex); intel_crtc_update_cursor(crtc, true); + +encoders: + for_each_encoder_on_crtc(dev, crtc, encoder) { + if (encoder->enable) + encoder->enable(encoder); + } } static void ironlake_crtc_disable(struct drm_crtc *crtc) @@ -3268,10 +3277,18 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct intel_encoder *encoder; int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; u32 reg, temp; + /* XXX: For compatability with the crtc helper code, call the encoder's + * disable function unconditionally for now. */ + for_each_encoder_on_crtc(dev, crtc, encoder) { + if (encoder->disable) + encoder->disable(encoder); + } + if (!intel_crtc->active) return; @@ -3370,11 +3387,14 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc) struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct intel_encoder *encoder; int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; + /* XXX: For compatability with the crtc helper code, call the encoder's + * enable function unconditionally for now. */ if (intel_crtc->active) - return; + goto encoders; intel_crtc->active = true; intel_update_watermarks(dev); @@ -3389,6 +3409,12 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc) /* Give the overlay scaler a chance to enable if it's on this pipe */ intel_crtc_dpms_overlay(intel_crtc, true); intel_crtc_update_cursor(crtc, true); + +encoders: + for_each_encoder_on_crtc(dev, crtc, encoder) { + if (encoder->enable) + encoder->enable(encoder); + } } static void i9xx_crtc_disable(struct drm_crtc *crtc) @@ -3396,9 +3422,17 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct intel_encoder *encoder; int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; + /* XXX: For compatability with the crtc helper code, call the encoder's + * disable function unconditionally for now. */ + for_each_encoder_on_crtc(dev, crtc, encoder) { + if (encoder->disable) + encoder->disable(encoder); + } + if (!intel_crtc->active) return; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 13f0467..7fc63f5 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -140,6 +140,8 @@ struct intel_encoder { */ bool cloneable; void (*hot_plug)(struct intel_encoder *); + void (*enable)(struct intel_encoder *); + void (*disable)(struct intel_encoder *); int crtc_mask; };