mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
nouveau: add an ioctl to report vram usage
[ Upstream commit72fa02fdf8
] This reports the currently used vram allocations. userspace using this has been proposed for nvk, but it's a rather trivial uapi addition. Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Stable-dep-of:aed9a1a4f7
("drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
929eaf32dd
commit
6446c1ca2d
2 changed files with 12 additions and 0 deletions
|
@ -272,6 +272,11 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
|
||||||
case NOUVEAU_GETPARAM_VRAM_BAR_SIZE:
|
case NOUVEAU_GETPARAM_VRAM_BAR_SIZE:
|
||||||
getparam->value = nvkm_device->func->resource_size(nvkm_device, 1);
|
getparam->value = nvkm_device->func->resource_size(nvkm_device, 1);
|
||||||
break;
|
break;
|
||||||
|
case NOUVEAU_GETPARAM_VRAM_USED: {
|
||||||
|
struct ttm_resource_manager *vram_mgr = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
|
||||||
|
getparam->value = (u64)ttm_resource_manager_usage(vram_mgr) << PAGE_SHIFT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
|
NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -61,6 +61,13 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
|
#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOUVEAU_GETPARAM_VRAM_USED
|
||||||
|
*
|
||||||
|
* Get remaining VRAM size.
|
||||||
|
*/
|
||||||
|
#define NOUVEAU_GETPARAM_VRAM_USED 19
|
||||||
|
|
||||||
struct drm_nouveau_getparam {
|
struct drm_nouveau_getparam {
|
||||||
__u64 param;
|
__u64 param;
|
||||||
__u64 value;
|
__u64 value;
|
||||||
|
|
Loading…
Reference in a new issue