[Intel-gfx] [PATCH i-g-t 09/13] lib: Add support for new extension to the ADDFB2 ioctl.

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Mar 3 06:11:02 PST 2015


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

New functionality accessesed via the __kms_addfb wrapper.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 lib/ioctl_wrappers.c | 26 ++++++++++++++++++++++++++
 lib/ioctl_wrappers.h |  9 +++++++++
 2 files changed, 35 insertions(+)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 5cbb873..baebf5c 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1165,3 +1165,29 @@ void igt_require_fb_modifiers(int fd)
 
 	igt_require(has_modifiers);
 }
+
+int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
+		uint32_t stride, uint32_t pixel_format, uint64_t modifier,
+		uint32_t flags, uint32_t *buf_id)
+{
+	struct local_drm_mode_fb_cmd2 f;
+	int ret;
+
+	igt_require_fb_modifiers(fd);
+
+	memset(&f, 0, sizeof(f));
+
+	f.width  = width;
+	f.height = height;
+	f.pixel_format = pixel_format;
+	f.flags = flags;
+	f.handles[0] = handle;
+	f.pitches[0] = stride;
+	f.modifier[0] = modifier;
+
+	ret = drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f);
+
+	*buf_id = f.fb_id;
+
+	return ret < 0 ? -errno : ret;
+}
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 99fc7fd..ced7ef3 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -167,4 +167,13 @@ struct local_drm_mode_fb_cmd2 {
 
 void igt_require_fb_modifiers(int fd);
 
+/**
+ * __kms_addfb:
+ *
+ * Creates a framebuffer object.
+ */
+int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
+		uint32_t stride, uint32_t pixel_format, uint64_t modifier,
+		uint32_t flags, uint32_t *buf_id);
+
 #endif /* IOCTL_WRAPPERS_H */
-- 
2.3.0



More information about the Intel-gfx mailing list