[Mesa-dev] [PATCH] [swr] Always defer memory free in swr_resource_destroy
Cherniak, Bruce
bruce.cherniak at intel.com
Thu Jan 12 01:21:09 UTC 2017
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
> On Jan 11, 2017, at 5:19 PM, George Kyriazis <george.kyriazis at intel.com> wrote:
>
> Defer delete on regular resources. This ensures that any work being done
> on the resource is completed before freeing up the resource's memory.
> ---
> src/gallium/drivers/swr/swr_screen.cpp | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index cc8030e..5012388 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -880,18 +880,11 @@ swr_resource_destroy(struct pipe_screen *p_screen, struct pipe_resource *pt)
> winsys->displaytarget_destroy(winsys, spr->display_target);
>
> } else {
> - /* For regular resources, if the resource is being used, defer deletion
> - * (use aligned-free) */
> - if (pipe && spr->status) {
> - swr_resource_unused(pt);
> - swr_fence_work_free(screen->flush_fence,
> - spr->swr.pBaseAddress, true);
> - swr_fence_work_free(screen->flush_fence,
> - spr->secondary.pBaseAddress, true);
> - } else {
> - AlignedFree(spr->swr.pBaseAddress);
> - AlignedFree(spr->secondary.pBaseAddress);
> - }
> + /* For regular resources, defer deletion */
> + swr_resource_unused(pt);
> + swr_fence_work_free(screen->flush_fence, spr->swr.pBaseAddress, true);
> + swr_fence_work_free(screen->flush_fence,
> + spr->secondary.pBaseAddress, true);
> }
>
> FREE(spr);
> --
> 2.10.0.windows.1
>
> _______________________________________________
> 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