mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
rusticl/device: Fix reporting of global memory on mixed memory devices
AMD APUs are hitting this case where they have very small discrete VRAM,
but a lot of staging memory, which can be used additionally.
Fixes: 7487ac2046 ("rusticl/device: support query_memory_info to retrieve available memory")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30123>
This commit is contained in:
parent
97a137ac88
commit
58d45725c7
1 changed files with 11 additions and 3 deletions
|
|
@ -999,11 +999,19 @@ impl DeviceBase {
|
|||
|
||||
pub fn global_mem_size(&self) -> cl_ulong {
|
||||
if let Some(memory_info) = self.screen.query_memory_info() {
|
||||
let memory: cl_ulong = if memory_info.total_device_memory != 0 {
|
||||
memory_info.total_device_memory.into()
|
||||
let device_memory: cl_ulong = memory_info.total_device_memory.into();
|
||||
let staging_memory: cl_ulong = memory_info.total_staging_memory.into();
|
||||
|
||||
// In case some driver doesn't set uma correctly.
|
||||
let memory = if device_memory == 0 {
|
||||
staging_memory
|
||||
} else if self.unified_memory() {
|
||||
// For UMA devices we expose both.
|
||||
staging_memory + device_memory
|
||||
} else {
|
||||
memory_info.total_staging_memory.into()
|
||||
device_memory
|
||||
};
|
||||
|
||||
memory * 1024
|
||||
} else {
|
||||
self.screen.compute_caps().max_global_size
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue