[PATCH i-g-t v2] tests/intel/kms_big_fb: Fix width calculation while creating the intel buf

Vinod Govindapillai vinod.govindapillai at intel.com
Fri May 10 11:26:50 UTC 2024


From: Bhanuprakash Modem <bhanuprakash.modem at intel.com>

This commit partially reverts bfa3db0cd9e9a - restores the changes done
to the width calculation.

v2: Add patch decription (Kamil / JP)

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Signed-off-by: Vinod Govindapillai <vinod.govindapillai at intel.com>
---
 lib/igt_draw.c           | 2 +-
 tests/intel/kms_big_fb.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index 2c01d7b02..97a7e6b37 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -650,7 +650,7 @@ static struct intel_buf *create_buf(int fd, struct buf_ops *bops,
 	uint64_t region = driver == INTEL_DRIVER_XE ? vram_if_possible(fd, 0) : -1;
 	uint64_t size = from->size;
 
-	width = from->width;
+	width = from->stride / (from->bpp / 8);
 	height = from->height;
 	if (driver == INTEL_DRIVER_XE)
 		size = ALIGN(size, xe_get_default_alignment(fd));
diff --git a/tests/intel/kms_big_fb.c b/tests/intel/kms_big_fb.c
index f7f303d41..1e45d8e42 100644
--- a/tests/intel/kms_big_fb.c
+++ b/tests/intel/kms_big_fb.c
@@ -199,7 +199,7 @@ static struct intel_buf *init_buf(data_t *data,
 	tiling = igt_fb_mod_to_tiling(fb->modifier);
 	bpp = fb->plane_bpp[0];
 	size = fb->size;
-	width = fb->width;
+	width = fb->strides[0] / (bpp / 8);
 	height = fb->height;
 
 	name = gem_flink(data->drm_fd, fb->gem_handle);
-- 
2.34.1



More information about the igt-dev mailing list