radeonsi: don't reallocate on DMABUF export if local BOs are disabled

This commit is contained in:
Marek Olšák 2018-03-15 15:58:57 -04:00
parent 56b867395d
commit 769603564e
4 changed files with 9 additions and 5 deletions

View file

@ -313,6 +313,8 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
info->has_syncobj_wait_for_submit = info->has_syncobj && info->drm_minor >= 20;
info->has_fence_to_handle = info->has_syncobj && info->drm_minor >= 21;
info->has_ctx_priority = info->drm_minor >= 22;
/* TODO: Enable this once the kernel handles it efficiently. */
/*info->has_local_buffers = ws->info.drm_minor >= 20;*/
info->num_render_backends = amdinfo->rb_pipes;
info->clock_crystal_freq = amdinfo->gpu_counter_freq;
if (!info->clock_crystal_freq) {

View file

@ -89,6 +89,7 @@ struct radeon_info {
bool has_syncobj_wait_for_submit;
bool has_fence_to_handle;
bool has_ctx_priority;
bool has_local_buffers;
/* Shader cores. */
uint32_t r600_max_quad_pipes; /* wave size / 16 */

View file

@ -701,6 +701,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
if (sscreen->ws->buffer_is_suballocated(res->buf) ||
rtex->surface.tile_swizzle ||
(rtex->resource.flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
sscreen->info.has_local_buffers &&
whandle->type != DRM_API_HANDLE_TYPE_KMS)) {
assert(!res->b.is_shared);
r600_reallocate_texture_inplace(rctx, rtex,
@ -762,7 +763,8 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
/* Move a suballocated buffer into a non-suballocated allocation. */
if (sscreen->ws->buffer_is_suballocated(res->buf) ||
/* A DMABUF export always fails if the BO is local. */
rtex->resource.flags & RADEON_FLAG_NO_INTERPROCESS_SHARING) {
(rtex->resource.flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
sscreen->info.has_local_buffers)) {
assert(!res->b.is_shared);
/* Allocate a new buffer with PIPE_BIND_SHARED. */

View file

@ -423,10 +423,9 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
if (flags & RADEON_FLAG_GTT_WC)
request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
/* TODO: Enable this once the kernel handles it efficiently. */
/*if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
ws->info.drm_minor >= 20)
request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID;*/
if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
ws->info.has_local_buffers)
request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID;
r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle);
if (r) {