From patchwork Mon Oct 14 17:26:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 3038031 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 40F89BF924 for ; Mon, 14 Oct 2013 17:41:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B4A92020A for ; Mon, 14 Oct 2013 17:41:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 30BCC2012B for ; Mon, 14 Oct 2013 17:41:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F4205E6679 for ; Mon, 14 Oct 2013 10:41:40 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f41.google.com (mail-qe0-f41.google.com [209.85.128.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 72591E7180 for ; Mon, 14 Oct 2013 10:27:09 -0700 (PDT) Received: by mail-qe0-f41.google.com with SMTP id x7so4173301qeu.14 for ; Mon, 14 Oct 2013 10:27:09 -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=rBcVALYtjON7ohGtyihvWuVh/SDfUsEb7mJk2AA/QjA=; b=Z6/I6tOmWW0Cn9RLGG11tHDCXmyPSj6HbdT1UocqXvCWWRFEB6aGPAXMpm9mnmPvDS 6iUhNmgmjh2PjEIeVXCGJvQ4mIhq1G+RQ1she2GhTVW67su44rBbP3ow/5+PXPcAiOKY vfp826pQd1AvM96UZwTpbqXJrRBXkO0l4uoA0wYn6d2/K0zfMrDtlrEQ3irricmDfNwp xI+sT1hPzaPnXdSJCnGzKe5Dvx9H4UUSkxvsnE15fZ8QG56hw0qBEC+zYVp9yh42Z5dC g5mbuw6oryFjELWzNUEpjC6XDxB8LXWjANSgdtiCin3ik6kAh8x3zm1iIAJcjePh9Dfb ibxQ== X-Received: by 10.49.97.6 with SMTP id dw6mr28678889qeb.47.1381771629046; Mon, 14 Oct 2013 10:27:09 -0700 (PDT) Received: from localhost (nat-pool-bos-t.redhat.com. [66.187.233.206]) by mx.google.com with ESMTPSA id a5sm17637394qae.2.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Oct 2013 10:27:08 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RFCv2 06/13] drm: helpers to find mode objects Date: Mon, 14 Oct 2013 13:26:41 -0400 Message-Id: <1381771608-15237-7-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1381771608-15237-1-git-send-email-robdclark@gmail.com> References: <1381771608-15237-1-git-send-email-robdclark@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.6 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 Lifted from Russell King's armada drm driver, plus a couple others added. --- include/drm/drm_crtc.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index e042d12..0ea61b3 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1067,6 +1067,46 @@ drm_property_get_obj(struct drm_property *property, uint64_t value) return drm_mode_object_find(property->dev, value, property->values[0]); } +static inline struct drm_plane *drm_plane_find(struct drm_device *dev, + uint32_t id) +{ + struct drm_mode_object *mo; + mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE); + return mo ? obj_to_plane(mo) : NULL; +} + +static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, + uint32_t id) +{ + struct drm_mode_object *mo; + mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC); + return mo ? obj_to_crtc(mo) : NULL; +} + +static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, + uint32_t id) +{ + struct drm_mode_object *mo; + mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER); + return mo ? obj_to_encoder(mo) : NULL; +} + +static inline struct drm_connector *drm_connector_find(struct drm_device *dev, + uint32_t id) +{ + struct drm_mode_object *mo; + mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR); + return mo ? obj_to_connector(mo) : NULL; +} + +static inline struct drm_property_blob * +drm_property_blob_find(struct drm_device *dev, uint32_t id) +{ + struct drm_mode_object *mo; + mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB); + return mo ? obj_to_blob(mo) : NULL; +} + /* IOCTLs */ extern int drm_mode_getresources(struct drm_device *dev, void *data, struct drm_file *file_priv);