[Intel-gfx] [PATCH 4/6] igt_kms: document and export igt_get_property()

2014-08-07 Thread Paulo Zanoni
From: Paulo Zanoni paulo.r.zan...@intel.com

So we can use it on pm_rpm.c.

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
---
 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__ */
 
-- 
2.0.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 4/6] igt_kms: document and export igt_get_property()

2014-08-07 Thread Daniel Vetter
On Thu, Aug 07, 2014 at 10:09:05AM -0300, Paulo Zanoni wrote:
 From: Paulo Zanoni paulo.r.zan...@intel.com
 
 So we can use it on pm_rpm.c.
 
 Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com

The idea behind the igt_kms_ and kmstest_ prefix split is that kmstests_
are the lower-level helpers wrapping around just the libdrm interfaces
(simalar to the piles of ioctl wrappers we have) and igt_kms_ provides
higher-level code on top.

So I think for this we should use kmstest_ as the prefix.
-Daniel

 ---
  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__ */
  
 -- 
 2.0.1
 
 ___
 Intel-gfx mailing list
 Intel-gfx@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx