[igt-dev] [PATCH i-g-t 6/7] lib/igt_fb: Function to create a bo for passed in igt_fb

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Tue Mar 5 01:47:41 UTC 2019


In order to execute negative tests that validate fb creation, tests need to
be able to call the addfb ioctl themselves so that the arguments can be
manipulated. Add a library function to provide an initialized fb without
registering the fb with the kernel.

Cc: Clinton Taylor <clinton.a.taylor at intel.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_fb.c | 9 +++++++++
 lib/igt_fb.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index db12a30d..b00d839d 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -743,6 +743,15 @@ out:
 	return fb->gem_handle;
 }
 
+void igt_create_bo_for_fb(int fd, int width, int height,
+			  uint32_t format, uint64_t modifier,
+			  struct igt_fb *fb /* out */)
+{
+	fb_init(fb, fd, width, height, format, modifier,
+		IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
+	create_bo_for_fb(fb);
+}
+
 /**
  * igt_create_bo_with_dimensions:
  * @fd: open drm file descriptor
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 24d40b18..7667579b 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -147,6 +147,9 @@ int igt_dirty_fb(int fd, struct igt_fb *fb);
 void *igt_fb_map_buffer(int fd, struct igt_fb *fb);
 void igt_fb_unmap_buffer(struct igt_fb *fb, void *buffer);
 
+void igt_create_bo_for_fb(int fd, int width, int height,
+			  uint32_t format, uint64_t modifier,
+			  struct igt_fb *fb);
 int igt_create_bo_with_dimensions(int fd, int width, int height, uint32_t format,
 				  uint64_t modifier, unsigned stride,
 				  uint64_t *size_ret, unsigned *stride_ret,
-- 
2.17.1



More information about the igt-dev mailing list