All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Gmeiner <christian.gmeiner@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: linux+etnaviv@armlinux.org.uk, etnaviv@lists.freedesktop.org,
	cphealy@gmail.com
Subject: [PATCH V5 06/25] drm/etnaviv: extend etnaviv_gpu_cmdbuf_new(..) with nr_pmrs
Date: Sun, 24 Sep 2017 15:15:24 +0200	[thread overview]
Message-ID: <20170924131543.4066-7-christian.gmeiner@gmail.com> (raw)
In-Reply-To: <20170924131543.4066-1-christian.gmeiner@gmail.com>

This commits extends etnaviv_gpu_cmdbuf_new(..) to define the number
of struct etnaviv_perfmon elements gets used.

Changes from v1 -> v2:
- make use of goto as requested by Lucas

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c     | 15 ++++++++++++++-
 drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h     |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c        |  2 +-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
index 633e0f07cbac..66ac79558bbd 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.c
@@ -19,6 +19,7 @@
 #include "etnaviv_cmdbuf.h"
 #include "etnaviv_gpu.h"
 #include "etnaviv_mmu.h"
+#include "etnaviv_perfmon.h"
 
 #define SUBALLOC_SIZE		SZ_256K
 #define SUBALLOC_GRANULE	SZ_4K
@@ -87,9 +88,10 @@ void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc)
 
 struct etnaviv_cmdbuf *
 etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
-		   size_t nr_bos)
+		   size_t nr_bos, size_t nr_pmrs)
 {
 	struct etnaviv_cmdbuf *cmdbuf;
+	struct etnaviv_perfmon_request *pmrs;
 	size_t sz = size_vstruct(nr_bos, sizeof(cmdbuf->bo_map[0]),
 				 sizeof(*cmdbuf));
 	int granule_offs, order, ret;
@@ -98,6 +100,12 @@ etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
 	if (!cmdbuf)
 		return NULL;
 
+	sz = sizeof(*pmrs) * nr_pmrs;
+	pmrs = kzalloc(sz, GFP_KERNEL);
+	if (!pmrs)
+		goto out_free_cmdbuf;
+
+	cmdbuf->pmrs = pmrs;
 	cmdbuf->suballoc = suballoc;
 	cmdbuf->size = size;
 
@@ -124,6 +132,10 @@ etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
 	cmdbuf->vaddr = suballoc->vaddr + cmdbuf->suballoc_offset;
 
 	return cmdbuf;
+
+out_free_cmdbuf:
+	kfree(cmdbuf);
+	return NULL;
 }
 
 void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
@@ -139,6 +151,7 @@ void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf)
 	suballoc->free_space = 1;
 	mutex_unlock(&suballoc->lock);
 	wake_up_all(&suballoc->free_event);
+	kfree(cmdbuf->pmrs);
 	kfree(cmdbuf);
 }
 
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
index 1b549f0d59a0..b6348b9f2a9d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
@@ -53,7 +53,7 @@ void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);
 
 struct etnaviv_cmdbuf *
 etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
-		   size_t nr_bos);
+		   size_t nr_bos, size_t nr_pmrs);
 void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf);
 
 u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index ee7069e93eda..9c57b14dfcbf 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -350,7 +350,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
 	stream = kvmalloc_array(1, args->stream_size, GFP_KERNEL);
 	cmdbuf = etnaviv_cmdbuf_new(gpu->cmdbuf_suballoc,
 				    ALIGN(args->stream_size, 8) + 8,
-				    args->nr_bos);
+				    args->nr_bos, 0);
 	if (!bos || !relocs || !stream || !cmdbuf) {
 		ret = -ENOMEM;
 		goto err_submit_cmds;
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index d3b7e665eca9..9372296b5b9c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -721,7 +721,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 	}
 
 	/* Create buffer: */
-	gpu->buffer = etnaviv_cmdbuf_new(gpu->cmdbuf_suballoc, PAGE_SIZE, 0);
+	gpu->buffer = etnaviv_cmdbuf_new(gpu->cmdbuf_suballoc, PAGE_SIZE, 0, 0);
 	if (!gpu->buffer) {
 		ret = -ENOMEM;
 		dev_err(gpu->dev, "could not create command buffer\n");
-- 
2.13.5

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

  parent reply	other threads:[~2017-09-24 13:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-24 13:15 [PATCH V5 00/25] drm/etnaviv: support performance counters Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 01/25] drm/etnaviv: use bitmap to keep track of events Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 02/25] drm/etnaviv: make it possible to allocate multiple events Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 03/25] drm/etnaviv: add infrastructure to query perf counter Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 04/25] drm/etnaviv: add uapi for perfmon feature Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 05/25] drm/etnaviv: add internal representation of perfmon_request Christian Gmeiner
2017-09-24 13:15 ` Christian Gmeiner [this message]
2017-09-24 13:15 ` [PATCH V5 07/25] drm/etnaviv: add performance monitor request validation Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 08/25] drm/etnaviv: copy pmrs from userspace Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 09/25] drm/etnaviv: add performance monitor request processing Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 10/25] drm/etnaviv: add 'sync point' support Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 11/25] drm/etnaviv: clear alloced event Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 12/25] drm/etnaviv: use 'sync points' for performance monitor requests Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 13/25] drm/etnaviv: add HI perf domain Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 14/25] drm/etnaviv: add PE " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 15/25] drm/etnaviv: add SH " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 16/25] drm/etnaviv: add PA " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 17/25] drm/etnaviv: add SE " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 18/25] drm/etnaviv: add RA " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 19/25] drm/etnaviv: add TX " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 20/25] drm/etnaviv: add MC " Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 21/25] drm/etnaviv: need to disable clock gating when doing profiling Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 22/25] drm/etnaviv: move disabling of debug registers to the GPU init path Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 23/25] drm/etnaviv: do not enable debug registers unconditionally Christian Gmeiner
2017-09-28  9:05   ` Lucas Stach
2017-09-28  9:16     ` Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 24/25] drm/etnaviv: enable debug registers on demand Christian Gmeiner
2017-09-24 13:15 ` [PATCH V5 25/25] drm/etnaviv: submit supports performance monitor requests Christian Gmeiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170924131543.4066-7-christian.gmeiner@gmail.com \
    --to=christian.gmeiner@gmail.com \
    --cc=cphealy@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.