[Mesa-dev] [PATCH] nvc0: Remove duplicate logic from nvc0_set_framebuffer_state()

Samuel Pitoiset samuel.pitoiset at gmail.com
Sun Feb 14 13:16:40 UTC 2016


This change can also be applied to nv50_set_framebuffer_state().

On 02/14/2016 01:46 PM, Edward O'Callaghan wrote:
> We already have this logic in the gallium/util functions so
> lets reduce some entropy while here.
>
> N.B., untested as I don't currently have access to this hw.
>
> Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
> ---
>   src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 13 +------------
>   1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
> index cf3d349..fd5aecd 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
> @@ -940,21 +940,10 @@ nvc0_set_framebuffer_state(struct pipe_context *pipe,
>                              const struct pipe_framebuffer_state *fb)
>   {
>       struct nvc0_context *nvc0 = nvc0_context(pipe);
> -    unsigned i;
>
>       nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB);
>
> -    for (i = 0; i < fb->nr_cbufs; ++i)
> -       pipe_surface_reference(&nvc0->framebuffer.cbufs[i], fb->cbufs[i]);
> -    for (; i < nvc0->framebuffer.nr_cbufs; ++i)
> -       pipe_surface_reference(&nvc0->framebuffer.cbufs[i], NULL);
> -
> -    nvc0->framebuffer.nr_cbufs = fb->nr_cbufs;
> -
> -    nvc0->framebuffer.width = fb->width;
> -    nvc0->framebuffer.height = fb->height;
> -
> -    pipe_surface_reference(&nvc0->framebuffer.zsbuf, fb->zsbuf);
> +    util_copy_framebuffer_state(&nvc0->framebuffer, fb);
>
>       nvc0->dirty |= NVC0_NEW_FRAMEBUFFER;
>   }
>


More information about the mesa-dev mailing list