From 2b8c0cf16959c07341309484da41b2e9a17e5266 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Mar 2010 11:13:51 +1000 Subject: nv50: make use of scissor enable/disable method --- src/gallium/drivers/nv50/nv50_context.h | 1 - src/gallium/drivers/nv50/nv50_screen.c | 4 ---- src/gallium/drivers/nv50/nv50_state.c | 5 ++++- src/gallium/drivers/nv50/nv50_state_validate.c | 23 ++++------------------- 4 files changed, 8 insertions(+), 25 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index ef0e99f0b1..973fdd23a2 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -126,7 +126,6 @@ struct nv50_state { struct nouveau_stateobj *hw[64]; uint64_t hw_dirty; - unsigned scissor_enabled; unsigned miptree_nr[PIPE_SHADER_TYPES]; struct nouveau_stateobj *vtxbuf; struct nouveau_stateobj *vtxattr; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 2a1b64ffdc..114ae9b386 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -485,10 +485,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) so_method(so, screen->tesla, NV50TCL_LINKED_TSC, 1); so_data (so, 1); - /* activate first scissor rectangle */ - so_method(so, screen->tesla, NV50TCL_SCISSOR_ENABLE(0), 1); - so_data (so, 1); - so_method(so, screen->tesla, NV50TCL_EDGEFLAG_ENABLE, 1); so_data (so, 1); /* default edgeflag to TRUE */ diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index ffbf3473a1..b0e5552eff 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -302,7 +302,7 @@ static void * nv50_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) { - struct nouveau_stateobj *so = so_new(15, 21, 0); + struct nouveau_stateobj *so = so_new(16, 22, 0); struct nouveau_grobj *tesla = nv50_context(pipe)->screen->tesla; struct nv50_rasterizer_stateobj *rso = CALLOC_STRUCT(nv50_rasterizer_stateobj); @@ -314,6 +314,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe, * - point_sprite / sprite_coord_mode */ + so_method(so, tesla, NV50TCL_SCISSOR_ENABLE(0), 1); + so_data (so, cso->scissor); + so_method(so, tesla, NV50TCL_SHADE_MODEL, 1); so_data (so, cso->flatshade ? NV50TCL_SHADE_MODEL_FLAT : NV50TCL_SHADE_MODEL_SMOOTH); diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 0f27605372..2aaee31c0e 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -167,9 +167,6 @@ validate_fb(struct nv50_context *nv50) so_data (so, w << 16); so_data (so, h << 16); - /* we set scissors to framebuffer size when they're 'turned off' */ - nv50->dirty |= NV50_NEW_SCISSOR; - so_ref(NULL, &nv50->state.hw[12]); return so; } @@ -264,26 +261,14 @@ validate_stipple(struct nv50_context *nv50) static struct nouveau_stateobj * validate_scissor(struct nv50_context *nv50) { - struct pipe_rasterizer_state *rast = &nv50->rasterizer->pipe; - struct pipe_scissor_state *s = &nv50->scissor; struct nouveau_grobj *tesla = nv50->screen->tesla; + struct pipe_scissor_state *s = &nv50->scissor; struct nouveau_stateobj *so; - if (nv50->state.hw[12] && - (rast->scissor == 0 && nv50->state.scissor_enabled == 0)) - return NULL; - nv50->state.scissor_enabled = rast->scissor; - so = so_new(1, 2, 0); so_method(so, tesla, NV50TCL_SCISSOR_HORIZ(0), 2); - if (nv50->state.scissor_enabled) { - so_data(so, (s->maxx << 16) | s->minx); - so_data(so, (s->maxy << 16) | s->miny); - } else { - so_data(so, (nv50->framebuffer.width << 16)); - so_data(so, (nv50->framebuffer.height << 16)); - } - + so_data (so, (s->maxx << 16) | s->minx); + so_data (so, (s->maxy << 16) | s->miny); return so; } @@ -374,7 +359,7 @@ struct state_validate { { validate_blend_colour , NV50_NEW_BLEND_COLOUR }, { validate_stencil_ref , NV50_NEW_STENCIL_REF }, { validate_stipple , NV50_NEW_STIPPLE }, - { validate_scissor , NV50_NEW_SCISSOR | NV50_NEW_RASTERIZER }, + { validate_scissor , NV50_NEW_SCISSOR }, { validate_viewport , NV50_NEW_VIEWPORT }, { validate_sampler , NV50_NEW_SAMPLER }, { nv50_tex_validate , NV50_NEW_TEXTURE | NV50_NEW_SAMPLER }, -- cgit v1.2.3