i915: use util_copy_framebuffer_state to set fb state
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 24 Apr 2023 20:27:11 +0000 (16:27 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 3 May 2023 23:45:36 +0000 (23:45 +0000)
Fixes: f5bde99cbdd ("gallium: plumb resolve attachments through from frontends -> pipe_framebuffer_state")

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22673>

src/gallium/drivers/i915/i915_state.c

index cb5db62..f4640c0 100644 (file)
@@ -815,12 +815,8 @@ i915_set_framebuffer_state(struct pipe_context *pipe,
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   i915->framebuffer.width = fb->width;
-   i915->framebuffer.height = fb->height;
-   i915->framebuffer.nr_cbufs = fb->nr_cbufs;
+   util_copy_framebuffer_state(&i915->framebuffer, fb);
    if (fb->nr_cbufs) {
-      pipe_surface_reference(&i915->framebuffer.cbufs[0], fb->cbufs[0]);
-
       struct i915_surface *surf = i915_surface(i915->framebuffer.cbufs[0]);
       if (i915->current.fixup_swizzle != surf->oc_swizzle) {
          i915->current.fixup_swizzle = surf->oc_swizzle;
@@ -828,10 +824,7 @@ i915_set_framebuffer_state(struct pipe_context *pipe,
                 sizeof(surf->color_swizzle));
          i915->dirty |= I915_NEW_COLOR_SWIZZLE;
       }
-   } else {
-      pipe_surface_reference(&i915->framebuffer.cbufs[0], NULL);
-   }
-   pipe_surface_reference(&i915->framebuffer.zsbuf, fb->zsbuf);
+   } 
    if (fb->zsbuf)
       draw_set_zs_format(i915->draw, fb->zsbuf->format);