[Mesa-dev] [PATCH 15/17] nvc0: handle the case where there are no framebuffer attachments
eocallaghan at alterapraxis.com
eocallaghan at alterapraxis.com
Fri Mar 25 08:48:02 UTC 2016
On 2016-03-25 14:29, Ilia Mirkin wrote:
> Please leave this and the next patch out of your series. I'm going to
> need to retest everything carefully once the core support is in (and I
> get a bit of time).
Done. Be sure to remove my Rb if you made changes and i`ll review it
again.
>
> Thanks,
>
> -ilia
>
> On Thu, Mar 24, 2016 at 8:11 PM, Edward O'Callaghan
> <eocallaghan at alterapraxis.com> wrote:
>> From: Ilia Mirkin <imirkin at alum.mit.edu>
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
>> ---
>> src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 7 +++++++
>> src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 16
>> ++++++++++++++--
>> src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 4 ++++
>> 3 files changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
>> b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
>> index b7c6faf..add9a79 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
>> @@ -456,6 +456,13 @@ nvc0_fp_gen_header(struct nvc0_program *fp,
>> struct nv50_ir_prog_info *info)
>> fp->hdr[18] |= 0xf << info->out[i].slot[0];
>> }
>>
>> + /* TODO: figure out proper condition, but this makes things work
>> when there
>> + * are no "regular" outputs in the frag shader, used when there
>> are no
>> + * attachments.
>> + */
>> + if (info->numOutputs == 0)
>> + fp->hdr[18] |= 0xf;
>> +
>> fp->fp.early_z = info->prop.fp.earlyFragTests;
>>
>> return 0;
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> index 9c64482..53f574b 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> @@ -75,12 +75,11 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
>> struct nvc0_screen *screen = nvc0->screen;
>> unsigned i, ms;
>> unsigned ms_mode = NVC0_3D_MULTISAMPLE_MODE_MS1;
>> + unsigned nr_cbufs = fb->nr_cbufs;
>> bool serialize = false;
>>
>> nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
>>
>> - BEGIN_NVC0(push, NVC0_3D(RT_CONTROL), 1);
>> - PUSH_DATA (push, (076543210 << 4) | fb->nr_cbufs);
>> BEGIN_NVC0(push, NVC0_3D(SCREEN_SCISSOR_HORIZ), 2);
>> PUSH_DATA (push, fb->width << 16);
>> PUSH_DATA (push, fb->height << 16);
>> @@ -179,6 +178,18 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
>> PUSH_DATA (push, 0);
>> }
>>
>> + if (nr_cbufs == 0 && !fb->zsbuf) {
>> + unsigned samples = util_next_power_of_two(fb->samples);
>> +
>> + nvc0_fb_set_null_rt(push, 0);
>> +
>> + assert(samples <= 8);
>> + ms_mode = ffs(samples) - 1;
>> + nr_cbufs = 1;
>> + }
>> +
>> + BEGIN_NVC0(push, NVC0_3D(RT_CONTROL), 1);
>> + PUSH_DATA (push, (076543210 << 4) | nr_cbufs);
>> IMMED_NVC0(push, NVC0_3D(MULTISAMPLE_MODE), ms_mode);
>>
>> ms = 1 << ms_mode;
>> @@ -592,6 +603,7 @@ nvc0_validate_derived_2(struct nvc0_context *nvc0)
>> struct nouveau_pushbuf *push = nvc0->base.pushbuf;
>>
>> if (nvc0->zsa && nvc0->zsa->pipe.alpha.enabled &&
>> + nvc0->framebuffer.zsbuf &&
>> nvc0->framebuffer.nr_cbufs == 0) {
>> nvc0_fb_set_null_rt(push, 0);
>> BEGIN_NVC0(push, NVC0_3D(RT_CONTROL), 1);
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>> b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>> index e8b3a4d..d546957 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>> @@ -1043,6 +1043,8 @@ nvc0_blitctx_pre_blit(struct nvc0_blitctx *ctx)
>>
>> ctx->saved.fb.width = nvc0->framebuffer.width;
>> ctx->saved.fb.height = nvc0->framebuffer.height;
>> + ctx->saved.fb.samples = nvc0->framebuffer.samples;
>> + ctx->saved.fb.layers = nvc0->framebuffer.layers;
>> ctx->saved.fb.nr_cbufs = nvc0->framebuffer.nr_cbufs;
>> ctx->saved.fb.cbufs[0] = nvc0->framebuffer.cbufs[0];
>> ctx->saved.fb.zsbuf = nvc0->framebuffer.zsbuf;
>> @@ -1110,6 +1112,8 @@ nvc0_blitctx_post_blit(struct nvc0_blitctx
>> *blit)
>>
>> nvc0->framebuffer.width = blit->saved.fb.width;
>> nvc0->framebuffer.height = blit->saved.fb.height;
>> + nvc0->framebuffer.samples = blit->saved.fb.samples;
>> + nvc0->framebuffer.layers = blit->saved.fb.layers;
>> nvc0->framebuffer.nr_cbufs = blit->saved.fb.nr_cbufs;
>> nvc0->framebuffer.cbufs[0] = blit->saved.fb.cbufs[0];
>> nvc0->framebuffer.zsbuf = blit->saved.fb.zsbuf;
>> --
>> 2.5.5
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list