Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mesa
Mesa branch archive
Commits
0a6d2593
Commit
0a6d2593
authored
Oct 25, 2019
by
Jason Ekstrand
Browse files
anv: Allocate descriptor buffers from the BO cache
Reviewed-by:
Lionel Landwerlin
<
lionel.g.landwerlin@intel.com
>
parent
e0ee2366
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/intel/vulkan/anv_descriptor_set.c
View file @
0a6d2593
...
...
@@ -663,7 +663,6 @@ VkResult anv_CreateDescriptorPool(
VkDescriptorPool
*
pDescriptorPool
)
{
ANV_FROM_HANDLE
(
anv_device
,
device
,
_device
);
const
struct
anv_physical_device
*
pdevice
=
&
device
->
instance
->
physicalDevice
;
struct
anv_descriptor_pool
*
pool
;
const
VkDescriptorPoolInlineUniformBlockCreateInfoEXT
*
inline_info
=
...
...
@@ -734,36 +733,19 @@ VkResult anv_CreateDescriptorPool(
pool
->
free_list
=
EMPTY
;
if
(
descriptor_bo_size
>
0
)
{
VkResult
result
=
anv_bo_init_new
(
&
pool
->
bo
,
device
,
descriptor_bo_size
);
VkResult
result
=
anv_device_alloc_bo
(
device
,
descriptor_bo_size
,
ANV_BO_ALLOC_MAPPED
|
ANV_BO_ALLOC_SNOOPED
,
&
pool
->
bo
);
if
(
result
!=
VK_SUCCESS
)
{
vk_free2
(
&
device
->
alloc
,
pAllocator
,
pool
);
return
result
;
}
anv_gem_set_caching
(
device
,
pool
->
bo
.
gem_handle
,
I915_CACHING_CACHED
);
pool
->
bo
.
map
=
anv_gem_mmap
(
device
,
pool
->
bo
.
gem_handle
,
0
,
descriptor_bo_size
,
0
);
if
(
pool
->
bo
.
map
==
NULL
)
{
anv_gem_close
(
device
,
pool
->
bo
.
gem_handle
);
vk_free2
(
&
device
->
alloc
,
pAllocator
,
pool
);
return
vk_error
(
VK_ERROR_OUT_OF_HOST_MEMORY
);
}
if
(
pdevice
->
supports_48bit_addresses
)
pool
->
bo
.
flags
|=
EXEC_OBJECT_SUPPORTS_48B_ADDRESS
;
if
(
pdevice
->
use_softpin
)
{
pool
->
bo
.
flags
|=
EXEC_OBJECT_PINNED
;
anv_vma_alloc
(
device
,
&
pool
->
bo
);
}
if
(
pdevice
->
has_exec_async
)
pool
->
bo
.
flags
|=
EXEC_OBJECT_ASYNC
;
util_vma_heap_init
(
&
pool
->
bo_heap
,
POOL_HEAP_OFFSET
,
descriptor_bo_size
);
}
else
{
pool
->
bo
.
size
=
0
;
pool
->
bo
=
NULL
;
}
anv_state_stream_init
(
&
pool
->
surface_state_stream
,
...
...
@@ -793,12 +775,8 @@ void anv_DestroyDescriptorPool(
anv_descriptor_set_layout_unref
(
device
,
set
->
layout
);
}
if
(
pool
->
bo
.
size
)
{
anv_gem_munmap
(
pool
->
bo
.
map
,
pool
->
bo
.
size
);
anv_vma_free
(
device
,
&
pool
->
bo
);
anv_gem_close
(
device
,
pool
->
bo
.
gem_handle
);
util_vma_heap_finish
(
&
pool
->
bo_heap
);
}
if
(
pool
->
bo
)
anv_device_release_bo
(
device
,
pool
->
bo
);
anv_state_stream_finish
(
&
pool
->
surface_state_stream
);
vk_free2
(
&
device
->
alloc
,
pAllocator
,
pool
);
...
...
@@ -821,9 +799,9 @@ VkResult anv_ResetDescriptorPool(
pool
->
next
=
0
;
pool
->
free_list
=
EMPTY
;
if
(
pool
->
bo
.
size
)
{
if
(
pool
->
bo
)
{
util_vma_heap_finish
(
&
pool
->
bo_heap
);
util_vma_heap_init
(
&
pool
->
bo_heap
,
POOL_HEAP_OFFSET
,
pool
->
bo
.
size
);
util_vma_heap_init
(
&
pool
->
bo_heap
,
POOL_HEAP_OFFSET
,
pool
->
bo
->
size
);
}
anv_state_stream_finish
(
&
pool
->
surface_state_stream
);
...
...
@@ -954,13 +932,13 @@ anv_descriptor_set_create(struct anv_device *device,
pool_vma_offset
-
POOL_HEAP_OFFSET
<=
INT32_MAX
);
set
->
desc_mem
.
offset
=
pool_vma_offset
-
POOL_HEAP_OFFSET
;
set
->
desc_mem
.
alloc_size
=
set_buffer_size
;
set
->
desc_mem
.
map
=
pool
->
bo
.
map
+
set
->
desc_mem
.
offset
;
set
->
desc_mem
.
map
=
pool
->
bo
->
map
+
set
->
desc_mem
.
offset
;
set
->
desc_surface_state
=
anv_descriptor_pool_alloc_state
(
pool
);
anv_fill_buffer_surface_state
(
device
,
set
->
desc_surface_state
,
ISL_FORMAT_R32G32B32A32_FLOAT
,
(
struct
anv_address
)
{
.
bo
=
&
pool
->
bo
,
.
bo
=
pool
->
bo
,
.
offset
=
set
->
desc_mem
.
offset
,
},
layout
->
descriptor_buffer_size
,
1
);
...
...
src/intel/vulkan/anv_private.h
View file @
0a6d2593
...
...
@@ -1889,7 +1889,7 @@ struct anv_descriptor_pool {
uint32_t
next
;
uint32_t
free_list
;
struct
anv_bo
bo
;
struct
anv_bo
*
bo
;
struct
util_vma_heap
bo_heap
;
struct
anv_state_stream
surface_state_stream
;
...
...
src/intel/vulkan/genX_cmd_buffer.c
View file @
0a6d2593
...
...
@@ -2103,7 +2103,7 @@ anv_descriptor_set_address(struct anv_cmd_buffer *cmd_buffer,
if
(
set
->
pool
)
{
/* This is a normal descriptor set */
return
(
struct
anv_address
)
{
.
bo
=
&
set
->
pool
->
bo
,
.
bo
=
set
->
pool
->
bo
,
.
offset
=
set
->
desc_mem
.
offset
,
};
}
else
{
...
...
Lionel Landwerlin
@llandwerlin
mentioned in commit
ec53c72f
·
Jan 06, 2021
mentioned in commit
ec53c72f
mentioned in commit ec53c72f58a4cb99d91b45930fd48ebc12d88cc2
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment