From patchwork Thu Aug 7 13:09:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4691171 Return-Path: X-Original-To: patchwork-intel-gfx@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 43B4EC0338 for ; Thu, 7 Aug 2014 13:09:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25BEA201DD for ; Thu, 7 Aug 2014 13:09:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4A150201DC for ; Thu, 7 Aug 2014 13:09:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDC6A89FD3; Thu, 7 Aug 2014 06:09:31 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yk0-f175.google.com (mail-yk0-f175.google.com [209.85.160.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 7352E89FD1 for ; Thu, 7 Aug 2014 06:09:30 -0700 (PDT) Received: by mail-yk0-f175.google.com with SMTP id q200so2699181ykb.6 for ; Thu, 07 Aug 2014 06:09:29 -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=V33QAox1mNOjf37bPGWlAnu3dw4C9ZZmaB2vvJ1bbFo=; b=Vg+5fTpfr2DzDqwXqLXpmmFly/IjX+5Bbe+zvCfhAsYwsCtNwz9zIgkJfamcQj3Pah EK8/YY0C4sV/G35mM//CV7K9N4znEnJxUjWxf2oUVk8vjUovY7ricE0jmdXYKh5nRAL0 ILmFKDmHeQTiKcL9xScgaZ+9HwvvP8pvRfWQBOLdb9wx1EUfIJ8Xe9nYgGUP7hkSZgHF df/ljIm/glLyfgCn11o9GcRtJKo/uiLHGdnrI0yjZdgS7bAxEzz6g1V4PldXhDcPqYWy rJK0F0Of5XSE7nJn8HwOEAbBbXBSyvREhpHq0SurfGG2szCWzZQFvEmLe2+yodgLjrq4 f29Q== X-Received: by 10.236.25.105 with SMTP id y69mr4587868yhy.33.1407416969898; Thu, 07 Aug 2014 06:09:29 -0700 (PDT) Received: from localhost.localdomain ([177.156.106.184]) by mx.google.com with ESMTPSA id u23sm7515674yhg.28.2014.08.07.06.09.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Aug 2014 06:09:29 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 7 Aug 2014 10:09:05 -0300 Message-Id: <1407416947-2282-4-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1407416947-2282-1-git-send-email-przanoni@gmail.com> References: <1407416947-2282-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 4/6] igt_kms: document and export igt_get_property() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.8 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: Paulo Zanoni So we can use it on pm_rpm.c. Signed-off-by: Paulo Zanoni --- lib/igt_kms.c | 27 +++++++++++++++++++++------ lib/igt_kms.h | 4 ++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 664b9e8..6cca7e8 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -592,10 +592,25 @@ static void igt_output_refresh(igt_output_t *output) display->pipes_in_use |= 1 << output->config.pipe; } -static bool -get_property(int drm_fd, uint32_t object_id, uint32_t object_type, - const char *name, uint32_t *prop_id /* out */, - uint64_t *value /* out */, drmModePropertyPtr *prop /* out */) +/** + * igt_get_property: + * @drm_fd: drm file descriptor + * @object_id: object whose properties we're going to get + * @object_type: type of obj_id (DRM_MODE_OBJECT_*) + * @name: name of the property we're going to get + * @prop_id: if not NULL, returns the property id + * @value: if not NULL, returns the property value + * @prop: if not NULL, returns the property, and the caller will have to free + * it manually. + * + * Finds a property with the given name on the given object. + * + * Returns: true in case we found something. + */ +bool +igt_get_property(int drm_fd, uint32_t object_id, uint32_t object_type, + const char *name, uint32_t *prop_id /* out */, + uint64_t *value /* out */, drmModePropertyPtr *prop /* out */) { drmModeObjectPropertiesPtr proplist; drmModePropertyPtr _prop; @@ -633,8 +648,8 @@ get_plane_property(int drm_fd, uint32_t plane_id, const char *name, uint32_t *prop_id /* out */, uint64_t *value /* out */, drmModePropertyPtr *prop /* out */) { - return get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE, - name, prop_id, value, prop); + return igt_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE, + name, prop_id, value, prop); } static void diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 08b46ab..f8c500e 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -255,5 +255,9 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe); void igt_enable_connectors(void); void igt_reset_connectors(void); +bool igt_get_property(int drm_fd, uint32_t object_id, uint32_t object_type, + const char *name, uint32_t *prop_id, uint64_t *value, + drmModePropertyPtr *prop); + #endif /* __IGT_KMS_H__ */