Mesa (master): nv50,nvc0: make resolve sampler objects allow sRGB conversion

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Wed Aug 1 13:39:05 UTC 2012


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

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Tue Jul 31 23:32:14 2012 +0200

nv50,nvc0: make resolve sampler objects allow sRGB conversion

Just figured out what that bit does.

Note: It's converted back to sRGB on write, so no effective
conversion occurs.

---

 src/gallium/drivers/nv50/nv50_surface.c     |   14 ++++++++++----
 src/gallium/drivers/nv50/nv50_texture.xml.h |    9 +++++----
 src/gallium/drivers/nvc0/nvc0_surface.c     |   14 ++++++++++----
 3 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index 0872f8d..69bc772 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -33,6 +33,7 @@
 #include "nv50_resource.h"
 
 #include "nv50_defs.xml.h"
+#include "nv50_texture.xml.h"
 
 #define NV50_ENG2D_SUPPORTED_FORMATS 0xff0843e080608409ULL
 
@@ -598,15 +599,20 @@ nv50_blitctx_make_sampler(struct nv50_blitctx *blit)
 
    blit->sampler[0].id = -1;
 
-   blit->sampler[0].tsc[0] = 0x00000092;
-   blit->sampler[0].tsc[1] = 0x00000051;
+   blit->sampler[0].tsc[0] = NV50_TSC_0_SRGB_CONVERSION_ALLOWED |
+      (NV50_TSC_WRAP_CLAMP_TO_EDGE << NV50_TSC_0_WRAPS__SHIFT) |
+      (NV50_TSC_WRAP_CLAMP_TO_EDGE << NV50_TSC_0_WRAPT__SHIFT) |
+      (NV50_TSC_WRAP_CLAMP_TO_EDGE << NV50_TSC_0_WRAPR__SHIFT);
+   blit->sampler[0].tsc[1] =
+      NV50_TSC_1_MAGF_NEAREST | NV50_TSC_1_MINF_NEAREST | NV50_TSC_1_MIPF_NONE;
 
    /* clamp to edge, min/max lod = 0, bilinear filtering */
 
    blit->sampler[1].id = -1;
 
-   blit->sampler[1].tsc[0] = 0x00000092;
-   blit->sampler[1].tsc[1] = 0x00000062;
+   blit->sampler[1].tsc[0] = blit->sampler[0].tsc[0];
+   blit->sampler[1].tsc[1] =
+      NV50_TSC_1_MAGF_LINEAR | NV50_TSC_1_MINF_LINEAR | NV50_TSC_1_MIPF_NONE;
 }
 
 /* Since shaders cannot export stencil, we cannot copy stencil values when
diff --git a/src/gallium/drivers/nv50/nv50_texture.xml.h b/src/gallium/drivers/nv50/nv50_texture.xml.h
index 34accd8..fc76ec7 100644
--- a/src/gallium/drivers/nv50/nv50_texture.xml.h
+++ b/src/gallium/drivers/nv50/nv50_texture.xml.h
@@ -8,10 +8,10 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- rnndb/nv50_texture.xml (   8111 bytes, from 2012-04-29 11:17:45)
-- ./rnndb/copyright.xml  (   6452 bytes, from 2011-08-11 18:25:12)
-- ./rnndb/nvchipsets.xml (   3701 bytes, from 2012-03-22 20:40:59)
-- ./rnndb/nv50_defs.xml  (   5468 bytes, from 2011-08-11 18:25:12)
+- rnndb/nv50_texture.xml (   8180 bytes, from 2012-07-31 11:07:50)
+- ./rnndb/copyright.xml  (   6452 bytes, from 2011-07-10 21:35:25)
+- ./rnndb/nvchipsets.xml (   3736 bytes, from 2012-07-31 11:01:16)
+- ./rnndb/nv50_defs.xml  (   5468 bytes, from 2011-07-10 21:35:25)
 
 Copyright (C) 2006-2012 by the following authors:
 - Artur Huillet <arthur.huillet at free.fr> (ahuillet)
@@ -242,6 +242,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NV50_TSC_0_SHADOW_COMPARE_ENABLE			0x00000200
 #define NV50_TSC_0_SHADOW_COMPARE_FUNC__MASK			0x00001c00
 #define NV50_TSC_0_SHADOW_COMPARE_FUNC__SHIFT			10
+#define NV50_TSC_0_SRGB_CONVERSION_ALLOWED			0x00002000
 #define NV50_TSC_0_BOX_S__MASK					0x0001c000
 #define NV50_TSC_0_BOX_S__SHIFT					14
 #define NV50_TSC_0_BOX_T__MASK					0x000e0000
diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c
index 607b02e..d52de0b 100644
--- a/src/gallium/drivers/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nvc0/nvc0_surface.c
@@ -33,6 +33,7 @@
 #include "nvc0_resource.h"
 
 #include "nv50/nv50_defs.xml.h"
+#include "nv50/nv50_texture.xml.h"
 
 #define NVC0_ENG2D_SUPPORTED_FORMATS 0xff9ccfe1cce3ccc9ULL
 
@@ -664,15 +665,20 @@ nvc0_blitctx_make_sampler(struct nvc0_blitctx *blit)
 
    blit->sampler[0].id = -1;
 
-   blit->sampler[0].tsc[0] = 0x00000092;
-   blit->sampler[0].tsc[1] = 0x00000051;
+   blit->sampler[0].tsc[0] = NV50_TSC_0_SRGB_CONVERSION_ALLOWED |
+      (NV50_TSC_WRAP_CLAMP_TO_EDGE << NV50_TSC_0_WRAPS__SHIFT) |
+      (NV50_TSC_WRAP_CLAMP_TO_EDGE << NV50_TSC_0_WRAPT__SHIFT) |
+      (NV50_TSC_WRAP_CLAMP_TO_EDGE << NV50_TSC_0_WRAPR__SHIFT);
+   blit->sampler[0].tsc[1] =
+      NV50_TSC_1_MAGF_NEAREST | NV50_TSC_1_MINF_NEAREST | NV50_TSC_1_MIPF_NONE;
 
    /* clamp to edge, min/max lod = 0, bilinear filtering */
 
    blit->sampler[1].id = -1;
 
-   blit->sampler[1].tsc[0] = 0x00000092;
-   blit->sampler[1].tsc[1] = 0x00000062;
+   blit->sampler[1].tsc[0] = blit->sampler[0].tsc[0];
+   blit->sampler[1].tsc[1] =
+      NV50_TSC_1_MAGF_LINEAR | NV50_TSC_1_MINF_LINEAR | NV50_TSC_1_MIPF_NONE;
 }
 
 /* Since shaders cannot export stencil, we cannot copy stencil values when




More information about the mesa-commit mailing list