From: Samuel Pitoiset <samuel.pitoiset@gmail.com>
To: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
"mesa-dev@lists.freedesktop.org" <mesa-dev@lists.freedesktop.org>
Subject: Re: [Nouveau] [RFC PATCH 3/8] nv50: allocate and map a notifier buffer object for PM
Date: Sun, 28 Jun 2015 09:42:29 +0200 [thread overview]
Message-ID: <558FA565.9060009@gmail.com> (raw)
In-Reply-To: <CAKb7UvjVFFyPNjqUcr-j87awuV1mR9xKRBVYdyWg3Wi+MsgLmw@mail.gmail.com>
On 06/26/2015 01:02 AM, Ilia Mirkin wrote:
> On Mon, Jun 22, 2015 at 4:53 PM, Samuel Pitoiset
> <samuel.pitoiset@gmail.com> wrote:
>> This notifier buffer object will be used to read back global performance
>> counters results written by the kernel.
>>
>> For each domain, we will store the handle of the perfdom object, an
>> array of 4 counters and the number of cycles. Like the Gallium's HUD,
>> we keep a list of busy queries in a ring in order to prevent stalls
>> when reading queries.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>> ---
>> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 29 ++++++++++++++++++++++++++
>> src/gallium/drivers/nouveau/nv50/nv50_screen.h | 6 ++++++
>> 2 files changed, 35 insertions(+)
>>
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> index c985344..3a99cc8 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> @@ -368,6 +368,7 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
>> nouveau_object_del(&screen->m2mf);
>> nouveau_object_del(&screen->sync);
>> nouveau_object_del(&screen->sw);
>> + nouveau_object_del(&screen->query);
>>
>> nouveau_screen_fini(&screen->base);
>>
>> @@ -699,9 +700,11 @@ nv50_screen_create(struct nouveau_device *dev)
>> struct nv50_screen *screen;
>> struct pipe_screen *pscreen;
>> struct nouveau_object *chan;
>> + struct nv04_fifo *fifo;
>> uint64_t value;
>> uint32_t tesla_class;
>> unsigned stack_size;
>> + uint32_t length;
>> int ret;
>>
>> screen = CALLOC_STRUCT(nv50_screen);
>> @@ -727,6 +730,7 @@ nv50_screen_create(struct nouveau_device *dev)
>> screen->base.pushbuf->rsvd_kick = 5;
>>
>> chan = screen->base.channel;
>> + fifo = chan->data;
>>
>> pscreen->destroy = nv50_screen_destroy;
>> pscreen->context_create = nv50_create;
>> @@ -772,6 +776,23 @@ nv50_screen_create(struct nouveau_device *dev)
>> goto fail;
>> }
>>
>> + /* Compute size (in bytes) of the notifier buffer object which is used
>> + * in order to read back global performance counters results written
>> + * by the kernel. For each domain, we store the handle of the perfdom
>> + * object, an array of 4 counters and the number of cycles. Like for
>> + * the Gallium's HUD, we keep a list of busy queries in a ring in order
>> + * to prevent stalls when reading queries. */
>> + length = (1 + (NV50_HW_PM_RING_BUFFER_NUM_DOMAINS * 6) *
>> + NV50_HW_PM_RING_BUFFER_MAX_QUERIES) * 4;
> This calculation may become apparent to me later, but it certainly
> isn't now. What's the *6? You refer to an array of 4 counters...
> should that have been 6 counters? Or should this have been a 4?
This refers to the handle of the object, the array of 4 counters and the
number of cycles.
In other words, for each domain we store: id, ctr0, ctr1, ctr2, ctr3, clk.
>
>> +
>> + ret = nouveau_object_new(chan, 0xbeef0302, NOUVEAU_NOTIFIER_CLASS,
>> + &(struct nv04_notify){ .length = length },
>> + sizeof(struct nv04_notify), &screen->query);
>> + if (ret) {
>> + NOUVEAU_ERR("Failed to allocate notifier object for PM: %d\n", ret);
>> + goto fail;
>> + }
>> +
>> ret = nouveau_object_new(chan, 0xbeef506e, 0x506e,
>> NULL, 0, &screen->sw);
>> if (ret) {
>> @@ -845,6 +866,14 @@ nv50_screen_create(struct nouveau_device *dev)
>> nouveau_heap_init(&screen->gp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2);
>> nouveau_heap_init(&screen->fp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2);
>>
>> + ret = nouveau_bo_wrap(screen->base.device, fifo->notify, &screen->notify_bo);
>> + if (ret == 0)
>> + nouveau_bo_map(screen->notify_bo, 0, screen->base.client);
> ret = ...
Good catch, thanks.
>
>> + if (ret) {
>> + NOUVEAU_ERR("Failed to map notifier object for PM: %d\n", ret);
>> + goto fail;
>> + }
>> +
>> nouveau_getparam(dev, NOUVEAU_GETPARAM_GRAPH_UNITS, &value);
>>
>> screen->TPs = util_bitcount(value & 0xffff);
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.h b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
>> index 69fdfdb..71a5247 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.h
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
>> @@ -59,6 +59,7 @@ struct nv50_screen {
>> struct nouveau_bo *txc; /* TIC (offset 0) and TSC (65536) */
>> struct nouveau_bo *stack_bo;
>> struct nouveau_bo *tls_bo;
>> + struct nouveau_bo *notify_bo;
>>
>> unsigned TPs;
>> unsigned MPsInTP;
>> @@ -89,6 +90,7 @@ struct nv50_screen {
>> } fence;
>>
>> struct nouveau_object *sync;
>> + struct nouveau_object *query;
>>
>> struct nouveau_object *tesla;
>> struct nouveau_object *eng2d;
>> @@ -96,6 +98,10 @@ struct nv50_screen {
>> struct nouveau_object *sw;
>> };
>>
>> +/* Parameters of the ring buffer used to read back global PM counters. */
>> +#define NV50_HW_PM_RING_BUFFER_NUM_DOMAINS 8
>> +#define NV50_HW_PM_RING_BUFFER_MAX_QUERIES 9 /* HUD_NUM_QUERIES + 1 */
>> +
>> static INLINE struct nv50_screen *
>> nv50_screen(struct pipe_screen *screen)
>> {
>> --
>> 2.4.4
>>
>> _______________________________________________
>> Nouveau mailing list
>> Nouveau@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
next prev parent reply other threads:[~2015-06-28 7:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-22 20:53 [RFC PATCH 0/8] nv50: expose global performance counters Samuel Pitoiset
2015-06-22 20:53 ` [RFC PATCH 1/8] nouveau: implement the nvif hardware performance counters interface Samuel Pitoiset
[not found] ` <1435006399-2088-1-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-22 20:53 ` [RFC PATCH 2/8] nv50: allocate a software object class Samuel Pitoiset
2015-06-22 20:53 ` [RFC PATCH 3/8] nv50: allocate and map a notifier buffer object for PM Samuel Pitoiset
[not found] ` <1435006399-2088-4-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-25 23:02 ` Ilia Mirkin
2015-06-28 7:42 ` Samuel Pitoiset [this message]
2015-06-22 20:53 ` [RFC PATCH 8/8] nv50: enable GL_AMD_performance_monitor Samuel Pitoiset
2015-06-22 20:53 ` [RFC PATCH 4/8] nv50: configure the ring buffer for reading back PM counters Samuel Pitoiset
[not found] ` <1435006399-2088-5-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-25 23:04 ` Ilia Mirkin
[not found] ` <CAKb7UvgZ8km4FPKkmcpU_4-yGNZ1ELy+uP5YJO_RZ-Ab6v6t9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-28 7:45 ` Samuel Pitoiset
2015-06-22 20:53 ` [RFC PATCH 5/8] nv50: prevent NULL pointer dereference with pipe_query functions Samuel Pitoiset
[not found] ` <1435006399-2088-6-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-22 20:52 ` Ilia Mirkin
2015-06-22 21:02 ` [Nouveau] " Samuel Pitoiset
[not found] ` <558877D9.8040501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-23 6:57 ` [Mesa-dev] " Michel Dänzer
[not found] ` <55890375.10901-otUistvHUpPR7s880joybQ@public.gmane.org>
2015-06-23 7:28 ` Samuel Pitoiset
2015-06-22 20:53 ` [RFC PATCH 6/8] nv50: add support for compute/graphics global performance counters Samuel Pitoiset
2015-06-25 23:09 ` [Nouveau] " Ilia Mirkin
[not found] ` <CAKb7Uvg4DpTHoK0K-tywYaX=9=UfxKnQTz-hbvCngn1-jnQaiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-28 7:54 ` Samuel Pitoiset
2015-06-22 20:53 ` [RFC PATCH 7/8] nv50: expose global performance counters to the HUD Samuel Pitoiset
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=558FA565.9060009@gmail.com \
--to=samuel.pitoiset@gmail.com \
--cc=imirkin@alum.mit.edu \
--cc=mesa-dev@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
/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.