[igt-dev] [PATCH i-g-t 3/5] lib/rendercopy: Add fp16 support for gen4+

Ville Syrjala
2019-04-18T19:40:53Z

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Allow copying between fp16 surfaces. We'll use the FLOAT
surface format since that's all the display supports currently.
Hopefully the hardware gives us a 1:1 copy, at least if
the input doesn't contain crazy infs/nans etc. We could
choose UNORM instead but that won't work for eventually
exposing fp16+ccs. Although we do need to replace the
simple bpp value with a more specific format type to get
10bpc+ccs working as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
lib/rendercopy_gen4.c | 1 +
lib/rendercopy_gen6.c | 1 +
lib/rendercopy_gen7.c | 1 +
lib/rendercopy_gen8.c | 1 +
lib/rendercopy_gen9.c | 1 +
5 files changed, 5 insertions(+)

diff --git a/lib/rendercopy_gen4.c b/lib/rendercopy_gen4.c
index 9111508f3ec9..42de77f9f878 100644
--- a/lib/rendercopy_gen4.c
+++ b/lib/rendercopy_gen4.c
@@ -160,6 +160,7 @@ gen4_bind_buf(struct intel_batchbuffer *batch,
case 8: ss->ss0.surface_format = SURFACEFORMAT_R8_UNORM; break;
case 16: ss->ss0.surface_format = SURFACEFORMAT_R8G8_UNORM; break;
case 32: ss->ss0.surface_format = SURFACEFORMAT_B8G8R8A8_UNORM; break;
+ case 64: ss->ss0.surface_format = SURFACEFORMAT_R16G16B16A16_FLOAT; break;
default: igt_assert(0);
}

diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
index a6157cfc70f6..b90466d007f9 100644
--- a/lib/rendercopy_gen6.c
+++ b/lib/rendercopy_gen6.c
@@ -97,6 +97,7 @@ gen6_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
case 8: ss->ss0.surface_format = SURFACEFORMAT_R8_UNORM; break;
case 16: ss->ss0.surface_format = SURFACEFORMAT_R8G8_UNORM; break;
case 32: ss->ss0.surface_format = SURFACEFORMAT_B8G8R8A8_UNORM; break;
+ case 64: ss->ss0.surface_format = SURFACEFORMAT_R16G16B16A16_FLOAT; break;
default: igt_assert(0);
}

diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index 0a5d4a151e0d..949468427b2f 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -73,6 +73,7 @@ gen7_bind_buf(struct intel_batchbuffer *batch,
case 8: format = SURFACEFORMAT_R8_UNORM; break;
case 16: format = SURFACEFORMAT_R8G8_UNORM; break;
case 32: format = SURFACEFORMAT_B8G8R8A8_UNORM; break;
+ case 64: format = SURFACEFORMAT_R16G16B16A16_FLOAT; break;
default: igt_assert(0);
}

diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index 643b6630d4a3..f7a33947166e 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -170,6 +170,7 @@ gen8_bind_buf(struct intel_batchbuffer *batch,
case 8: ss->ss0.surface_format = SURFACEFORMAT_R8_UNORM; break;
case 16: ss->ss0.surface_format = SURFACEFORMAT_R8G8_UNORM; break;
case 32: ss->ss0.surface_format = SURFACEFORMAT_B8G8R8A8_UNORM; break;
+ case 64: ss->ss0.surface_format = SURFACEFORMAT_R16G16B16A16_FLOAT; break;
default: igt_assert(0);
}
ss->ss0.render_cache_read_write = 1;
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index 93e9d150e717..5c6485d750a9 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -201,6 +201,7 @@ gen8_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
case 8: ss->ss0.surface_format = SURFACEFORMAT_R8_UNORM; break;
case 16: ss->ss0.surface_format = SURFACEFORMAT_R8G8_UNORM; break;
case 32: ss->ss0.surface_format = SURFACEFORMAT_B8G8R8A8_UNORM; break;
+ case 64: ss->ss0.surface_format = SURFACEFORMAT_R16G16B16A16_FLOAT; break;
default: igt_assert(0);
}
ss->ss0.render_cache_read_write = 1;
--
2.21.0