Module: Mesa Branch: main Commit: d52f35fa1a9e87da1c1aebe39b1063a35b0a6341 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d52f35fa1a9e87da1c1aebe39b1063a35b0a6341
Author: Antonio Gomes <antoniospg...@gmail.com> Date: Thu Jan 26 18:47:19 2023 -0300 iris: Fixups in resource_get_handle and resource_from_handle * Add support for PIPE_BUFFER in resource_from_handle. * Flush batches after reallocate_resource_inplace: If we're dealing with a PIPE_BUFFER, iris_flush_resource doesn't flush the batch and we export the resource with pending commands. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21305> --- src/gallium/drivers/iris/iris_resource.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 876ddf5dfbc..3ef5e6674f0 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1487,8 +1487,6 @@ iris_resource_from_handle(struct pipe_screen *pscreen, struct winsys_handle *whandle, unsigned usage) { - assert(templ->target != PIPE_BUFFER); - struct iris_screen *screen = (struct iris_screen *)pscreen; struct iris_bufmgr *bufmgr = screen->bufmgr; struct iris_resource *res = iris_alloc_resource(pscreen, templ); @@ -1523,6 +1521,11 @@ iris_resource_from_handle(struct pipe_screen *pscreen, res->offset = whandle->offset; res->external_format = whandle->format; + if (templ->target == PIPE_BUFFER) { + res->surf.tiling = ISL_TILING_LINEAR; + return &res->base.b; + } + /* Create a surface for each plane specified by the external format. */ if (whandle->plane < util_format_get_num_planes(whandle->format)) { const bool isl_surf_created_successfully = @@ -1721,6 +1724,10 @@ iris_reallocate_resource_inplace(struct iris_context *ice, } iris_flush_resource(&ice->ctx, &new_res->base.b); + iris_foreach_batch(ice, batch) { + if (iris_batch_references(batch, new_res->bo)) + iris_batch_flush(batch); + } struct iris_bo *old_bo = old_res->bo; struct iris_bo *old_aux_bo = old_res->aux.bo;