From patchwork Thu Aug 7 13:09:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4691151 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 61721C0338 for ; Thu, 7 Aug 2014 13:09:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DDE6201DD for ; Thu, 7 Aug 2014 13:09:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 74CB6201ED for ; Thu, 7 Aug 2014 13:09:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC51489FAC; Thu, 7 Aug 2014 06:09:29 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yk0-f174.google.com (mail-yk0-f174.google.com [209.85.160.174]) by gabe.freedesktop.org (Postfix) with ESMTP id CF84989FAC for ; Thu, 7 Aug 2014 06:09:27 -0700 (PDT) Received: by mail-yk0-f174.google.com with SMTP id q9so2704386ykb.33 for ; Thu, 07 Aug 2014 06:09:27 -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=8gtoFEkyCKbNU3iSm/J7YR1PC4+aXE1G3syJ+UuxhA4=; b=PHO/s6rknYw+XoZctLfg+zkOKINe6ZEhZKm6IeX3tmILC81sII7If7EMuj5pQSfpKg NaqVXlcoz4qXC1BVxGvc+Ng2jSwRJvkwWjJu+Wwo8Sb6kc5uBiQjzM4PMPbbl3b0XsZF Z2D8ioAC/2AW1ykxzmhfJMpwjnFqNV7dNo8+bhoETjVo8OXJwUei5aWFaL8GlBEAMXxa w1CCn9q9lH64TYeRmCugIRC7/1ILsye3bRxkjIjjCPzNSrraIQq7EMNn/rzt/njCqsHO bhYhX08ccndPDyh6wWTvADHfzlg3zfQv3wUYPPUk/1U9gWowoPQJtGaoAvGRsY1b+woz UroQ== X-Received: by 10.236.18.195 with SMTP id l43mr4599593yhl.150.1407416967415; Thu, 07 Aug 2014 06:09:27 -0700 (PDT) Received: from localhost.localdomain ([177.156.106.184]) by mx.google.com with ESMTPSA id u23sm7515674yhg.28.2014.08.07.06.09.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Aug 2014 06:09:27 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 7 Aug 2014 10:09:03 -0300 Message-Id: <1407416947-2282-2-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 2/6] igt_kms: pass drm_fd instead of igt_display_t on some functions 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 Since these functions only really use the drm_fd. The goal is to be able to reuse these functions on programs that don't use the igt_display_t structure. Signed-off-by: Paulo Zanoni --- lib/igt_kms.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 8ab729b..5dd67fe 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -593,20 +593,19 @@ static void igt_output_refresh(igt_output_t *output) } static bool -get_property(igt_display_t *display, - uint32_t object_id, uint32_t object_type, const char *name, - uint32_t *prop_id /* out */, uint64_t *value /* out */) +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 */) { drmModeObjectPropertiesPtr proplist; drmModePropertyPtr prop = NULL; bool found = false; int i; - proplist = drmModeObjectGetProperties(display->drm_fd, - object_id, object_type); + proplist = drmModeObjectGetProperties(drm_fd, object_id, object_type); for (i = 0; i < proplist->count_props; i++) { drmModeFreeProperty(prop); - prop = drmModeGetProperty(display->drm_fd, proplist->props[i]); + prop = drmModeGetProperty(drm_fd, proplist->props[i]); if (!prop) continue; @@ -627,10 +626,10 @@ out: } static bool -get_plane_property(igt_display_t *display, uint32_t plane_id, const char *name, +get_plane_property(int drm_fd, uint32_t plane_id, const char *name, uint32_t *prop_id /* out */, uint64_t *value /* out */) { - return get_property(display, plane_id, DRM_MODE_OBJECT_PLANE, + return get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE, name, prop_id, value); } @@ -649,12 +648,12 @@ igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value) * find a type property, then the kernel doesn't support universal * planes and we know the plane is an overlay/sprite. */ -static int get_drm_plane_type(igt_display_t *display, uint32_t plane_id) +static int get_drm_plane_type(int drm_fd, uint32_t plane_id) { uint64_t value; bool has_prop; - has_prop = get_plane_property(display, plane_id, "type", + has_prop = get_plane_property(drm_fd, plane_id, "type", NULL /* prop_id */, &value); if (has_prop) return (int)value; @@ -710,7 +709,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) continue; } - type = get_drm_plane_type(display, + type = get_drm_plane_type(display->drm_fd, plane_resources->planes[j]); switch (type) { case DRM_PLANE_TYPE_PRIMARY: @@ -741,7 +740,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane->pipe = pipe; plane->drm_plane = drm_plane; - get_plane_property(display, drm_plane->plane_id, + get_plane_property(display->drm_fd, drm_plane->plane_id, "rotation", &plane->rotation_property, &prop_value);