diff options
author | Paul Kocialkowski <paul.kocialkowski@bootlin.com> | 2019-01-09 17:55:59 +0100 |
---|---|---|
committer | Paul Kocialkowski <paul.kocialkowski@bootlin.com> | 2019-02-26 09:45:54 +0100 |
commit | 08c9cc0d3dc7bdea948af7e85200ad5f4460b937 (patch) | |
tree | d1e1c3b5eb0403e524d8711319c7bca94f1485bb | |
parent | 9e0c839821cec85e38f9ddb719e134759e892b0a (diff) |
lib/igt_fb: Add support for allocating T-tiled VC4 buffers
This introduces the required bits for allocating buffers with a T-tiled
disposition, that is specific to the VC4. It includes calculating the
top-tile width and creating a buffer object with the VC4-specific
helper. The tiling flag is set to the buffer object so that this can
be reused for GPU tests if needed later.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
-rw-r--r-- | lib/igt_fb.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 1178dddf2..bfb47622a 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -37,6 +37,7 @@ #include "igt_fb.h" #include "igt_kms.h" #include "igt_matrix.h" +#include "igt_vc4.h" #include "igt_x86.h" #include "ioctl_wrappers.h" #include "intel_batchbuffer.h" @@ -270,6 +271,9 @@ static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format) void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp, unsigned *width_ret, unsigned *height_ret) { + if (is_vc4_device(fd)) + tiling = fourcc_mod_broadcom_mod(tiling); + switch (tiling) { case LOCAL_DRM_FORMAT_MOD_NONE: if (is_i915_device(fd)) @@ -323,6 +327,11 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp, igt_assert(false); } break; + case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: + igt_require_vc4(fd); + *width_ret = 128; + *height_ret = 32; + break; default: igt_assert(false); } @@ -638,6 +647,12 @@ static int create_bo_for_fb(struct igt_fb *fb) gem_set_tiling(fd, fb->gem_handle, igt_fb_mod_to_tiling(fb->tiling), fb->strides[0]); + } else if (is_vc4_device(fd)) { + fb->gem_handle = igt_vc4_create_bo(fd, fb->size); + + if (fb->tiling == DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED) + igt_vc4_set_tiling(fd, fb->gem_handle, + fb->tiling); } else { igt_assert(false); } @@ -1569,6 +1584,9 @@ static void *map_bo(int fd, struct igt_fb *fb) else if (is_i915_device(fd)) ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE); + else if (is_vc4_device(fd)) + ptr = igt_vc4_mmap_bo(fd, fb->gem_handle, fb->size, + PROT_READ | PROT_WRITE); else igt_assert(false); |