nouveau: enable PIPE_CAP_UMA when appropriate

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18172>
This commit is contained in:
Yusuf Khan 2022-10-05 21:38:04 -05:00 committed by Marge Bot
parent 9369b40725
commit 492ac88078
4 changed files with 19 additions and 2 deletions

View file

@ -17,6 +17,8 @@
#include <nouveau_drm.h>
#include <xf86drm.h>
#include <nvif/class.h>
#include <nvif/cl0080.h>
#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);

View file

@ -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;

View file

@ -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]) {

View file

@ -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]) {