Module: Mesa
Branch: master
Commit: c61eb3c91cfcce48f5d0f0507123bdf107cb976b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c61eb3c91cfcce48f5d0f0507123bdf107cb976b

Author: Eric Anholt <e...@anholt.net>
Date:   Fri Oct 14 16:26:25 2016 -0700

vc4: Fix fast clear color packing for 565.

Piglit didn't manage to cover this because fbo-clear-formats uses
scissors, so we don't get fast clearing.

---

 src/gallium/drivers/vc4/vc4_draw.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_draw.c 
b/src/gallium/drivers/vc4/vc4_draw.c
index f44831f..61c5842 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -496,10 +496,23 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
         if (buffers & PIPE_CLEAR_COLOR0) {
                 struct vc4_resource *rsc =
                         vc4_resource(vc4->framebuffer.cbufs[0]->texture);
+                uint32_t clear_color;
 
-                job->clear_color[0] = job->clear_color[1] =
-                        pack_rgba(vc4->framebuffer.cbufs[0]->format,
-                                  color->f);
+                if (vc4_rt_format_is_565(vc4->framebuffer.cbufs[0]->format)) {
+                        /* In 565 mode, the hardware will be packing our color
+                         * for us.
+                         */
+                        clear_color = pack_rgba(PIPE_FORMAT_R8G8B8A8_UNORM,
+                                                color->f);
+                } else {
+                        /* Otherwise, we need to do this packing because we
+                         * support multiple swizzlings of RGBA8888.
+                         */
+                        clear_color =
+                                pack_rgba(vc4->framebuffer.cbufs[0]->format,
+                                          color->f);
+                }
+                job->clear_color[0] = job->clear_color[1] = clear_color;
                 rsc->initialized_buffers |= (buffers & PIPE_CLEAR_COLOR0);
         }
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to