mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-19 18:50:43 +02:00
nv50: Report actual VRAM size
v2: handle vram_size == 0 (Karol) Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10711>
This commit is contained in:
parent
bb61bfc90e
commit
66385d79dc
2 changed files with 22 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
#include "pipe/p_defines.h"
|
||||
#include "util/os_misc.h"
|
||||
|
||||
#include "drm-uapi/drm.h"
|
||||
#include <nouveau.h>
|
||||
|
|
@ -96,4 +97,23 @@ nv50_screen_create(struct nouveau_device *);
|
|||
extern struct nouveau_screen *
|
||||
nvc0_screen_create(struct nouveau_device *);
|
||||
|
||||
static inline uint64_t
|
||||
nouveau_device_get_global_mem_size(struct nouveau_device *dev)
|
||||
{
|
||||
uint64_t size = dev->vram_size;
|
||||
|
||||
if (!size) {
|
||||
os_get_available_system_memory(&size);
|
||||
size = MIN2(dev->gart_size, size);
|
||||
}
|
||||
|
||||
/* cap to 32 bit on nv50 and older */
|
||||
if (dev->chipset < 0xc0)
|
||||
size = MIN2(size, 1ull << 32);
|
||||
else
|
||||
size = MIN2(size, 1ull << 40);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -569,6 +569,7 @@ nv50_screen_get_compute_param(struct pipe_screen *pscreen,
|
|||
enum pipe_compute_cap param, void *data)
|
||||
{
|
||||
struct nv50_screen *screen = nv50_screen(pscreen);
|
||||
struct nouveau_device *dev = screen->base.device;
|
||||
|
||||
#define RET(x) do { \
|
||||
if (data) \
|
||||
|
|
@ -586,7 +587,7 @@ nv50_screen_get_compute_param(struct pipe_screen *pscreen,
|
|||
case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK:
|
||||
RET((uint64_t []) { 512 });
|
||||
case PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE: /* g0-15[] */
|
||||
RET((uint64_t []) { 1ULL << 32 });
|
||||
RET((uint64_t []) { nouveau_device_get_global_mem_size(dev) });
|
||||
case PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE: /* s[] */
|
||||
RET((uint64_t []) { 16 << 10 });
|
||||
case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE: /* l[] */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue