All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH v2] lib/igt_fb: Support Tile Size for AMD non linear modifiers.
@ 2021-06-21 17:21 Mark Yacoub
  2021-06-21 18:02 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Support Tile Size for AMD non linear modifiers. (rev3) Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Mark Yacoub @ 2021-06-21 17:21 UTC (permalink / raw)
  To: igt-dev; +Cc: petri.latvala, bas, seanpaul, Mark Yacoub

From: Mark Yacoub <markyacoub@google.com>

Calculate the width and height of the tile on amdgpu when the modifier
is not linear.

v1:
Change width_ret to bytes not pixels.

Cc: bas@basnieuwenhuizen.nl
Cc: daniel.vetter@ffwll.ch
Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
Change-Id: I30849ee1368fc626d1ce2826fb726cd76565a449
---
 lib/igt_fb.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 71b89855..a3926dc9 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -396,6 +396,19 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
 		vc4_modifier_param = fourcc_mod_broadcom_param(modifier);
 		modifier = fourcc_mod_broadcom_mod(modifier);
 	}
+	// For all non-linear modifiers, AMD uses 64 KiB tiles
+	else if (IS_AMD_FMT_MOD(modifier)) {
+		igt_require_amdgpu(fd);
+		const int bytes_per_pixel = fb_bpp / 8;
+		const int format_log2 = log2(bytes_per_pixel);
+		const int pixel_log2 = log2(64 * 1024) - format_log2;
+		const int width_log2 = (pixel_log2 + 1) / 2;
+		const int height_log2 = pixel_log2 - width_log2;
+
+		*width_ret = bytes_per_pixel << width_log2;
+		*height_ret = 1 << height_log2;
+		return;
+	}
 
 	switch (modifier) {
 	case LOCAL_DRM_FORMAT_MOD_NONE:
-- 
2.32.0.288.g62a8d224e6-goog

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-07-06 12:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 17:21 [igt-dev] [PATCH v2] lib/igt_fb: Support Tile Size for AMD non linear modifiers Mark Yacoub
2021-06-21 18:02 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Support Tile Size for AMD non linear modifiers. (rev3) Patchwork
2021-06-21 20:38 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-22 18:11 ` [igt-dev] [PATCH v2] lib/igt_fb: Support Tile Size for AMD non linear modifiers Rodrigo Siqueira
2021-06-23  6:15   ` Petri Latvala
2021-07-06 12:35     ` Rodrigo Siqueira
2021-06-28  8:29 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Support Tile Size for AMD non linear modifiers. (rev4) Patchwork
2021-06-28  9:26 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-28 17:08   ` Mark Yacoub
2021-06-29 16:07     ` Rodrigo Siqueira
2021-06-29 16:55       ` Mark Yacoub
2021-07-01 21:13         ` Arkadiusz Hiler
2021-07-02  0:55           ` Vudum, Lakshminarayana
2021-07-01 22:34 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.