From patchwork Sun Oct 6 00:45:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 2992111 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 33D3C9F169 for ; Sun, 6 Oct 2013 00:51:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58DC020255 for ; Sun, 6 Oct 2013 00:51:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7998120254 for ; Sun, 6 Oct 2013 00:51:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63153E5F05 for ; Sat, 5 Oct 2013 17:51:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f43.google.com (mail-qe0-f43.google.com [209.85.128.43]) by gabe.freedesktop.org (Postfix) with ESMTP id DD0BEE5EB4 for ; Sat, 5 Oct 2013 17:46:15 -0700 (PDT) Received: by mail-qe0-f43.google.com with SMTP id gh4so4135994qeb.16 for ; Sat, 05 Oct 2013 17:46:15 -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=UDVoPy1TmKDKh/jm+8oHpxwrW8GZdN9XZD6XSvLhpQ8=; b=cgifAIx9BamjlJs+Z8gacqadwoLYeULzA0e2uNs0oKU/sM+gA3noqsmIIOvrwTJHG+ qYza+S2qRCeaPOi85woHv6+5qcLINsjK4C7c7KIzGkKSOe6HjaKlehe6rESbKvFIhUhk wueRvPrlFuG8rg/YpOc/ETv3EZpjbbAYHbkerAoI7ssLIgr/bsoQoX+a0ZDkU4reNtBT kekW4sJu2QhSqGNer/2nB65kaICfPkj44fERlZSAuAVbTJFdK9WE6g9Un9SeSPv2s9Ha YpXkLquQ8w+vDhZrz1nJzoM93uhJo9N8Coc/GtP4Ig5XabvD1E+WyCvbaZsr21Xqxhc3 NHsA== X-Received: by 10.49.0.198 with SMTP id 6mr27739335qeg.48.1381020375506; Sat, 05 Oct 2013 17:46:15 -0700 (PDT) Received: from localhost (pool-108-20-247-120.bstnma.east.verizon.net. [108.20.247.120]) by mx.google.com with ESMTPSA id 5sm45644076qao.3.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Oct 2013 17:46:14 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RFCv1 05/12] drm: helpers to find mode objects (BEFORE drm: split property values out) Date: Sat, 5 Oct 2013 20:45:43 -0400 Message-Id: <1381020350-1125-6-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1381020350-1125-1-git-send-email-robdclark@gmail.com> References: <1381020350-1125-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.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 --- 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);