From patchwork Fri Nov 21 20:28:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5357971 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 E63389F1E1 for ; Fri, 21 Nov 2014 20:28:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1836A201E4 for ; Fri, 21 Nov 2014 20:28:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AF34120127 for ; Fri, 21 Nov 2014 20:28:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC2646F4E8; Fri, 21 Nov 2014 12:28:42 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f50.google.com (mail-qa0-f50.google.com [209.85.216.50]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FE4D6F4E8 for ; Fri, 21 Nov 2014 12:28:41 -0800 (PST) Received: by mail-qa0-f50.google.com with SMTP id w8so4031375qac.9 for ; Fri, 21 Nov 2014 12:28:40 -0800 (PST) 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=yx0AL1YdO6RbRJuWKkA2jM6640Fda7XwrHEmH8TjA9Q=; b=oB+7VjWt2vlXoIwGsdwoPwBCeSQ/oj4DctAU68/q1A4KLuLaySfqomkyfuQgN2UDYS qMFO4mKHPdBGEj8fo1S6j6Br0cZdrTRRAkOxRkz/Pp9TikD0J2+zHD9KODY4pq4WRbw3 iPZflszaOExHpcw33BrmG/3vQxNuOaGBeqiuKepM2N4v3862Y/8R5UGr/rFoGwnqFJwj 6NbhNZy3trbNPxH7GvuIInd0pqNRs7zl3tjKOIJUTXgGPGw4d9jqZDOCasIcKViwarGx ejX6uZRbeBf0dtbhD31s2ySu1Wduw5vYxqu3XVCvNlsQdynE+3ZzoNh86cB136M/Mpaw PU5Q== X-Received: by 10.140.39.201 with SMTP id v67mr8916812qgv.45.1416601720698; Fri, 21 Nov 2014 12:28:40 -0800 (PST) Received: from localhost ([2601:6:2c00:943:2677:3ff:fed3:ff40]) by mx.google.com with ESMTPSA id v11sm4649019qay.32.2014.11.21.12.28.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Nov 2014 12:28:39 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/atomic: add plane iterator macros Date: Fri, 21 Nov 2014 15:28:32 -0500 Message-Id: <1416601712-25036-2-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1416601712-25036-1-git-send-email-robdclark@gmail.com> References: <1416601712-25036-1-git-send-email-robdclark@gmail.com> 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 Add helper macros to iterate the current, or incoming set of planes attached to a crtc. These helpers are only available for drivers converted to use atomic-helpers. Signed-off-by: Rob Clark --- Documentation/DocBook/drm.tmpl | 1 + include/drm/drm_atomic_helper.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 8c54f9a..3789f2d 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2343,6 +2343,7 @@ void intel_crt_init(struct drm_device *dev) Atomic State Reset and Initialization !Pdrivers/gpu/drm/drm_atomic_helper.c atomic state reset and initialization +!Iinclude/drm/drm_atomic_helper.h !Edrivers/gpu/drm/drm_atomic_helper.c diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 64b4e91..42d56e6 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -96,5 +96,31 @@ drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector); void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, struct drm_connector_state *state); +/** + * drm_crtc_for_each_plane - iterate over planes currently attached to crtc + * @plane: the loop cursor + * @crtc: the crtc whose planes are iterated + * + * This iterates over the current state, useful (for example) when applying + * atomic state after it has been checked and swapped. To iterate over the + * planes which *will* be attached (for ->atomic_check()) see + * drm_crtc_for_each_pending_plane() + */ +#define drm_crtc_for_each_plane(plane, crtc) \ + list_for_each_entry((plane), &(crtc)->dev->mode_config.plane_list, head) \ + if ((crtc)->state->plane_mask & (1 << drm_plane_index(plane))) + +/** + * drm_crtc_for_each_pending_plane - iterate over attached planes in new state + * @plane: the loop cursor + * @crtc_state: the incoming crtc-state + * + * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be + * attached if the specified state is applied. Useful during (for example) + * ->atomic_check() operations, to validate the incoming state + */ +#define drm_crtc_for_each_pending_plane(plane, crtc_state) \ + list_for_each_entry((plane), &(crtc_state)->state->dev->mode_config.plane_list, head) \ + if ((crtc_state)->plane_mask & (1 << drm_plane_index(plane))) #endif /* DRM_ATOMIC_HELPER_H_ */