From patchwork Sat May 24 18:30:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 4237981 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CEF62BF90B for ; Sat, 24 May 2014 18:31:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA99B2024D for ; Sat, 24 May 2014 18:31:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9CA3920225 for ; Sat, 24 May 2014 18:31:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC1C56E45E; Sat, 24 May 2014 11:31:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f179.google.com (mail-qc0-f179.google.com [209.85.216.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 49D1F6E486 for ; Sat, 24 May 2014 11:31:20 -0700 (PDT) Received: by mail-qc0-f179.google.com with SMTP id r5so1597151qcx.38 for ; Sat, 24 May 2014 11:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nM7162eM3YMJbwn0GyP2Q2dY6nWiMTqHf0zsx81jA3Q=; b=qK1Yd+9RB6RAYaEZ+yZXRM53+PM/99H0uRq+PA5PaSEn7zDOZ1ogGgsATW6tNhR3ho A5ZCsYE15govlaOgohZCSZ2pwp+qvPfQ1phQTryP++tGESgj0meCzIynszXiaryUm3bm zstz2SD0oxPJPKVy/3yJ04PyOFZTnckd2ISMzohAa7TxmJJpqIvdrqBQAOHOOeg0o3D6 0BSrz8WYO/VCnpXqZ9hbRmsd6Sx6D8IhEoJ3Awl+6vJybzZKLCR3oxG6ZOP8k1Fj19/P MQ9tjSPOWjy7x0ZP9k1tKigPuSkc7PI6a6YA4AKuBl3YVdkSAFFOoUKnvW6Gj0Al+1hb Gq0A== X-Received: by 10.224.51.72 with SMTP id c8mr18670555qag.82.1400956279921; Sat, 24 May 2014 11:31:19 -0700 (PDT) Received: from localhost (pool-108-20-252-175.bstnma.east.verizon.net. [108.20.252.175]) by mx.google.com with ESMTPSA id j3sm11147547qaf.6.2014.05.24.11.31.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 May 2014 11:31:19 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 17/17] drm: Fix up the atomic legacy paths so they work Date: Sat, 24 May 2014 14:30:26 -0400 Message-Id: <1400956226-28053-18-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1400956226-28053-1-git-send-email-robdclark@gmail.com> References: <1400956226-28053-1-git-send-email-robdclark@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.7 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 From: Sean Paul BUG=chromium:336809 TEST=Tested on snow & peppy Change-Id: Icd864ac52da9c973202f3ac4629824ef5eec2ac9 Signed-off-by: Sean Paul Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_crtc.c | 12 +++++++++--- include/drm/drm_crtc.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 863a0fe..79fbb2c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -613,6 +613,7 @@ swap_crtc_state(struct drm_crtc *crtc, struct drm_atomic_state *a) /* clear transient state (only valid during atomic update): */ cstate->set_config = false; cstate->connectors_change = false; + cstate->commit_state = false; swap(crtc->state, a->cstates[crtc->id]); crtc->base.propvals = &crtc->state->propvals; @@ -687,6 +688,9 @@ commit_crtc_state(struct drm_crtc *crtc, drm_atomic_get_plane_state(crtc->primary, cstate->state); int ret = -EINVAL; + if (!cstate->commit_state) + return 0; + if (cstate->set_config) return set_config(crtc, cstate); diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 4e3b527..03dddbb 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -792,7 +792,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->base.propvals = &crtc->state->propvals; list_add_tail(&crtc->head, &dev->mode_config.crtc_list); - dev->mode_config.num_crtc++; + crtc->id = dev->mode_config.num_crtc++; crtc->primary = primary; if (primary) @@ -910,7 +910,7 @@ static int check_connectors(struct drm_crtc *crtc, if (ocrtc == crtc) continue; - ostate = drm_atomic_get_crtc_state(crtc, state); + ostate = drm_atomic_get_crtc_state(ocrtc, state); if (IS_ERR(ostate)) return PTR_ERR(ostate); @@ -939,7 +939,6 @@ retry: return -EINVAL; } } - return 0; } @@ -961,6 +960,10 @@ int drm_crtc_check_state(struct drm_crtc *crtc, if (!(fb && state->mode_valid)) return 0; + /* We're not committing this state, ignore */ + if (!state->commit_state) + return 0; + hdisplay = state->mode.hdisplay; vdisplay = state->mode.vdisplay; @@ -1034,6 +1037,7 @@ int drm_crtc_set_property(struct drm_crtc *crtc, /* grab primary plane state now, to ensure locks are held, etc. */ drm_atomic_get_plane_state(crtc->primary, state->state); + state->commit_state = true; drm_object_property_set_value(&crtc->base, &state->propvals, property, value, blob_data); @@ -1045,6 +1049,7 @@ int drm_crtc_set_property(struct drm_crtc *crtc, /* check size: */ if (value < sizeof(struct drm_mode_modeinfo)) return -EINVAL; + state->mode = *(struct drm_mode_modeinfo *)blob_data; state->mode_valid = true; } @@ -1538,6 +1543,7 @@ int drm_plane_set_property(struct drm_plane *plane, } else if (property == config->prop_crtc_id) { struct drm_mode_object *obj = drm_property_get_obj(property, value); struct drm_crtc *crtc = obj ? obj_to_crtc(obj) : NULL; + /* take the lock of the incoming crtc as well, moving * plane between crtcs is synchronized on both incoming * and outgoing crtc. diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 2fbf13a..009b76f 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -317,6 +317,7 @@ struct drm_crtc_state { /* transient state, only valid during atomic operation: */ bool set_config : 1; bool connectors_change : 1; + bool commit_state : 1; uint8_t num_connector_ids; uint32_t *connector_ids;