mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
drm/etnaviv: Add fdinfo support for memory stats
Use the new helper to export stats about memory usage. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
This commit is contained in:
parent
a807cb22ad
commit
6bef484c5e
|
|
@ -488,7 +488,16 @@ static const struct drm_ioctl_desc etnaviv_ioctls[] = {
|
|||
ETNA_IOCTL(PM_QUERY_SIG, pm_query_sig, DRM_RENDER_ALLOW),
|
||||
};
|
||||
|
||||
DEFINE_DRM_GEM_FOPS(fops);
|
||||
static void etnaviv_show_fdinfo(struct drm_printer *p, struct drm_file *file)
|
||||
{
|
||||
drm_show_memory_stats(p, file);
|
||||
}
|
||||
|
||||
static const struct file_operations fops = {
|
||||
.owner = THIS_MODULE,
|
||||
DRM_GEM_FOPS,
|
||||
.show_fdinfo = drm_show_fdinfo,
|
||||
};
|
||||
|
||||
static const struct drm_driver etnaviv_drm_driver = {
|
||||
.driver_features = DRIVER_GEM | DRIVER_RENDER,
|
||||
|
|
@ -498,6 +507,7 @@ static const struct drm_driver etnaviv_drm_driver = {
|
|||
#ifdef CONFIG_DEBUG_FS
|
||||
.debugfs_init = etnaviv_debugfs_init,
|
||||
#endif
|
||||
.show_fdinfo = etnaviv_show_fdinfo,
|
||||
.ioctls = etnaviv_ioctls,
|
||||
.num_ioctls = DRM_ETNAVIV_NUM_IOCTLS,
|
||||
.fops = &fops,
|
||||
|
|
|
|||
|
|
@ -540,6 +540,17 @@ void etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj)
|
|||
mutex_unlock(&priv->gem_lock);
|
||||
}
|
||||
|
||||
static enum drm_gem_object_status etnaviv_gem_status(struct drm_gem_object *obj)
|
||||
{
|
||||
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
|
||||
enum drm_gem_object_status status = 0;
|
||||
|
||||
if (etnaviv_obj->pages)
|
||||
status |= DRM_GEM_OBJECT_RESIDENT;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct vm_ops = {
|
||||
.fault = etnaviv_gem_fault,
|
||||
.open = drm_gem_vm_open,
|
||||
|
|
@ -553,6 +564,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
|
|||
.get_sg_table = etnaviv_gem_prime_get_sg_table,
|
||||
.vmap = etnaviv_gem_prime_vmap,
|
||||
.mmap = etnaviv_gem_mmap,
|
||||
.status = etnaviv_gem_status,
|
||||
.vm_ops = &vm_ops,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user