On 18/07/17 04:08 PM, Marek Olšák wrote: > From: Marek Olšák <marek.olsak at amd.com> > > For lower overhead in the CS ioctl. > Winsys allocators are not used with interprocess-sharable resources. > > v2: It shouldn't crash anymore, but the kernel will reject the new flag. > --- > src/gallium/drivers/radeon/r600_buffer_common.c | 7 +++++ > src/gallium/drivers/radeon/radeon_winsys.h | 20 +++++++++++--- > src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 36 ++++++++++++++++--------- > src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 27 +++++++++++-------- > 4 files changed, 62 insertions(+), 28 deletions(-) > > diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c > index dd1c209..2747ac4 100644 > --- a/src/gallium/drivers/radeon/r600_buffer_common.c > +++ b/src/gallium/drivers/radeon/r600_buffer_common.c > @@ -160,20 +160,27 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen, > } > > /* Tiled textures are unmappable. Always put them in VRAM. */ > if ((res->b.b.target != PIPE_BUFFER && !rtex->surface.is_linear) || > res->flags & R600_RESOURCE_FLAG_UNMAPPABLE) { > res->domains = RADEON_DOMAIN_VRAM; > res->flags |= RADEON_FLAG_NO_CPU_ACCESS | > RADEON_FLAG_GTT_WC; > } > > + /* Only displayable single-sample textures can be shared between > + * processes. */ > + if (res->b.b.target == PIPE_BUFFER || > + res->b.b.nr_samples >= 2 || > + rtex->surface.micro_tile_mode != RADEON_MICRO_MODE_DISPLAY) > + res->flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING; We might want to share non-displayable textures at some point for performance, right? Will we still be able to flag some textures as non-shareable in that case? > diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > index 97bbe23..06b8198 100644 > --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > @@ -31,20 +31,24 @@ > > #include "amdgpu_cs.h" > > #include "os/os_time.h" > #include "state_tracker/drm_driver.h" > #include <amdgpu_drm.h> > #include <xf86drm.h> > #include <stdio.h> > #include <inttypes.h> > > +#ifndef AMDGPU_GEM_CREATE_NO_INTERPROCESS_SHARING > +#define AMDGPU_GEM_CREATE_NO_INTERPROCESS_SHARING (1 << 6) > +#endif I advise against the #ifndef check for this kind of thing, because it prevents the preprocessor from warning about conflicting definitions. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer