* [PATCH] nv50: adjust min/max lod by base level on G80
@ 2015-07-20 7:26 Ilia Mirkin
[not found] ` <1437377218-29891-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Ilia Mirkin @ 2015-07-20 7:26 UTC (permalink / raw)
To: mesa-dev, nouveau
Make the assumption that there's a 1:1 TIC <-> TSC connection, and
increase min/max lod by the relevant texture's base level. Also if
there's no mipfilter, we have to enable it while forcing min/max lod to
the base level.
This fixes many, but not all, tex-miplevel-selection tests on G80.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
---
All the textureLod tests fail. If I also adjust the lod_bias by the
first_level, then the regular tests start failing.
Not sure what the right move is here... need to trace the blob to see
what it does here.
src/gallium/drivers/nouveau/nv50/nv50_state.c | 1 +
.../drivers/nouveau/nv50/nv50_stateobj_tex.h | 1 +
src/gallium/drivers/nouveau/nv50/nv50_tex.c | 39 ++++++++++++++++++++++
3 files changed, 41 insertions(+)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index d4d41af..98c4c3a 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -464,6 +464,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
struct nv50_tsc_entry *so = MALLOC_STRUCT(nv50_tsc_entry);
float f[2];
+ so->pipe = *cso;
so->id = -1;
so->tsc[0] = (0x00026000 |
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h
index 99548cb..9a19166 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h
@@ -5,6 +5,7 @@
#include "pipe/p_state.h"
struct nv50_tsc_entry {
+ struct pipe_sampler_state pipe;
int id;
uint32_t tsc[8];
};
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
index 17ae27f..d79c813 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
@@ -344,6 +344,45 @@ nv50_validate_tsc(struct nv50_context *nv50, int s)
PUSH_DATA (push, (i << 4) | 0);
continue;
}
+ if (nv50->base.screen->class_3d == NV50_3D_CLASS) {
+ struct nv50_tic_entry *tic = nv50_tic_entry(nv50->textures[s][i]);
+
+ /* We must make sure that the MIN_LOD is at least set to the first
+ * level for the G80
+ */
+ bool need_update = false;
+ float min_lod = CLAMP(
+ tic->pipe.u.tex.first_level + tsc->pipe.min_lod, 0.0f, 15.0f);
+ float max_lod = CLAMP(
+ tic->pipe.u.tex.first_level + tsc->pipe.max_lod, 0.0f, 15.0f);
+
+ if (tsc->pipe.min_mip_filter == PIPE_TEX_MIPFILTER_NONE) {
+ uint32_t old_tsc1 = tsc->tsc[1];
+ tsc->tsc[1] &= ~NV50_TSC_1_MIPF__MASK;
+ if (tic->pipe.u.tex.first_level) {
+ tsc->tsc[1] |= NV50_TSC_1_MIPF_NEAREST;
+ max_lod = min_lod = tic->pipe.u.tex.first_level;
+ }
+ if (tsc->tsc[1] != old_tsc1)
+ need_update = true;
+ }
+
+ uint32_t new_tsc2 =
+ (((int)(max_lod * 256.0f) & 0xfff) << 12) |
+ ((int)(min_lod * 256.0f) & 0xfff);
+ if ((tsc->tsc[2] & 0xffffff) != new_tsc2) {
+ tsc->tsc[2] &= ~0xffffffu;
+ tsc->tsc[2] |= new_tsc2;
+ need_update = true;
+ }
+
+ if (need_update && tsc->id >= 0) {
+ nv50_sifc_linear_u8(&nv50->base, nv50->screen->txc,
+ 65536 + tsc->id * 32,
+ NOUVEAU_BO_VRAM, 32, tsc->tsc);
+ need_flush = TRUE;
+ }
+ }
if (tsc->id < 0) {
tsc->id = nv50_screen_tsc_alloc(nv50->screen, tsc);
--
2.3.6
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <1437377218-29891-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>]
* Re: [PATCH] nv50: adjust min/max lod by base level on G80 [not found] ` <1437377218-29891-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org> @ 2015-07-20 14:37 ` Samuel Pitoiset 0 siblings, 0 replies; 2+ messages in thread From: Samuel Pitoiset @ 2015-07-20 14:37 UTC (permalink / raw) To: Ilia Mirkin, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> On 07/20/2015 09:26 AM, Ilia Mirkin wrote: > Make the assumption that there's a 1:1 TIC <-> TSC connection, and > increase min/max lod by the relevant texture's base level. Also if > there's no mipfilter, we have to enable it while forcing min/max lod to > the base level. > > This fixes many, but not all, tex-miplevel-selection tests on G80. > > Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> > --- > > All the textureLod tests fail. If I also adjust the lod_bias by the > first_level, then the regular tests start failing. > > Not sure what the right move is here... need to trace the blob to see > what it does here. > > src/gallium/drivers/nouveau/nv50/nv50_state.c | 1 + > .../drivers/nouveau/nv50/nv50_stateobj_tex.h | 1 + > src/gallium/drivers/nouveau/nv50/nv50_tex.c | 39 ++++++++++++++++++++++ > 3 files changed, 41 insertions(+) > > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c > index d4d41af..98c4c3a 100644 > --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c > +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c > @@ -464,6 +464,7 @@ nv50_sampler_state_create(struct pipe_context *pipe, > struct nv50_tsc_entry *so = MALLOC_STRUCT(nv50_tsc_entry); > float f[2]; > > + so->pipe = *cso; > so->id = -1; > > so->tsc[0] = (0x00026000 | > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h > index 99548cb..9a19166 100644 > --- a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h > +++ b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h > @@ -5,6 +5,7 @@ > #include "pipe/p_state.h" > > struct nv50_tsc_entry { > + struct pipe_sampler_state pipe; > int id; > uint32_t tsc[8]; > }; > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c > index 17ae27f..d79c813 100644 > --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c > +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c > @@ -344,6 +344,45 @@ nv50_validate_tsc(struct nv50_context *nv50, int s) > PUSH_DATA (push, (i << 4) | 0); > continue; > } > + if (nv50->base.screen->class_3d == NV50_3D_CLASS) { > + struct nv50_tic_entry *tic = nv50_tic_entry(nv50->textures[s][i]); > + > + /* We must make sure that the MIN_LOD is at least set to the first > + * level for the G80 > + */ > + bool need_update = false; > + float min_lod = CLAMP( > + tic->pipe.u.tex.first_level + tsc->pipe.min_lod, 0.0f, 15.0f); > + float max_lod = CLAMP( > + tic->pipe.u.tex.first_level + tsc->pipe.max_lod, 0.0f, 15.0f); > + > + if (tsc->pipe.min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { > + uint32_t old_tsc1 = tsc->tsc[1]; > + tsc->tsc[1] &= ~NV50_TSC_1_MIPF__MASK; > + if (tic->pipe.u.tex.first_level) { > + tsc->tsc[1] |= NV50_TSC_1_MIPF_NEAREST; > + max_lod = min_lod = tic->pipe.u.tex.first_level; > + } > + if (tsc->tsc[1] != old_tsc1) > + need_update = true; > + } > + > + uint32_t new_tsc2 = > + (((int)(max_lod * 256.0f) & 0xfff) << 12) | > + ((int)(min_lod * 256.0f) & 0xfff); > + if ((tsc->tsc[2] & 0xffffff) != new_tsc2) { > + tsc->tsc[2] &= ~0xffffffu; > + tsc->tsc[2] |= new_tsc2; > + need_update = true; > + } > + > + if (need_update && tsc->id >= 0) { > + nv50_sifc_linear_u8(&nv50->base, nv50->screen->txc, > + 65536 + tsc->id * 32, > + NOUVEAU_BO_VRAM, 32, tsc->tsc); > + need_flush = TRUE; > + } > + } > if (tsc->id < 0) { > tsc->id = nv50_screen_tsc_alloc(nv50->screen, tsc); > _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/nouveau ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-20 14:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 7:26 [PATCH] nv50: adjust min/max lod by base level on G80 Ilia Mirkin
[not found] ` <1437377218-29891-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-07-20 14:37 ` Samuel Pitoiset
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.