All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/v3d: Fix BO stats accounting for dma-buf-imported buffers.
@ 2019-02-07 23:26 ` Eric Anholt
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Anholt @ 2019-02-07 23:26 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-kernel, david.emett, thomas.spurden, Eric Anholt

We always decrement at GEM free, so make sure we increment at GEM
creation for dma-bufs.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/v3d/v3d_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
index a08766d39eab..b1766f096c4b 100644
--- a/drivers/gpu/drm/v3d/v3d_bo.c
+++ b/drivers/gpu/drm/v3d/v3d_bo.c
@@ -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;
-- 
2.20.0.rc1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] drm/v3d: Fix BO stats accounting for dma-buf-imported buffers.
@ 2019-02-07 23:26 ` Eric Anholt
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Anholt @ 2019-02-07 23:26 UTC (permalink / raw)
  To: dri-devel; +Cc: david.emett, thomas.spurden, linux-kernel

We always decrement at GEM free, so make sure we increment at GEM
creation for dma-bufs.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/v3d/v3d_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
index a08766d39eab..b1766f096c4b 100644
--- a/drivers/gpu/drm/v3d/v3d_bo.c
+++ b/drivers/gpu/drm/v3d/v3d_bo.c
@@ -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;
-- 
2.20.0.rc1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/v3d: Fix BO stats accounting for dma-buf-imported buffers.
  2019-02-07 23:26 ` Eric Anholt
@ 2019-02-07 23:27   ` Daniel Vetter
  -1 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2019-02-07 23:27 UTC (permalink / raw)
  To: Eric Anholt; +Cc: dri-devel, david.emett, thomas.spurden, linux-kernel

On Thu, Feb 07, 2019 at 03:26:13PM -0800, Eric Anholt wrote:
> We always decrement at GEM free, so make sure we increment at GEM
> creation for dma-bufs.

Indeed. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/v3d/v3d_bo.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
> index a08766d39eab..b1766f096c4b 100644
> --- a/drivers/gpu/drm/v3d/v3d_bo.c
> +++ b/drivers/gpu/drm/v3d/v3d_bo.c
> @@ -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;
> -- 
> 2.20.0.rc1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/v3d: Fix BO stats accounting for dma-buf-imported buffers.
@ 2019-02-07 23:27   ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2019-02-07 23:27 UTC (permalink / raw)
  To: Eric Anholt; +Cc: david.emett, thomas.spurden, linux-kernel, dri-devel

On Thu, Feb 07, 2019 at 03:26:13PM -0800, Eric Anholt wrote:
> We always decrement at GEM free, so make sure we increment at GEM
> creation for dma-bufs.

Indeed. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/v3d/v3d_bo.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
> index a08766d39eab..b1766f096c4b 100644
> --- a/drivers/gpu/drm/v3d/v3d_bo.c
> +++ b/drivers/gpu/drm/v3d/v3d_bo.c
> @@ -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;
> -- 
> 2.20.0.rc1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/v3d: Fix BO stats accounting for dma-buf-imported buffers.
  2019-02-07 23:27   ` Daniel Vetter
  (?)
@ 2019-02-12 20:04   ` Eric Anholt
  -1 siblings, 0 replies; 5+ messages in thread
From: Eric Anholt @ 2019-02-12 20:04 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: dri-devel, david.emett, thomas.spurden, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

Daniel Vetter <daniel@ffwll.ch> writes:

> On Thu, Feb 07, 2019 at 03:26:13PM -0800, Eric Anholt wrote:
>> We always decrement at GEM free, so make sure we increment at GEM
>> creation for dma-bufs.
>
> Indeed. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Merged to drm-misc-next.  Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-12 20:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 23:26 [PATCH] drm/v3d: Fix BO stats accounting for dma-buf-imported buffers Eric Anholt
2019-02-07 23:26 ` Eric Anholt
2019-02-07 23:27 ` Daniel Vetter
2019-02-07 23:27   ` Daniel Vetter
2019-02-12 20:04   ` Eric Anholt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.