public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 2/6] igt_kms: pass drm_fd instead of igt_display_t on some functions
Date: Thu,  7 Aug 2014 10:09:03 -0300	[thread overview]
Message-ID: <1407416947-2282-2-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1407416947-2282-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

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 <paulo.r.zanoni@intel.com>
---
 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);
-- 
2.0.1

  reply	other threads:[~2014-08-07 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07 13:09 [PATCH 1/6] igt_kms: don't get drmModeRes just to free it later Paulo Zanoni
2014-08-07 13:09 ` Paulo Zanoni [this message]
2014-08-07 13:09 ` [PATCH 3/6] igt_kms: optionally return the property from get_property Paulo Zanoni
2014-08-07 13:09 ` [PATCH 4/6] igt_kms: document and export igt_get_property() Paulo Zanoni
2014-08-07 14:43   ` Daniel Vetter
2014-08-07 13:09 ` [PATCH 5/6] tests/pm_rpm: use igt_get_property() Paulo Zanoni
2014-08-07 13:09 ` [PATCH 6/6] igt_kms: add igt_unset_all_crtcs() Paulo Zanoni
2014-08-07 14:45   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407416947-2282-2-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox