From patchwork Tue Jul 28 13:13:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 6884491 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3976CC05AC for ; Tue, 28 Jul 2015 13:13:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 185FC206A7 for ; Tue, 28 Jul 2015 13:13:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E4F8720674 for ; Tue, 28 Jul 2015 13:13:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6D036E584; Tue, 28 Jul 2015 06:13:45 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BCF36E584 for ; Tue, 28 Jul 2015 06:13:44 -0700 (PDT) Received: by pachj5 with SMTP id hj5so69802254pac.3 for ; Tue, 28 Jul 2015 06:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:in-reply-to:references:content-type :mime-version:content-transfer-encoding; bh=QwlJAQQcUVfFDrOosES6UxoFEGjNGzyg8Y2nN34EMlc=; b=hc7jS+PFbIu7bxW2cqb2YAc0O6nxXnqzFOevx+nMM3ilySMMpnnAUlQfSsjKfnkg0A 4RRRbWRuREJTZ/MiltXm8kBqR9V7Tbl8IrPnGPs3p+hbKlKAEk4FhkVQwQG3qSddN9X1 PDtmx9GBgGYqckyaUrZ9zHgdPJXSDCROeRb3LeMFIlf0ujZ78s7/qysQR5mpaHcx9tYU TpI4/fKwrTeNnW/tk52iEelbn7FjevhpF+OJ+i3BGftf0W5MTy4ddHBBvdwrCxLV/iSC 2fOodVLVd/wslvyU5tjgI64K2V3wDgdYc9ysSNOGcC9TARxxjpUM0JLz1Q8TzBZRB6SW AHjQ== X-Received: by 10.66.253.72 with SMTP id zy8mr82200926pac.102.1438089223566; Tue, 28 Jul 2015 06:13:43 -0700 (PDT) Received: from aconselv-mobl3.fi.intel.com ([134.134.139.76]) by smtp.googlemail.com with ESMTPSA id uk6sm35458613pac.27.2015.07.28.06.13.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jul 2015 06:13:42 -0700 (PDT) Message-ID: <1438089223.2727.17.camel@gmail.com> From: Ander Conselvan De Oliveira To: Maarten Lankhorst , intel-gfx@lists.freedesktop.org Date: Tue, 28 Jul 2015 16:13:43 +0300 In-Reply-To: <1438000541-3219-4-git-send-email-maarten.lankhorst@linux.intel.com> References: <1438000541-3219-1-git-send-email-maarten.lankhorst@linux.intel.com> <1438000541-3219-4-git-send-email-maarten.lankhorst@linux.intel.com> X-Mailer: Evolution 3.16.3 (3.16.3-2.fc22) Mime-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH v2 03/12] drm/i915: Convert connector checking to atomic. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 On Mon, 2015-07-27 at 14:35 +0200, Maarten Lankhorst wrote: Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/i915/intel_crt.c | 2 - drivers/gpu/drm/i915/intel_display.c | 79 ++++++++++++++++-------------------- drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_dvo.c | 2 - drivers/gpu/drm/i915/intel_sdvo.c | 2 - 5 files changed, 36 insertions(+), 50 deletions(-) the checks aren't necessary anymore because intel_crtc_control() is atomic, and that already performs a check. But if that's right this should be a separate patch. Or did I miss something? Ander > return 0; } diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 5d78c1feec81..9eba3dd5b434 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c @@ -280,8 +280,6 @@ static int intel_crt_dpms(struct drm_connector *connector, int mode) intel_crtc_update_dpms(crtc); } - intel_modeset_check_state(connector->dev); - return 0; } diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3ab0a8a8e702..ba0b68a4209d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6360,42 +6360,33 @@ static void intel_encoder_dpms(struct intel_encoder *encoder, int mode) * internal consistency). */ static void intel_connector_check_state(struct intel_connector *connector) { + struct drm_crtc *crtc = connector->base.state->crtc; + + DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", + connector->base.base.id, + connector->base.name); + if (connector->get_hw_state(connector)) { - struct intel_encoder *encoder = connector->encoder; - struct drm_crtc *crtc; - bool encoder_enabled; - enum pipe pipe; + struct drm_encoder *encoder = &connector->encoder->base; + struct drm_connector_state *conn_state = connector->base.state; - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", - connector->base.base.id, - connector->base.name); + I915_STATE_WARN(!crtc, + "connector enabled without attached crtc\n"); - /* there is no real hw state for MST connectors */ - if (connector->mst_port) Should the above deletion be part of the previous patch? > + if (!crtc) return; - I915_STATE_WARN(connector->base.dpms == DRM_MODE_DPMS_OFF, - "wrong connector dpms state\n"); - I915_STATE_WARN(connector->base.encoder != &encoder->base, - "active connector not linked to encoder\n"); + I915_STATE_WARN(!crtc->state->active, + "connector is active, but attached crtc isn't\n"); - if (encoder) { - I915_STATE_WARN(!encoder->connectors_active, - "encoder->connectors_active not set\n"); The converted version doesn't check connectors_active. I see it is later removed in the patch series, so I assume it is left out on purpose, but I think this is worth mentioning in the commit message. > - - encoder_enabled = encoder->get_hw_state(encoder, &pipe); - I915_STATE_WARN(!encoder_enabled, "encoder not enabled\n"); - if (I915_STATE_WARN_ON(!encoder->base.crtc)) - return; These are also left out. It looks like check_encoder_state() performs the same check, but I think the commit message should mention this if that's the case. > + I915_STATE_WARN(conn_state->best_encoder != encoder, + "atomic encoder doesn't match attached encoder\n"); - crtc = encoder->base.crtc; - - I915_STATE_WARN(!crtc->state->enable, - "crtc not enabled\n"); - I915_STATE_WARN(!to_intel_crtc(crtc)->active, "crtc not active\n"); - I915_STATE_WARN(pipe != to_intel_crtc(crtc)->pipe, - "encoder active on the wrong pipe\n"); - } + I915_STATE_WARN(conn_state->crtc != encoder->crtc, + "attached encoder crtc differs from connector crtc\n"); + } else { + I915_STATE_WARN(!crtc && connector->base.state->best_encoder, + "best encoder set without crtc!\n"); } } @@ -6444,8 +6435,6 @@ int intel_connector_dpms(struct drm_connector *connector, int mode) if (connector->encoder) intel_encoder_dpms(to_intel_encoder(connector->encoder), mode); - intel_modeset_check_state(connector->dev); - return 0; } @@ -12705,20 +12694,22 @@ static void check_wm_state(struct drm_device *dev) } static void -check_connector_state(struct drm_device *dev) +check_connector_state(struct drm_device *dev, struct drm_atomic_state *state) This is called after a state swap, so I think the state variable should be called old_state for clarity. > { - struct intel_connector *connector; + struct drm_connector_state *conn_state; + struct drm_connector *connector; + int i; - for_each_intel_connector(dev, connector) { - struct drm_encoder *encoder = connector->base.encoder; - struct drm_connector_state *state = connector->base.state; + for_each_connector_in_state(state, connector, conn_state, i) { + struct drm_encoder *encoder = connector->encoder; + struct drm_connector_state *state = connector->state; /* This also checks the encoder/connector hw state with the * ->get_hw_state callbacks. */ - intel_connector_check_state(connector); + intel_connector_check_state(to_intel_connector(connector)); I915_STATE_WARN(state->best_encoder != encoder, - "connector's staged encoder doesn't match current encoder\n"); + "connector's atomic encoder doesn't match legacy encoder\n"); } } @@ -12904,11 +12895,12 @@ check_shared_dpll_state(struct drm_device *dev) } } -void -intel_modeset_check_state(struct drm_device *dev) +static void +intel_modeset_check_state(struct drm_device *dev, + struct drm_atomic_state *state) old_state here too. > { check_wm_state(dev); - check_connector_state(dev); + check_connector_state(dev, state); check_encoder_state(dev); check_crtc_state(dev); check_shared_dpll_state(dev); @@ -13294,10 +13286,11 @@ static int intel_atomic_commit(struct drm_device *dev, drm_atomic_helper_wait_for_vblanks(dev, state); drm_atomic_helper_cleanup_planes(dev, state); - drm_atomic_state_free(state); if (any_ms) - intel_modeset_check_state(dev); + intel_modeset_check_state(dev, state); + + drm_atomic_state_free(state); return 0; } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 320c9e6bd848..0da4236dc85a 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -999,7 +999,6 @@ int intel_connector_init(struct intel_connector *); struct intel_connector *intel_connector_alloc(void); int intel_connector_dpms(struct drm_connector *, int mode); bool intel_connector_get_hw_state(struct intel_connector *connector); -void intel_modeset_check_state(struct drm_device *dev); bool ibx_digital_port_connected(struct drm_i915_private *dev_priv, struct intel_digital_port *port); void intel_connector_attach_encoder(struct intel_connector *connector, diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index fd5e522abebb..600f7fb855d8 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c @@ -237,8 +237,6 @@ static int intel_dvo_dpms(struct drm_connector *connector, int mode) intel_crtc_update_dpms(crtc); } - intel_modeset_check_state(connector->dev); - return 0; } diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 2c435a79d4da..8911e0e417ee 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -1550,8 +1550,6 @@ static int intel_sdvo_dpms(struct drm_connector *connector, int mode) intel_sdvo_set_active_outputs(intel_sdvo, intel_sdvo->attached_output); } - intel_modeset_check_state(connector->dev); - How does removing the checks from the _dpms() functions relate to converting the connector checking to atomic? If I understood correctly,