[PATCH i-g-t 5/5] lib/igt_fb: Support fbs backed by local memory

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri Aug 6 11:13:32 UTC 2021


From: Ramalingam C <ramalingam.c at intel.com>

When local memory is supported, buffer object, backing the framebuffer
should be allocated from local memory.

Dumb buffer allocation takes care of this requirement from kernel
itself. So when we allocate BO through gem_create we make sure that
BO is from local memory.

v2:
  type is moved into i915 block [Januaz, Ashutosh]

v3: Update on gem_create_in_region() removal (Zbigniew)

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
Reviewed-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
---
 lib/igt_fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index c7dcadcf..1eb531ee 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -49,6 +49,7 @@
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
 #include "intel_bufops.h"
+#include "i915/intel_memory_region.h"
 
 /**
  * SECTION:igt_fb
@@ -1086,9 +1087,10 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
 		fb->is_dumb = false;
 
 		if (is_i915_device(fd)) {
+			uint32_t region = gem_has_lmem(fd) ? REGION_LMEM(0) : REGION_SMEM;
 			int err;
 
-			fb->gem_handle = gem_create(fd, fb->size);
+			fb->gem_handle = gem_create_in_memory_regions(fd, fb->size, region);
 			err = __gem_set_tiling(fd, fb->gem_handle,
 					       igt_fb_mod_to_tiling(fb->modifier),
 					       fb->strides[0]);
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list