[igt-dev] [PATCH i-g-t 5/9] lib/igt_fb: Add 64bpp support to the XY_SRC blit command
Imre Deak
imre.deak at intel.com
Wed Jan 29 18:15:57 UTC 2020
While the XY_SRC blit command lacks native 64bpp copy support, we can
emulate it using a 32bpp copy by treating the 64bpp plane as a 2x wide
32bpp plane. Add support for this, as we need the XY_SRC command at
least for GEN12+ X-tiled formats.
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
lib/igt_fb.c | 30 ++++++++++++++++++++++++------
lib/intel_batchbuffer.c | 5 +++++
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 53b43528..fa294a38 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1957,9 +1957,31 @@ struct fb_blit_upload {
struct intel_batchbuffer *batch;
};
+static bool fast_blit_ok(const struct igt_fb *fb)
+{
+ int gen = intel_gen(intel_get_drm_devid(fb->fd));
+
+ if (gen < 9)
+ return false;
+
+ if (gen < 12)
+ return true;
+
+ return fb->modifier != I915_FORMAT_MOD_X_TILED;
+}
+
static bool blitter_ok(const struct igt_fb *fb)
{
for (int i = 0; i < fb->num_planes; i++) {
+ int width = fb->plane_width[i];
+
+ /*
+ * XY_SRC blit supports only 32bpp, but we can still use it
+ * for a 64bpp plane by treating that as a 2x wide 32bpp plane.
+ */
+ if (!fast_blit_ok(fb) && fb->plane_bpp[i] == 64)
+ width *= 2;
+
/*
* gen4+ stride limit is 4x this with tiling,
* but since our blits are always between tiled
@@ -1967,7 +1989,7 @@ static bool blitter_ok(const struct igt_fb *fb)
* for the tiled surface) we must use the lower
* linear stride limit here.
*/
- if (fb->plane_width[i] > 32767 ||
+ if (width > 32767 ||
fb->plane_height[i] > 32767 ||
fb->strides[i] > 32767)
return false;
@@ -2155,8 +2177,6 @@ static void blitcopy(const struct igt_fb *dst_fb,
dst_tiling = igt_fb_mod_to_tiling(dst_fb->modifier);
for (int i = 0; i < dst_fb->num_planes; i++) {
- int gen = intel_gen(intel_get_drm_devid(src_fb->fd));
-
igt_assert_eq(dst_fb->plane_bpp[i], src_fb->plane_bpp[i]);
igt_assert_eq(dst_fb->plane_width[i], src_fb->plane_width[i]);
igt_assert_eq(dst_fb->plane_height[i], src_fb->plane_height[i]);
@@ -2165,9 +2185,7 @@ static void blitcopy(const struct igt_fb *dst_fb,
* blit command, so use the XY_SRC blit command for it
* instead.
*/
- if ((gen >= 9 && gen < 12) ||
- (gen >= 12 && (src_tiling != I915_TILING_X &&
- dst_tiling != I915_TILING_X))) {
+ if (fast_blit_ok(src_fb) && fast_blit_ok(dst_fb)) {
igt_blitter_fast_copy__raw(dst_fb->fd,
src_fb->gem_handle,
src_fb->offsets[i],
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index c4bf7ef4..2fd3a75a 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -817,6 +817,11 @@ void igt_blitter_src_copy__raw(int fd,
src_pitch = (gen >= 4 && src_tiling) ? src_stride / 4 : src_stride;
dst_pitch = (gen >= 4 && dst_tiling) ? dst_stride / 4 : dst_stride;
+ if (bpp == 64) {
+ bpp /= 2;
+ width *= 2;
+ }
+
CHECK_RANGE(src_x); CHECK_RANGE(src_y);
CHECK_RANGE(dst_x); CHECK_RANGE(dst_y);
CHECK_RANGE(width); CHECK_RANGE(height);
--
2.23.1
More information about the igt-dev
mailing list