[igt-dev] [PATCH i-g-t v9 2/4] lib/igt_fb: Modify buffer creation

Mika Kahola mika.kahola at intel.com
Thu Nov 12 13:28:35 UTC 2020


Modify buffer creation so the process will be more versatile.
This is change is needed for Clear Color feature.

Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
 lib/igt_fb.c | 20 ++++++++++++++------
 lib/igt_fb.h |  3 +++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 43f8c475..422a9e06 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2141,9 +2141,10 @@ static int yuv_semiplanar_bpp(uint32_t drm_format)
 	}
 }
 
-static struct intel_buf *create_buf(struct fb_blit_upload *blit,
-				   const struct igt_fb *fb,
-				   const char *name)
+struct intel_buf *
+igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
+                        const struct igt_fb *fb,
+                        const char *name)
 {
 	struct intel_buf *buf;
 	uint32_t bo_name, handle, compression;
@@ -2169,10 +2170,10 @@ static struct intel_buf *create_buf(struct fb_blit_upload *blit,
 		compression = I915_COMPRESSION_NONE;
 	}
 
-	bo_name = gem_flink(blit->fd, fb->gem_handle);
-	handle = gem_open(blit->fd, bo_name);
+	bo_name = gem_flink(fd, fb->gem_handle);
+	handle = gem_open(fd, bo_name);
 
-	buf = intel_buf_create_using_handle(blit->bops, handle,
+	buf = intel_buf_create_using_handle(bops, handle,
 					    fb->width, fb->height,
 					    fb->plane_bpp[0], 0,
 					    igt_fb_mod_to_tiling(fb->modifier),
@@ -2213,6 +2214,13 @@ static struct intel_buf *create_buf(struct fb_blit_upload *blit,
 	return buf;
 }
 
+static struct intel_buf *create_buf(struct fb_blit_upload *blit,
+				   const struct igt_fb *fb,
+				   const char *name)
+{
+	return igt_fb_create_intel_buf(blit->fd, blit->bops, fb, name);
+}
+
 static void fini_buf(struct intel_buf *buf)
 {
 	intel_buf_destroy(buf);
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index b36db965..bc5b8fa0 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -39,6 +39,7 @@
 
 #include "igt_color_encoding.h"
 #include "igt_debugfs.h"
+#include "intel_bufops.h"
 
 /*
  * Internal format to denote a buffer compatible with pixman's
@@ -129,6 +130,8 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 			   enum igt_color_range color_range,
 			   struct igt_fb *fb, uint64_t bo_size,
 			   unsigned bo_stride);
+struct intel_buf *igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
+					  const struct igt_fb *fb, const char *name);
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
 			   uint64_t modifier, struct igt_fb *fb);
 unsigned int igt_create_color_fb(int fd, int width, int height,
-- 
2.25.1



More information about the igt-dev mailing list