mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
gallium/radeon: move setting VRAM|GTT into winsyses
The combined VRAM|GTT heap will be removed. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
5e805cc74b
commit
9ac5504df5
5 changed files with 28 additions and 29 deletions
|
|
@ -176,20 +176,6 @@ void r600_init_resource_fields(struct r600_common_screen *rscreen,
|
|||
!(res->b.b.bind & PIPE_BIND_SCANOUT)))
|
||||
res->flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING;
|
||||
|
||||
/* If VRAM is just stolen system memory, allow both VRAM and
|
||||
* GTT, whichever has free space. If a buffer is evicted from
|
||||
* VRAM to GTT, it will stay there.
|
||||
*
|
||||
* DRM 3.6.0 has good BO move throttling, so we can allow VRAM-only
|
||||
* placements even with a low amount of stolen VRAM.
|
||||
*/
|
||||
if (!rscreen->info.has_dedicated_vram &&
|
||||
(rscreen->info.drm_major < 3 || rscreen->info.drm_minor < 6) &&
|
||||
res->domains == RADEON_DOMAIN_VRAM) {
|
||||
res->domains = RADEON_DOMAIN_VRAM_GTT;
|
||||
res->flags &= ~RADEON_FLAG_NO_CPU_ACCESS; /* disallowed with VRAM_GTT */
|
||||
}
|
||||
|
||||
if (rscreen->debug_flags & DBG_NO_WC)
|
||||
res->flags &= ~RADEON_FLAG_GTT_WC;
|
||||
|
||||
|
|
|
|||
|
|
@ -171,20 +171,6 @@ void si_init_resource_fields(struct si_screen *sscreen,
|
|||
else
|
||||
res->flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING;
|
||||
|
||||
/* If VRAM is just stolen system memory, allow both VRAM and
|
||||
* GTT, whichever has free space. If a buffer is evicted from
|
||||
* VRAM to GTT, it will stay there.
|
||||
*
|
||||
* DRM 3.6.0 has good BO move throttling, so we can allow VRAM-only
|
||||
* placements even with a low amount of stolen VRAM.
|
||||
*/
|
||||
if (!sscreen->info.has_dedicated_vram &&
|
||||
(sscreen->info.drm_major < 3 || sscreen->info.drm_minor < 6) &&
|
||||
res->domains == RADEON_DOMAIN_VRAM) {
|
||||
res->domains = RADEON_DOMAIN_VRAM_GTT;
|
||||
res->flags &= ~RADEON_FLAG_NO_CPU_ACCESS; /* disallowed with VRAM_GTT */
|
||||
}
|
||||
|
||||
if (sscreen->debug_flags & DBG(NO_WC))
|
||||
res->flags &= ~RADEON_FLAG_GTT_WC;
|
||||
|
||||
|
|
|
|||
|
|
@ -386,7 +386,9 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
|
|||
unsigned va_gap_size;
|
||||
int r;
|
||||
|
||||
assert(initial_domain & RADEON_DOMAIN_VRAM_GTT);
|
||||
/* VRAM or GTT must be specified, but not both at the same time. */
|
||||
assert(util_bitcount(initial_domain & RADEON_DOMAIN_VRAM_GTT) == 1);
|
||||
|
||||
bo = CALLOC_STRUCT(amdgpu_winsys_bo);
|
||||
if (!bo) {
|
||||
return NULL;
|
||||
|
|
@ -402,6 +404,16 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
|
|||
if (initial_domain & RADEON_DOMAIN_GTT)
|
||||
request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
|
||||
|
||||
/* If VRAM is just stolen system memory, allow both VRAM and
|
||||
* GTT, whichever has free space. If a buffer is evicted from
|
||||
* VRAM to GTT, it will stay there.
|
||||
*
|
||||
* DRM 3.6.0 has good BO move throttling, so we can allow VRAM-only
|
||||
* placements even with a low amount of stolen VRAM.
|
||||
*/
|
||||
if (!ws->info.has_dedicated_vram && ws->info.drm_minor < 6)
|
||||
request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
|
||||
|
||||
if (flags & RADEON_FLAG_NO_CPU_ACCESS)
|
||||
request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
|
||||
if (flags & RADEON_FLAG_GTT_WC)
|
||||
|
|
|
|||
|
|
@ -609,6 +609,13 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws,
|
|||
args.initial_domain = initial_domains;
|
||||
args.flags = 0;
|
||||
|
||||
/* If VRAM is just stolen system memory, allow both VRAM and
|
||||
* GTT, whichever has free space. If a buffer is evicted from
|
||||
* VRAM to GTT, it will stay there.
|
||||
*/
|
||||
if (!rws->info.has_dedicated_vram)
|
||||
args.initial_domain |= RADEON_DOMAIN_GTT;
|
||||
|
||||
if (flags & RADEON_FLAG_GTT_WC)
|
||||
args.flags |= RADEON_GEM_GTT_WC;
|
||||
if (flags & RADEON_FLAG_NO_CPU_ACCESS)
|
||||
|
|
|
|||
|
|
@ -338,6 +338,14 @@ static unsigned radeon_drm_cs_add_buffer(struct radeon_winsys_cs *rcs,
|
|||
struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
|
||||
struct radeon_bo *bo = (struct radeon_bo*)buf;
|
||||
enum radeon_bo_domain added_domains;
|
||||
|
||||
/* If VRAM is just stolen system memory, allow both VRAM and
|
||||
* GTT, whichever has free space. If a buffer is evicted from
|
||||
* VRAM to GTT, it will stay there.
|
||||
*/
|
||||
if (!cs->ws->info.has_dedicated_vram)
|
||||
domains |= RADEON_DOMAIN_GTT;
|
||||
|
||||
enum radeon_bo_domain rd = usage & RADEON_USAGE_READ ? domains : 0;
|
||||
enum radeon_bo_domain wd = usage & RADEON_USAGE_WRITE ? domains : 0;
|
||||
struct drm_radeon_cs_reloc *reloc;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue