[Nouveau] [PATCH] nv50: enable texture compression

Tobias Klausmann tobias.johannes.klausmann at mni.thm.de
Thu Jan 1 18:56:03 PST 2015


We enable compression only for some supported formats

Suggested-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
---
 src/gallium/drivers/nouveau/nv50/nv50_miptree.c |  4 ++--
 src/gallium/drivers/nouveau/nv50/nv50_screen.c  | 11 +++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
index 1aacaec..a40e6d3 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
@@ -65,8 +65,7 @@ nv50_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
 static uint32_t
 nv50_mt_choose_storage_type(struct nv50_miptree *mt, boolean compressed)
 {
-   const unsigned ms = mt->ms_x + mt->ms_y;
-
+   const unsigned ms = util_logbase2(mt->base.base.nr_samples);
    uint32_t tile_flags;
 
    if (unlikely(mt->base.base.flags & NOUVEAU_RESOURCE_FLAG_LINEAR))
@@ -96,6 +95,7 @@ nv50_mt_choose_storage_type(struct nv50_miptree *mt, boolean compressed)
       tile_flags = 0x60 + ms;
       break;
    default:
+      compressed = false;
       switch (util_format_get_blocksizebits(mt->base.base.format)) {
       case 128:
          assert(ms < 3);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 2d8347b..8d759a7 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -391,7 +391,7 @@ nv50_screen_fence_update(struct pipe_screen *pscreen)
 }
 
 static void
-nv50_screen_init_hwctx(struct nv50_screen *screen)
+nv50_screen_init_hwctx(struct nouveau_device *dev, struct nv50_screen *screen)
 {
    struct nouveau_pushbuf *push = screen->base.pushbuf;
    struct nv04_fifo *fifo;
@@ -449,6 +449,13 @@ nv50_screen_init_hwctx(struct nv50_screen *screen)
       PUSH_DATA (push, 0x18);
    }
 
+   BEGIN_NV04(push, NV50_3D(ZETA_COMP_ENABLE), 1);
+   PUSH_DATA(push, dev->drm_version >= 0x01000101);
+
+   BEGIN_NV04(push, NV50_3D(RT_COMP_ENABLE(0)), 8);
+   for (i = 0; i < 8; ++i)
+      PUSH_DATA(push, dev->drm_version >= 0x01000101);
+
    BEGIN_NV04(push, NV50_3D(RT_CONTROL), 1);
    PUSH_DATA (push, 1);
 
@@ -871,7 +878,7 @@ nv50_screen_create(struct nouveau_device *dev)
    if (!nv50_blitter_create(screen))
       goto fail;
 
-   nv50_screen_init_hwctx(screen);
+   nv50_screen_init_hwctx(dev, screen);
 
    nouveau_fence_new(&screen->base, &screen->base.fence.current, FALSE);
 
-- 
2.2.1



More information about the Nouveau mailing list