From: Emil Velikov Date: Tue, 18 Jun 2013 22:02:24 +0000 (+0200) Subject: nv50: avoid crash on updating RASTERIZE_ENABLE state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f7b05d6b324c15b6573dfe1e90d4d5cf416a59b;p=mesa.git nv50: avoid crash on updating RASTERIZE_ENABLE state When doing blit using the 3D engine, the rasterizer cso may be NULL. Ported from nvc0 commit 8aa8b0539. Signed-off-by: Emil Velikov --- diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index d6066f2ae96..30dab0bf961 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -458,6 +458,7 @@ struct nv50_blitctx enum pipe_texture_target target; struct { struct pipe_framebuffer_state fb; + struct nv50_rasterizer_stateobj *rast; struct nv50_program *vp; struct nv50_program *gp; struct nv50_program *fp; @@ -467,6 +468,7 @@ struct nv50_blitctx struct nv50_tsc_entry *sampler[2]; uint32_t dirty; } saved; + struct nv50_rasterizer_stateobj rast; }; static void @@ -836,10 +838,14 @@ nv50_blitctx_pre_blit(struct nv50_blitctx *ctx) ctx->saved.fb.cbufs[0] = nv50->framebuffer.cbufs[0]; ctx->saved.fb.zsbuf = nv50->framebuffer.zsbuf; + ctx->saved.rast = nv50->rast; + ctx->saved.vp = nv50->vertprog; ctx->saved.gp = nv50->gmtyprog; ctx->saved.fp = nv50->fragprog; + nv50->rast = &ctx->rast; + nv50->vertprog = &blitter->vp; nv50->gmtyprog = NULL; nv50->fragprog = ctx->fp; @@ -884,6 +890,8 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit) nv50->framebuffer.cbufs[0] = blit->saved.fb.cbufs[0]; nv50->framebuffer.zsbuf = blit->saved.fb.zsbuf; + nv50->rast = blit->saved.rast; + nv50->vertprog = blit->saved.vp; nv50->gmtyprog = blit->saved.gp; nv50->fragprog = blit->saved.fp; @@ -1328,6 +1336,8 @@ nv50_blitctx_create(struct nv50_context *nv50) nv50->blit->nv50 = nv50; + nv50->blit->rast.pipe.half_pixel_center = 1; + return TRUE; }