All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nv50: allocate more offset space for occlusion queries
@ 2015-04-04  4:00 Ilia Mirkin
       [not found] ` <1428120023-9598-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Ilia Mirkin @ 2015-04-04  4:00 UTC (permalink / raw)
  To: mesa-dev; +Cc: nouveau, 10.4 10.5

Commit 1a170980a09 started writing to q->data[4]/[5] but kept the
per-query space at 16, which meant that in some cases we would write
past the end of the buffer. Rotate by 32, like nvc0 does.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Nick Tenney <nick.tenney@gmail.com>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
---
 src/gallium/drivers/nouveau/nv50/nv50_query.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index e81ac5a..6a23de4 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -116,8 +116,8 @@ nv50_query_create(struct pipe_context *pipe, unsigned type, unsigned index)
    q->type = type;
 
    if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
-      q->offset -= 16;
-      q->data -= 16 / sizeof(*q->data); /* we advance before query_begin ! */
+      q->offset -= 32;
+      q->data -= 32 / sizeof(*q->data); /* we advance before query_begin ! */
    }
 
    return (struct pipe_query *)q;
@@ -150,8 +150,8 @@ nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
     * initialized it to TRUE.
     */
    if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
-      q->offset += 16;
-      q->data += 16 / sizeof(*q->data);
+      q->offset += 32;
+      q->data += 32 / sizeof(*q->data);
       if (q->offset - q->base == NV50_QUERY_ALLOC_SPACE)
          nv50_query_allocate(nv50, q, NV50_QUERY_ALLOC_SPACE);
 
-- 
2.0.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* Re: [Mesa-dev] [PATCH] nv50: allocate more offset space for occlusion queries
       [not found] ` <1428120023-9598-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
@ 2015-04-04 12:50   ` Samuel Pitoiset
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Pitoiset @ 2015-04-04 12:50 UTC (permalink / raw)
  To: Ilia Mirkin, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 10.4 10.5

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

But please, fix the comment in the nv50_query struct, now it is "/* base 
+ i * 32 */".

On 04/04/2015 06:00 AM, Ilia Mirkin wrote:
> Commit 1a170980a09 started writing to q->data[4]/[5] but kept the
> per-query space at 16, which meant that in some cases we would write
> past the end of the buffer. Rotate by 32, like nvc0 does.
>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Tested-by: Nick Tenney <nick.tenney@gmail.com>
> Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
> ---
>   src/gallium/drivers/nouveau/nv50/nv50_query.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> index e81ac5a..6a23de4 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> @@ -116,8 +116,8 @@ nv50_query_create(struct pipe_context *pipe, unsigned type, unsigned index)
>      q->type = type;
>   
>      if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
> -      q->offset -= 16;
> -      q->data -= 16 / sizeof(*q->data); /* we advance before query_begin ! */
> +      q->offset -= 32;
> +      q->data -= 32 / sizeof(*q->data); /* we advance before query_begin ! */
>      }
>   
>      return (struct pipe_query *)q;
> @@ -150,8 +150,8 @@ nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
>       * initialized it to TRUE.
>       */
>      if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
> -      q->offset += 16;
> -      q->data += 16 / sizeof(*q->data);
> +      q->offset += 32;
> +      q->data += 32 / sizeof(*q->data);
>         if (q->offset - q->base == NV50_QUERY_ALLOC_SPACE)
>            nv50_query_allocate(nv50, q, NV50_QUERY_ALLOC_SPACE);
>   

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2015-04-04 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-04  4:00 [PATCH] nv50: allocate more offset space for occlusion queries Ilia Mirkin
     [not found] ` <1428120023-9598-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-04-04 12:50   ` [Mesa-dev] " Samuel Pitoiset

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.