Mesa (master): panfrost: Enable sRGB fixed-function blending
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 18 17:00:05 UTC 2019
Module: Mesa
Branch: master
Commit: 6585bb9f523556b04ecf941df22d02a7cc8f5f9c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6585bb9f523556b04ecf941df22d02a7cc8f5f9c
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Mon Jun 17 16:23:23 2019 -0700
panfrost: Enable sRGB fixed-function blending
For fixed-function, we have hardware to handle sRGB so we just set a
flag. For blend shaders, it's rather more involved; this is currently
unimplemented. Assert it out for now; we don't need it quite yet.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/include/panfrost-job.h | 6 +++---
src/gallium/drivers/panfrost/pan_context.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h b/src/gallium/drivers/panfrost/include/panfrost-job.h
index bcdffabff97..80ce66fa7e2 100644
--- a/src/gallium/drivers/panfrost/include/panfrost-job.h
+++ b/src/gallium/drivers/panfrost/include/panfrost-job.h
@@ -168,9 +168,6 @@ struct mali_stencil_test {
unsigned zero : 4;
} __attribute__((packed));
-/* Blending is a mess, since anything fancy triggers a blend shader, and
- * -those- are not understood whatsover yet */
-
#define MALI_MASK_R (1 << 0)
#define MALI_MASK_G (1 << 1)
#define MALI_MASK_B (1 << 2)
@@ -439,11 +436,14 @@ union midgard_blend {
/* On MRT Midgard systems (using an MFBD), each render target gets its own
* blend descriptor */
+#define MALI_BLEND_SRGB (0x400)
+
struct midgard_blend_rt {
/* Flags base value of 0x200 to enable the render target.
* OR with 0x1 for blending (anything other than REPLACE).
* OR with 0x2 for programmable blending with 0-2 registers
* OR with 0x3 for programmable blending with 2+ registers
+ * OR with MALI_BLEND_SRGB for implicit sRGB
*/
u64 flags;
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 7f60cfa03d4..86a9533089c 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1259,8 +1259,22 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
/* TODO: MRT */
for (unsigned i = 0; i < 1; ++i) {
+ bool is_srgb =
+ util_format_is_srgb(ctx->pipe_framebuffer.cbufs[i]->format);
+
rts[i].flags = blend_count;
+ if (is_srgb)
+ rts[i].flags |= MALI_BLEND_SRGB;
+
+ /* TODO: sRGB in blend shaders is currently
+ * unimplemented. Contact me (Alyssa) if you're
+ * interested in working on this. We have
+ * native Midgard ops for helping here, but
+ * they're not well-understood yet. */
+
+ assert(!(is_srgb && ctx->blend->has_blend_shader));
+
if (ctx->blend->has_blend_shader) {
rts[i].blend.shader = ctx->blend->blend_shader;
} else {
More information about the mesa-commit
mailing list