- if(util_format_get_component_bits(pfi->depth_stencil_format, UTIL_FORMAT_COLORSPACE_ZS, 0))
- depthFormat = pfi->depth_stencil_format;
- else
- depthFormat = PIPE_FORMAT_NONE;
-
- if(util_format_get_component_bits(pfi->depth_stencil_format, UTIL_FORMAT_COLORSPACE_ZS, 1))
- stencilFormat = pfi->depth_stencil_format;
- else
- stencilFormat = PIPE_FORMAT_NONE;
-
- assert(fb->must_resize);
- assert(fb->width);
- assert(fb->height);
-
- fb->stfb = st_create_framebuffer(
- &fb->visual,
- colorFormat,
- depthFormat,
- stencilFormat,
- fb->width,
- fb->height,
- (void *) fb );
-
- // to notify the context
- fb->must_resize = TRUE;
+ if (fb)
+ fb->refcnt++;
+ if (old_fb) {
+ pipe_mutex_lock(stw_dev->fb_mutex);
+
+ pipe_mutex_lock(old_fb->mutex);
+ stw_framebuffer_destroy_locked(old_fb);
+
+ pipe_mutex_unlock(stw_dev->fb_mutex);