summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>2019-01-24 16:49:41 +0100
committerPaul Kocialkowski <paul.kocialkowski@bootlin.com>2019-02-26 09:45:54 +0100
commit5b39b1c6c6883a971c1d4134809b4b84805fdd4b (patch)
tree88a193e6e28613053e6d6d906df84f7f18591d5f
parentcf8438acbc57a1bac5cf64f1d8d0e584daf670c9 (diff)
lib/igt_fb: Support converting to VC4 modifiers in igt_fb_convert
This pipes-in support for the VC4 modifiers that we have conversion helpers for. A new temporary linear framebuffer is introduced, that is either freed later or copied to the destination framebuffer pointer. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
-rw-r--r--lib/igt_fb.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 25a07b0df..e44b803f2 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2576,23 +2576,30 @@ unsigned int igt_fb_convert_with_stride(struct igt_fb *dst, struct igt_fb *src,
unsigned int dst_stride)
{
struct fb_convert cvt = { };
+ struct igt_fb linear;
void *dst_ptr, *src_ptr;
+ uint64_t base_modifier;
int fb_id;
+ if (is_vc4_device(src->fd))
+ base_modifier = fourcc_mod_broadcom_mod(dst_modifier);
+ else
+ base_modifier = dst_modifier;
+
fb_id = igt_create_fb_with_bo_size(src->fd, src->width, src->height,
dst_fourcc,
- LOCAL_DRM_FORMAT_MOD_NONE, dst, 0,
- dst_stride);
+ LOCAL_DRM_FORMAT_MOD_NONE, &linear,
+ 0, dst_stride);
igt_assert(fb_id > 0);
src_ptr = igt_fb_map_buffer(src->fd, src);
igt_assert(src_ptr);
- dst_ptr = igt_fb_map_buffer(dst->fd, dst);
+ dst_ptr = igt_fb_map_buffer(linear.fd, &linear);
igt_assert(dst_ptr);
cvt.dst.ptr = dst_ptr;
- cvt.dst.fb = dst;
+ cvt.dst.fb = &linear;
cvt.src.ptr = src_ptr;
cvt.src.fb = src;
fb_convert(&cvt);
@@ -2600,7 +2607,26 @@ unsigned int igt_fb_convert_with_stride(struct igt_fb *dst, struct igt_fb *src,
igt_fb_unmap_buffer(dst, dst_ptr);
igt_fb_unmap_buffer(src, src_ptr);
- igt_assert(dst_modifier == LOCAL_DRM_FORMAT_MOD_NONE);
+ switch (base_modifier) {
+ case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED:
+ fb_id = igt_vc4_fb_t_tiled_convert(dst, &linear);
+ break;
+ case DRM_FORMAT_MOD_BROADCOM_SAND32:
+ case DRM_FORMAT_MOD_BROADCOM_SAND64:
+ case DRM_FORMAT_MOD_BROADCOM_SAND128:
+ case DRM_FORMAT_MOD_BROADCOM_SAND256:
+ fb_id = vc4_fb_sand_tiled_convert(dst, &linear, dst_modifier);
+ break;
+ default:
+ igt_assert(dst_modifier == LOCAL_DRM_FORMAT_MOD_NONE);
+ }
+
+ igt_assert(fb_id > 0);
+
+ if (dst_modifier == LOCAL_DRM_FORMAT_MOD_NONE)
+ *dst = linear;
+ else
+ igt_remove_fb(linear.fd, &linear);
return fb_id;
}