Commit cc3f60cf authored by Eric Anholt's avatar Eric Anholt Committed by Maxime Ripard

drm/v3d: Fix BO stats accounting for dma-buf-imported buffers.

We always decrement at GEM free, so make sure we increment at GEM
creation for dma-bufs.
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190207232613.24981-1-eric@anholt.netReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
parent 6649a95d
......@@ -282,6 +282,7 @@ v3d_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach,
struct sg_table *sgt)
{
struct v3d_dev *v3d = to_v3d_dev(dev);
struct drm_gem_object *obj;
struct v3d_bo *bo;
......@@ -296,6 +297,11 @@ v3d_prime_import_sg_table(struct drm_device *dev,
obj->import_attach = attach;
v3d_bo_get_pages(bo);
mutex_lock(&v3d->bo_lock);
v3d->bo_stats.num_allocated++;
v3d->bo_stats.pages_allocated += obj->size >> PAGE_SHIFT;
mutex_unlock(&v3d->bo_lock);
v3d_mmu_insert_ptes(bo);
return obj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment