minigbm: amdgpu: use VRAM only for cursor and scanouts
Everything else should use GTT (USWC preferably). We should also switch scanouts to GTT after we enable display VM. BUG=b:69941535,b:69647975 TEST=run WebGL Aquarium on Kahlee Change-Id: I939b159551305f74102ba47eb551e2bed2e32e06 Signed-off-by: Dominik Behr <dbehr@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/801797 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
85c4c5f4ac
commit
fa17cdde2d
2 changed files with 21 additions and 2 deletions
16
amdgpu.c
16
amdgpu.c
|
|
@ -376,8 +376,20 @@ static int amdgpu_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint
|
|||
gem_create.in.bo_size = bo->total_size;
|
||||
gem_create.in.alignment = addr_out.baseAlign;
|
||||
/* Set the placement. */
|
||||
gem_create.in.domains = AMDGPU_GEM_DOMAIN_VRAM;
|
||||
gem_create.in.domain_flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
|
||||
|
||||
gem_create.in.domain_flags = 0;
|
||||
if (use_flags & (BO_USE_LINEAR | BO_USE_SW))
|
||||
gem_create.in.domain_flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
|
||||
|
||||
if (use_flags & (BO_USE_SCANOUT | BO_USE_CURSOR)) {
|
||||
/* TODO(dbehr) do not use VRAM after we enable display VM */
|
||||
gem_create.in.domains = AMDGPU_GEM_DOMAIN_VRAM;
|
||||
} else {
|
||||
gem_create.in.domains = AMDGPU_GEM_DOMAIN_GTT;
|
||||
if (!(use_flags & BO_USE_SW_READ_OFTEN))
|
||||
gem_create.in.domain_flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
|
||||
}
|
||||
|
||||
/* Allocate the buffer with the preferred heap. */
|
||||
ret = drmCommandWriteRead(drv_get_fd(bo->drv), DRM_AMDGPU_GEM_CREATE, &gem_create,
|
||||
sizeof(gem_create));
|
||||
|
|
|
|||
|
|
@ -85,6 +85,13 @@ struct backend {
|
|||
BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE
|
||||
|
||||
#define BO_USE_SW BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY
|
||||
|
||||
#define BO_USE_SW_OFTEN BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN
|
||||
|
||||
#define BO_USE_SW_RARELY BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY
|
||||
|
||||
#define LINEAR_METADATA (struct format_metadata) { 0, 1, DRM_FORMAT_MOD_NONE }
|
||||
// clang-format on
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue