From patchwork Wed Nov 20 20:48:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 3215421 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 ADAC9C045B for ; Wed, 20 Nov 2013 20:48:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8E6220752 for ; Wed, 20 Nov 2013 20:48:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1B7AF2074B for ; Wed, 20 Nov 2013 20:48:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77FBEFD43A; Wed, 20 Nov 2013 12:48:45 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f52.google.com (mail-qa0-f52.google.com [209.85.216.52]) by gabe.freedesktop.org (Postfix) with ESMTP id BF16BFD43A for ; Wed, 20 Nov 2013 12:48:37 -0800 (PST) Received: by mail-qa0-f52.google.com with SMTP id k4so2153234qaq.11 for ; Wed, 20 Nov 2013 12:48:37 -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=524LMyjtwYrmY7O9WM9FOrT5/Q+H7yd5YxxP7XlKiT8=; b=ZC88KJqAimWfxSlDxddR3UME3OfpQZPxjMYh/gNFuUz0oWAWBcihQTpOdOG1R2ny3w pxqVaLGwAkm70mqZSDBN25bti/S1Hn1doe5p1ybUU9S6dX/l9DE/s0Iv9/bzO95SVOrI H0d6DfMPv6NBVHdubvs9Bswa5n1mtdY0z9lVmTlcWDy5Grx2PGA9riuh0PTTmyyaU8Lf WuLPdRqJOQlpvZSTqiPJHOx8CLWu0ws1ojWH1aqnRc8/4DFSvvyp6t8dBi1RJAK0cR0z qMXW9X9qoj60ie6Ngxutc1gcBMvdIMjGwbXzPcFls7KIijLddH3c0B68DSMw12E9GIWe e+TQ== X-Received: by 10.49.73.135 with SMTP id l7mr5235534qev.28.1384980517287; Wed, 20 Nov 2013 12:48:37 -0800 (PST) Received: from localhost (pool-108-20-250-166.bstnma.east.verizon.net. [108.20.250.166]) by mx.google.com with ESMTPSA id k11sm25716826qab.3.2013.11.20.12.48.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2013 12:48:36 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RFCv3 06/14] drm: helpers to find mode objects Date: Wed, 20 Nov 2013 15:48:05 -0500 Message-Id: <1384980493-25499-7-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1384980493-25499-1-git-send-email-robdclark@gmail.com> References: <1384980493-25499-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@lists.freedesktop.org Errors-To: dri-devel-bounces@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 Add a few more useful helpers to find mode objects. --- include/drm/drm_crtc.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index a9b9977..d3abc9c 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1170,6 +1170,15 @@ extern int drm_format_vert_chroma_subsampling(uint32_t format); extern const char *drm_get_format_name(uint32_t format); /* Helpers */ + +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) { @@ -1186,4 +1195,20 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, 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; +} + #endif /* __DRM_CRTC_H__ */