diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 96206eb93f8..bdd2b903dab 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -17,6 +17,8 @@ #include #include +#include +#include #include "nouveau_winsys.h" #include "nouveau_screen.h" @@ -243,6 +245,18 @@ nouveau_pushbuf_destroy(struct nouveau_pushbuf **push) nouveau_pushbuf_del(push); } +static bool +nouveau_check_for_uma(int chipset, struct nouveau_object *obj) +{ + struct nv_device_info_v0 info = { + .version = 0, + }; + + nouveau_object_mthd(obj, NV_DEVICE_V0_INFO, &info, sizeof(info)); + + return (info.platform == NV_DEVICE_INFO_V0_IGP) || (info.platform == NV_DEVICE_INFO_V0_SOC); +} + int nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) { @@ -399,6 +413,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_STREAM_OUTPUT | PIPE_BIND_COMMAND_ARGS_BUFFER; + screen->is_uma = nouveau_check_for_uma(dev->chipset, &dev->object); + memset(&mm_config, 0, sizeof(mm_config)); nouveau_fence_list_init(&screen->fence); diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h index eafeeb91b7e..d9ca25282a0 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -68,6 +68,7 @@ struct nouveau_screen { bool prefer_nir; bool force_enable_cl; bool has_svm; + bool is_uma; bool disable_fences; void *svm_cutout; size_t svm_cutout_size; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 8efea26757f..c887c68b3bc 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -431,7 +431,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VIDEO_MEMORY: return dev->vram_size >> 20; case PIPE_CAP_UMA: - return 0; + return nouveau_screen(pscreen)->is_uma; default: if (!debug_cap_printed[param]) { diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index e4a30e9e674..000f24aa10c 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -451,7 +451,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VIDEO_MEMORY: return dev->vram_size >> 20; case PIPE_CAP_UMA: - return 0; + return nouveau_screen(pscreen)->is_uma; default: if (!debug_cap_printed[param]) {