summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2018-12-02 12:27:23 -0500
committerIlia Mirkin <[email protected]>2018-12-14 20:01:31 -0500
commit4aeaf89aa776fa4f6f7c60eafa8806e660d2a13d (patch)
tree88835a89c85b951f4d6656f8ac840e4cd17dfef2 /src/gallium
parent5f9085638a75b0fdfbb56aaa1c0da3414d8c13ce (diff)
nvc0: replace use of explicit default_tsc with entry 0
This was used for implementing FBFETCH. However that uses TXF, which doesn't do much with a TSC. The only important bit is that sRGB-decoding works as expected, which we can achieve since all samplers we ever generate enable sRGB-decoding. Always point to entry 0 in the TSC table, and ensure that even before it ever gets initialized, the sRGB-decoding enable bit is set. Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.c10
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.h1
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.c4
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.h2
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c18
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_tex.c12
6 files changed, 25 insertions, 22 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index 2e4490b8d97..2d46a90ddb4 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -478,6 +478,16 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
util_dynarray_init(&nvc0->global_residents, NULL);
+ // Make sure that the first TSC entry has SRGB conversion bit set, since we
+ // use it as a fallback on Fermi for TXF, and on Kepler+ generations for
+ // FBFETCH handling (which also uses TXF).
+ //
+ // NOTE: Preliminary testing suggests that this isn't necessary at all at
+ // least on GM20x (untested on Kepler). However this is ~free, so no reason
+ // not to do it.
+ if (!screen->tsc.entries[0])
+ nvc0_upload_tsc0(nvc0);
+
return pipe;
out_err:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index b7cc415359d..eb057bf2489 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -365,6 +365,7 @@ bool nve4_validate_tsc(struct nvc0_context *nvc0, int s);
void nvc0_validate_suf(struct nvc0_context *nvc0, int s);
void nvc0_validate_textures(struct nvc0_context *);
void nvc0_validate_samplers(struct nvc0_context *);
+void nvc0_upload_tsc0(struct nvc0_context *);
void nve4_set_tex_handles(struct nvc0_context *);
void nvc0_validate_surfaces(struct nvc0_context *);
void nve4_set_surface_info(struct nouveau_pushbuf *,
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 48b36ae4193..bd48f15063a 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -628,7 +628,6 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
nouveau_heap_destroy(&screen->lib_code);
nouveau_heap_destroy(&screen->text_heap);
- FREE(screen->default_tsc);
FREE(screen->tic.entries);
nouveau_object_del(&screen->eng3d);
@@ -1387,9 +1386,6 @@ nvc0_screen_create(struct nouveau_device *dev)
if (!nvc0_blitter_create(screen))
goto fail;
- screen->default_tsc = CALLOC_STRUCT(nv50_tsc_entry);
- screen->default_tsc->tsc[0] = G80_TSC_0_SRGB_CONVERSION;
-
nouveau_fence_new(&screen->base, &screen->base.fence.current);
return &screen->base;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
index d8223ba9d54..392980562bd 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
@@ -89,8 +89,6 @@ struct nvc0_screen {
struct nvc0_blitter *blitter;
- struct nv50_tsc_entry *default_tsc;
-
struct {
void **entries;
int next;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 4f004a4f705..40a42f5116f 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -1,4 +1,4 @@
-
+#include "util/u_format.h"
#include "util/u_framebuffer.h"
#include "util/u_math.h"
#include "util/u_viewport.h"
@@ -831,20 +831,6 @@ nvc0_validate_fbread(struct nvc0_context *nvc0)
pipe_sampler_view_reference(&nvc0->fbtexture, NULL);
nvc0->fbtexture = new_view;
- if (screen->default_tsc->id < 0) {
- struct nv50_tsc_entry *tsc = nv50_tsc_entry(screen->default_tsc);
- tsc->id = nvc0_screen_tsc_alloc(screen, tsc);
- nvc0->base.push_data(&nvc0->base, screen->txc, 65536 + tsc->id * 32,
- NV_VRAM_DOMAIN(&screen->base), 32, tsc->tsc);
- screen->tsc.lock[tsc->id / 32] |= 1 << (tsc->id % 32);
-
- IMMED_NVC0(push, NVC0_3D(TSC_FLUSH), 0);
- if (screen->base.class_3d < NVE4_3D_CLASS) {
- BEGIN_NVC0(push, NVC0_3D(BIND_TSC2(0)), 1);
- PUSH_DATA (push, (tsc->id << 12) | 1);
- }
- }
-
if (new_view) {
struct nv50_tic_entry *tic = nv50_tic_entry(new_view);
assert(tic->id < 0);
@@ -860,7 +846,7 @@ nvc0_validate_fbread(struct nvc0_context *nvc0)
PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(4));
BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 1);
PUSH_DATA (push, NVC0_CB_AUX_FB_TEX_INFO);
- PUSH_DATA (push, (screen->default_tsc->id << 20) | tic->id);
+ PUSH_DATA (push, (0 << 20) | tic->id);
} else {
BEGIN_NVC0(push, NVC0_3D(BIND_TIC2(0)), 1);
PUSH_DATA (push, (tic->id << 9) | 1);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
index f40600e48aa..1ec55f5b8ab 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
@@ -728,6 +728,18 @@ void nvc0_validate_samplers(struct nvc0_context *nvc0)
nvc0->dirty_cp |= NVC0_NEW_CP_SAMPLERS;
}
+void
+nvc0_upload_tsc0(struct nvc0_context *nvc0)
+{
+ struct nouveau_pushbuf *push = nvc0->base.pushbuf;
+ u32 data[8] = { G80_TSC_0_SRGB_CONVERSION };
+ nvc0->base.push_data(&nvc0->base, nvc0->screen->txc,
+ 65536 /*+ tsc->id * 32*/,
+ NV_VRAM_DOMAIN(&nvc0->screen->base), 32, data);
+ BEGIN_NVC0(push, NVC0_3D(TSC_FLUSH), 1);
+ PUSH_DATA (push, 0);
+}
+
/* Upload the "diagonal" entries for the possible texture sources ($t == $s).
* At some point we might want to get a list of the combinations used by a
* shader and fill in those entries instead of having it extract the handles.