From b064c9103d8fc0bb4ae8fe597b4d9de82a274638 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Tue, 19 Aug 2014 23:14:51 -0700
Subject: vc4: Add support for all the texture and FBO formats we can.

Now that tiling is in place, we can expose the other formats.  Depth is
still broken (need to make changes in the shader), but if you don't expose
it things crash all over.  SNORM is dropped, but we could re-add it later
with some shader fixes to handle converting between [0,1] and [-1,1].
---
 src/gallium/drivers/vc4/vc4_context.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src/gallium/drivers/vc4/vc4_context.c')

diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 0a09d399261..91ff7d784e9 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -66,7 +66,9 @@ vc4_setup_rcl(struct vc4_context *vc4)
         cl_u16(&vc4->rcl, height);
         cl_u16(&vc4->rcl, ((csurf->tiling <<
                             VC4_RENDER_CONFIG_MEMORY_FORMAT_SHIFT) |
-                           VC4_RENDER_CONFIG_FORMAT_RGBA8888 |
+                           (vc4_rt_format_is_565(csurf->base.format) ?
+                            VC4_RENDER_CONFIG_FORMAT_BGR565 :
+                            VC4_RENDER_CONFIG_FORMAT_RGBA8888) |
                            VC4_RENDER_CONFIG_EARLY_Z_COVERAGE_DISABLE));
 
         /* The tile buffer normally gets cleared when the previous tile is
@@ -100,6 +102,8 @@ vc4_setup_rcl(struct vc4_context *vc4)
                                       (csurf->tiling <<
                                        VC4_LOADSTORE_TILE_BUFFER_FORMAT_SHIFT));
                                 cl_u8(&vc4->rcl,
+                                      vc4_rt_format_is_565(csurf->base.format) ?
+                                      VC4_LOADSTORE_TILE_BUFFER_BGR565 :
                                       VC4_LOADSTORE_TILE_BUFFER_RGBA8888);
                                 cl_reloc(vc4, &vc4->rcl, ctex->bo,
                                          csurf->offset);
-- 
cgit v1.2.3