Signed-off-by: Lionel Landwerlin <[email protected]>
---
 lib/igt_kms.c | 40 ++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  9 ++++++++-
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index eeed468..1f37489 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1285,6 +1285,16 @@ static igt_plane_t *igt_pipe_get_plane(igt_pipe_t *pipe, 
enum igt_plane plane)
        return &pipe->planes[idx];
 }
 
+bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
+                          uint32_t *prop_id, uint64_t *value,
+                          drmModePropertyPtr *prop)
+{
+       return get_crtc_property(pipe->display->drm_fd,
+                                pipe->crtc_id,
+                                name,
+                                prop_id, value, prop);
+}
+
 static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
 {
        if (plane->fb)
@@ -1924,6 +1934,36 @@ void igt_plane_set_rotation(igt_plane_t *plane, 
igt_rotation_t rotation)
        plane->rotation_changed = true;
 }
 
+int
+igt_pipe_set_blob_property(igt_pipe_t *pipe,
+                          const char *name,
+                          void *data,
+                          size_t length)
+{
+       igt_display_t *display = pipe->display;
+       uint32_t blob_id = 0, prop_id;
+       int ret;
+
+       if (!igt_pipe_get_property(pipe, name, &prop_id, NULL, NULL))
+               return -1;
+
+       if (length > 0) {
+               ret = drmModeCreatePropertyBlob(display->drm_fd,
+                                               data, length, &blob_id);
+               CHECK_RETURN(ret, true);
+       }
+
+       ret = drmModeObjectSetProperty(display->drm_fd, pipe->crtc_id,
+                                      DRM_MODE_OBJECT_CRTC,
+                                      prop_id, blob_id);
+       CHECK_RETURN(ret, true);
+
+       if (blob_id != 0)
+               ret = drmModeDestroyPropertyBlob(display->drm_fd, blob_id);
+
+       return ret;
+}
+
 /**
  * igt_crtc_set_background:
  * @pipe: pipe pointer to which background color to be set
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index c12c2e1..fb8fc8a 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -256,6 +256,14 @@ static inline bool igt_plane_supports_rotation(igt_plane_t 
*plane)
        return plane->rotation_property != 0;
 }
 
+bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name,
+                          uint32_t *prop_id, uint64_t *value,
+                          drmModePropertyPtr *prop);
+#define igt_pipe_has_property(pipe, prop) \
+       igt_pipe_get_property(pipe, prop, NULL, NULL, NULL)
+int igt_pipe_set_blob_property(igt_pipe_t *pipe, const char *name,
+                              void *data, size_t length);
+
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
 void igt_plane_set_position(igt_plane_t *plane, int x, int y);
 void igt_plane_set_size(igt_plane_t *plane, int w, int h);
@@ -291,4 +299,3 @@ const unsigned char* igt_kms_get_alt_edid(void);
 
 
 #endif /* __IGT_KMS_H__ */
-
-- 
2.6.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to