[Mesa-dev] [PATCH 2/8] radeonsi: allow DMABUF exports for local buffers
Nicolai Hähnle
nhaehnle at gmail.com
Mon Dec 4 11:57:59 UTC 2017
On 01.12.2017 21:19, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Cc: 17.3 <mesa-stable at lists.freedesktop.org>
What's the use-case for this?
What if somebody exports as DMABUF, then re-imports in a different API
and exports as FD for inter-process sharing from there?
> ---
> src/gallium/drivers/radeon/r600_texture.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index 2aa47b5..7a5d704 100644
> --- a/src/gallium/drivers/radeon/r600_texture.c
> +++ b/src/gallium/drivers/radeon/r600_texture.c
> @@ -740,21 +740,23 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
> rtex->surface.bpe;
> slice_size = rtex->surface.u.gfx9.surf_slice_size;
> } else {
> offset = rtex->surface.u.legacy.level[0].offset;
> stride = rtex->surface.u.legacy.level[0].nblk_x *
> rtex->surface.bpe;
> slice_size = (uint64_t)rtex->surface.u.legacy.level[0].slice_size_dw * 4;
> }
> } else {
> /* Move a suballocated buffer into a non-suballocated allocation. */
> - if (sscreen->ws->buffer_is_suballocated(res->buf)) {
> + if (sscreen->ws->buffer_is_suballocated(res->buf) ||
> + (rtex->resource.flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
> + whandle->type != DRM_API_HANDLE_TYPE_KMS)) {
> assert(!res->b.is_shared);
>
> /* Allocate a new buffer with PIPE_BIND_SHARED. */
> struct pipe_resource templ = res->b.b;
> templ.bind |= PIPE_BIND_SHARED;
>
> struct pipe_resource *newb =
> screen->resource_create(screen, &templ);
> if (!newb)
> return false;
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list