On 06/27/2014 07:34 AM, Ilia Mirkin wrote:
On Fri, Jun 27, 2014 at 9:31 AM, Brian Paul <bri...@vmware.com> wrote:
On 06/26/2014 10:40 PM, Ilia Mirkin wrote:

Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
---
   src/gallium/auxiliary/hud/hud_driver_query.c         | 6 +++---
   src/gallium/drivers/freedreno/freedreno_query.c      | 2 +-
   src/gallium/drivers/galahad/glhd_context.c           | 6 ++++--
   src/gallium/drivers/i915/i915_query.c                | 3 ++-
   src/gallium/drivers/identity/id_context.c            | 6 ++++--
   src/gallium/drivers/ilo/ilo_query.c                  | 2 +-
   src/gallium/drivers/llvmpipe/lp_query.c              | 3 ++-
   src/gallium/drivers/noop/noop_pipe.c                 | 2 +-
   src/gallium/drivers/nouveau/nv30/nv30_query.c        | 2 +-
   src/gallium/drivers/nouveau/nv50/nv50_query.c        | 2 +-
   src/gallium/drivers/nouveau/nv50/nv50_state.c        | 2 +-
   src/gallium/drivers/nouveau/nvc0/nvc0_query.c        | 2 +-
   src/gallium/drivers/nouveau/nvc0/nvc0_state.c        | 2 +-
   src/gallium/drivers/r300/r300_query.c                | 3 ++-
   src/gallium/drivers/radeon/r600_query.c              | 2 +-
   src/gallium/drivers/rbug/rbug_context.c              | 6 ++++--
   src/gallium/drivers/softpipe/sp_query.c              | 3 ++-
   src/gallium/drivers/svga/svga_pipe_query.c           | 4 +++-
   src/gallium/drivers/trace/tr_context.c               | 6 ++++--
   src/gallium/include/pipe/p_context.h                 | 3 ++-
   src/gallium/state_trackers/clover/core/timestamp.cpp | 2 +-
   src/gallium/tests/graw/occlusion-query.c             | 4 ++--
   src/gallium/tools/trace/dump_state.py                | 2 +-
   src/mesa/state_tracker/st_cb_queryobj.c              | 6 +++---
   24 files changed, 48 insertions(+), 33 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c
b/src/gallium/auxiliary/hud/hud_driver_query.c
index 0f52e18..b48708c 100644
--- a/src/gallium/auxiliary/hud/hud_driver_query.c
+++ b/src/gallium/auxiliary/hud/hud_driver_query.c
@@ -90,7 +90,7 @@ query_new_value(struct hud_graph *gr)
                          NUM_QUERIES);
                  pipe->destroy_query(pipe, info->query[info->head]);
                  info->query[info->head] =
-                     pipe->create_query(pipe, info->query_type);
+                     pipe->create_query(pipe, info->query_type, 0);
               }
               else {
                  /* the last query is busy, we need to add a new one we
can use
@@ -98,7 +98,7 @@ query_new_value(struct hud_graph *gr)
                  info->head = (info->head+1) % NUM_QUERIES;
                  if (!info->query[info->head]) {
                     info->query[info->head] =
-                        pipe->create_query(pipe, info->query_type);
+                        pipe->create_query(pipe, info->query_type, 0);
                  }
               }
               break;
@@ -119,7 +119,7 @@ query_new_value(struct hud_graph *gr)
      else {
         /* initialize */
         info->last_time = now;
-      info->query[info->head] = pipe->create_query(pipe,
info->query_type);
+      info->query[info->head] = pipe->create_query(pipe,
info->query_type, 0);
         pipe->begin_query(pipe, info->query[info->head]);
      }
   }
diff --git a/src/gallium/drivers/freedreno/freedreno_query.c
b/src/gallium/drivers/freedreno/freedreno_query.c
index 8753a4b..952bb81 100644
--- a/src/gallium/drivers/freedreno/freedreno_query.c
+++ b/src/gallium/drivers/freedreno/freedreno_query.c
@@ -40,7 +40,7 @@
    */

   static struct pipe_query *
-fd_create_query(struct pipe_context *pctx, unsigned query_type)
+fd_create_query(struct pipe_context *pctx, unsigned query_type, unsigned
stream)
   {
         struct fd_context *ctx = fd_context(pctx);
         struct fd_query *q;
diff --git a/src/gallium/drivers/galahad/glhd_context.c
b/src/gallium/drivers/galahad/glhd_context.c
index 2e61e59..3f58b21 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -63,7 +63,8 @@ galahad_context_draw_vbo(struct pipe_context *_pipe,

   static struct pipe_query *
   galahad_context_create_query(struct pipe_context *_pipe,
-                      unsigned query_type)
+                             unsigned query_type,
+                             unsigned stream)
   {
      struct galahad_context *glhd_pipe = galahad_context(_pipe);
      struct pipe_context *pipe = glhd_pipe->pipe;
@@ -79,7 +80,8 @@ galahad_context_create_query(struct pipe_context *_pipe,
      }

      return pipe->create_query(pipe,
-                             query_type);
+                             query_type,
+                             stream);
   }

   static void
diff --git a/src/gallium/drivers/i915/i915_query.c
b/src/gallium/drivers/i915/i915_query.c
index 0efceb1..e05c0b9 100644
--- a/src/gallium/drivers/i915/i915_query.c
+++ b/src/gallium/drivers/i915/i915_query.c
@@ -40,7 +40,8 @@ struct i915_query
   };

   static struct pipe_query *i915_create_query(struct pipe_context *ctx,
-                                            unsigned query_type)
+                                            unsigned query_type,
+                                            unsigned stream)
   {
      struct i915_query *query = CALLOC_STRUCT( i915_query );

diff --git a/src/gallium/drivers/identity/id_context.c
b/src/gallium/drivers/identity/id_context.c
index 00414b8..31f8e60 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -57,13 +57,15 @@ identity_draw_vbo(struct pipe_context *_pipe,

   static struct pipe_query *
   identity_create_query(struct pipe_context *_pipe,
-                      unsigned query_type)
+                      unsigned query_type,
+                      unsigned stream)
   {
      struct identity_context *id_pipe = identity_context(_pipe);
      struct pipe_context *pipe = id_pipe->pipe;

      return pipe->create_query(pipe,
-                             query_type);
+                             query_type,
+                             stream);
   }

   static void
diff --git a/src/gallium/drivers/ilo/ilo_query.c
b/src/gallium/drivers/ilo/ilo_query.c
index 71bcc0f..cb02bf3 100644
--- a/src/gallium/drivers/ilo/ilo_query.c
+++ b/src/gallium/drivers/ilo/ilo_query.c
@@ -70,7 +70,7 @@ ilo_query(struct pipe_query *query)
   }

   static struct pipe_query *
-ilo_create_query(struct pipe_context *pipe, unsigned query_type)
+ilo_create_query(struct pipe_context *pipe, unsigned query_type, unsigned
stream)
   {
      struct ilo_query *q;

diff --git a/src/gallium/drivers/llvmpipe/lp_query.c
b/src/gallium/drivers/llvmpipe/lp_query.c
index 2bc9c1a..0ee168f 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -50,7 +50,8 @@ static struct llvmpipe_query *llvmpipe_query( struct
pipe_query *p )

   static struct pipe_query *
   llvmpipe_create_query(struct pipe_context *pipe,
-                      unsigned type)
+                      unsigned type,
+                      unsigned stream)
   {
      struct llvmpipe_query *pq;

diff --git a/src/gallium/drivers/noop/noop_pipe.c
b/src/gallium/drivers/noop/noop_pipe.c
index 27197a5..44dbe1c 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -46,7 +46,7 @@ struct noop_pipe_screen {
   struct noop_query {
         unsigned        query;
   };
-static struct pipe_query *noop_create_query(struct pipe_context *ctx,
unsigned query_type)
+static struct pipe_query *noop_create_query(struct pipe_context *ctx,
unsigned query_type, unsigned stream)
   {
         struct noop_query *query = CALLOC_STRUCT(noop_query);

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_query.c
b/src/gallium/drivers/nouveau/nv30/nv30_query.c
index 01b3817..bc7e764 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_query.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_query.c
@@ -105,7 +105,7 @@ nv30_query(struct pipe_query *pipe)
   }

   static struct pipe_query *
-nv30_query_create(struct pipe_context *pipe, unsigned type)
+nv30_query_create(struct pipe_context *pipe, unsigned type, unsigned
stream)
   {
      struct nv30_query *q = CALLOC_STRUCT(nv30_query);
      if (!q)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index 6a17139..8cac38f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -96,7 +96,7 @@ nv50_query_destroy(struct pipe_context *pipe, struct
pipe_query *pq)
   }

   static struct pipe_query *
-nv50_query_create(struct pipe_context *pipe, unsigned type)
+nv50_query_create(struct pipe_context *pipe, unsigned type, unsigned
stream)
   {
      struct nv50_context *nv50 = nv50_context(pipe);
      struct nv50_query *q;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c
b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index d0bc7ff..915ee26 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -1028,7 +1028,7 @@ nv50_so_target_create(struct pipe_context *pipe,

      if (nouveau_context(pipe)->screen->class_3d >= NVA0_3D_CLASS) {
         targ->pq = pipe->create_query(pipe,
-
NVA0_QUERY_STREAM_OUTPUT_BUFFER_OFFSET);
+
NVA0_QUERY_STREAM_OUTPUT_BUFFER_OFFSET, 0);
         if (!targ->pq) {
            FREE(targ);
            return NULL;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 856f685..5ed22f2 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -108,7 +108,7 @@ nvc0_query_destroy(struct pipe_context *pipe, struct
pipe_query *pq)
   }

   static struct pipe_query *
-nvc0_query_create(struct pipe_context *pipe, unsigned type)
+nvc0_query_create(struct pipe_context *pipe, unsigned type, unsigned
stream)
   {
      struct nvc0_context *nvc0 = nvc0_context(pipe);
      struct nvc0_query *q;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index c92aaac..ef9d479 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -1022,7 +1022,7 @@ nvc0_so_target_create(struct pipe_context *pipe,
      if (!targ)
         return NULL;

-   targ->pq = pipe->create_query(pipe, NVC0_QUERY_TFB_BUFFER_OFFSET);
+   targ->pq = pipe->create_query(pipe, NVC0_QUERY_TFB_BUFFER_OFFSET, 0);
      if (!targ->pq) {
         FREE(targ);
         return NULL;
diff --git a/src/gallium/drivers/r300/r300_query.c
b/src/gallium/drivers/r300/r300_query.c
index fbf44c6..05b54b9 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -30,7 +30,8 @@
   #include <stdio.h>

   static struct pipe_query *r300_create_query(struct pipe_context *pipe,
-                                            unsigned query_type)
+                                            unsigned query_type,
+                                            unsigned stream)
   {
       struct r300_context *r300 = r300_context(pipe);
       struct r300_screen *r300screen = r300->screen;
diff --git a/src/gallium/drivers/radeon/r600_query.c
b/src/gallium/drivers/radeon/r600_query.c
index c439441..ac126ea 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -346,7 +346,7 @@ static void r600_emit_query_predication(struct
r600_common_context *ctx, struct
         }
   }

-static struct pipe_query *r600_create_query(struct pipe_context *ctx,
unsigned query_type)
+static struct pipe_query *r600_create_query(struct pipe_context *ctx,
unsigned query_type, unsigned stream)
   {
         struct r600_common_context *rctx = (struct r600_common_context
*)ctx;
         struct r600_query *query;
diff --git a/src/gallium/drivers/rbug/rbug_context.c
b/src/gallium/drivers/rbug/rbug_context.c
index 2b99ddd..91254f0 100644
--- a/src/gallium/drivers/rbug/rbug_context.c
+++ b/src/gallium/drivers/rbug/rbug_context.c
@@ -134,14 +134,16 @@ rbug_draw_vbo(struct pipe_context *_pipe, const
struct pipe_draw_info *info)

   static struct pipe_query *
   rbug_create_query(struct pipe_context *_pipe,
-                  unsigned query_type)
+                  unsigned query_type,
+                  unsigned stream)
   {
      struct rbug_context *rb_pipe = rbug_context(_pipe);
      struct pipe_context *pipe = rb_pipe->pipe;

      pipe_mutex_lock(rb_pipe->call_mutex);
      return pipe->create_query(pipe,
-                             query_type);
+                             query_type,
+                             stream);
      pipe_mutex_unlock(rb_pipe->call_mutex);
   }

diff --git a/src/gallium/drivers/softpipe/sp_query.c
b/src/gallium/drivers/softpipe/sp_query.c
index 8822370..647da8b 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -53,7 +53,8 @@ static struct softpipe_query *softpipe_query( struct
pipe_query *p )

   static struct pipe_query *
   softpipe_create_query(struct pipe_context *pipe,
-                     unsigned type)
+                     unsigned type,
+                      unsigned stream)
   {
      struct softpipe_query* sq;

diff --git a/src/gallium/drivers/svga/svga_pipe_query.c
b/src/gallium/drivers/svga/svga_pipe_query.c
index 0283aa9..76d485b 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -74,7 +74,9 @@ svga_get_query_result(struct pipe_context *pipe,


   static struct pipe_query *
-svga_create_query( struct pipe_context *pipe, unsigned query_type )
+svga_create_query(struct pipe_context *pipe,
+                  unsigned query_type,
+                  unsigned stream)
   {
      struct svga_context *svga = svga_context( pipe );
      struct svga_screen *svgascreen = svga_screen(pipe->screen);
diff --git a/src/gallium/drivers/trace/tr_context.c
b/src/gallium/drivers/trace/tr_context.c
index 3e99598..35301ab 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -127,7 +127,8 @@ trace_context_draw_vbo(struct pipe_context *_pipe,

   static INLINE struct pipe_query *
   trace_context_create_query(struct pipe_context *_pipe,
-                           unsigned query_type)
+                           unsigned query_type,
+                           unsigned stream)
   {
      struct trace_context *tr_ctx = trace_context(_pipe);
      struct pipe_context *pipe = tr_ctx->pipe;
@@ -137,8 +138,9 @@ trace_context_create_query(struct pipe_context *_pipe,

      trace_dump_arg(ptr, pipe);
      trace_dump_arg(query_type, query_type);
+   trace_dump_arg(int, stream);

-   query = pipe->create_query(pipe, query_type);
+   query = pipe->create_query(pipe, query_type, stream);

      trace_dump_ret(ptr, query);

diff --git a/src/gallium/include/pipe/p_context.h
b/src/gallium/include/pipe/p_context.h
index bc43530..5b7532c 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -109,7 +109,8 @@ struct pipe_context {
       */
      /*@{*/
      struct pipe_query *(*create_query)( struct pipe_context *pipe,
-                                       unsigned query_type );
+                                       unsigned query_type,
+                                       unsigned stream );

      void (*destroy_query)(struct pipe_context *pipe,
                            struct pipe_query *q);
diff --git a/src/gallium/state_trackers/clover/core/timestamp.cpp
b/src/gallium/state_trackers/clover/core/timestamp.cpp
index f168d61..481c4f9 100644
--- a/src/gallium/state_trackers/clover/core/timestamp.cpp
+++ b/src/gallium/state_trackers/clover/core/timestamp.cpp
@@ -29,7 +29,7 @@ using namespace clover;

   timestamp::query::query(command_queue &q) :
      q(q),
-   _query(q.pipe->create_query(q.pipe, PIPE_QUERY_TIMESTAMP)) {
+   _query(q.pipe->create_query(q.pipe, PIPE_QUERY_TIMESTAMP, 0)) {
   }

   timestamp::query::query(query &&other) :
diff --git a/src/gallium/tests/graw/occlusion-query.c
b/src/gallium/tests/graw/occlusion-query.c
index f5227e3..d03934f 100644
--- a/src/gallium/tests/graw/occlusion-query.c
+++ b/src/gallium/tests/graw/occlusion-query.c
@@ -169,8 +169,8 @@ draw(void)
                      PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
                      &clear_color, 1.0, 0);

-   q1 = info.ctx->create_query(info.ctx, PIPE_QUERY_OCCLUSION_COUNTER);
-   q2 = info.ctx->create_query(info.ctx, PIPE_QUERY_OCCLUSION_COUNTER);
+   q1 = info.ctx->create_query(info.ctx, PIPE_QUERY_OCCLUSION_COUNTER,
0);
+   q2 = info.ctx->create_query(info.ctx, PIPE_QUERY_OCCLUSION_COUNTER,
0);

      /* draw first, large object */
      set_vertices(obj1_vertices, sizeof(obj1_vertices));
diff --git a/src/gallium/tools/trace/dump_state.py
b/src/gallium/tools/trace/dump_state.py
index 8bb29e7..0fd1c41 100755
--- a/src/gallium/tools/trace/dump_state.py
+++ b/src/gallium/tools/trace/dump_state.py
@@ -665,7 +665,7 @@ class Context(Dispatcher):
       def surface_destroy(self, surface):
           self.interpreter.unregister_object(surface)

-    def create_query(self, query_type):
+    def create_query(self, query_type, stream):
           return query_type

       def destroy_query(self, query):
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c
b/src/mesa/state_tracker/st_cb_queryobj.c
index 78a7370..1aaa322 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -132,13 +132,13 @@ st_BeginQuery(struct gl_context *ctx, struct
gl_query_object *q)
          type == PIPE_QUERY_TIMESTAMP) {
         /* Determine time elapsed by emitting two timestamp queries. */
         if (!stq->pq_begin) {
-         stq->pq_begin = pipe->create_query(pipe, type);
+         stq->pq_begin = pipe->create_query(pipe, type, 0);
            stq->type = type;
         }
         pipe->end_query(pipe, stq->pq_begin);
      } else {
         if (!stq->pq) {
-         stq->pq = pipe->create_query(pipe, type);
+         stq->pq = pipe->create_query(pipe, type, 0);
            stq->type = type;
         }
         if (stq->pq) {
@@ -164,7 +164,7 @@ st_EndQuery(struct gl_context *ctx, struct
gl_query_object *q)
      if ((q->Target == GL_TIMESTAMP ||
           q->Target == GL_TIME_ELAPSED) &&
          !stq->pq) {
-      stq->pq = pipe->create_query(pipe, PIPE_QUERY_TIMESTAMP);
+      stq->pq = pipe->create_query(pipe, PIPE_QUERY_TIMESTAMP, 0);
         stq->type = PIPE_QUERY_TIMESTAMP;
      }


I wonder if the new parameter should be named 'index' instead in case
there's other, non-stream uses for this value in the future.

ChrisF said the same thing. I'll go ahead with the s/stream/index/g
... if I'm clever I can just do it on the patch directly and not have
to edit anything.


In any case, the new parameter should be documented in
src/gallium/docs/source/context.rst

I looked and the current args aren't documented there either :)
Otherwise I would have dropped something in. Anyways, I'll reword the
docs so that it's more in-line with how the others are documented...
what's a good description for 'index'? "The index of the vertex
stream, used for PRIMITIVES_GENERATED/EMITTED"?

Yeah, that sounds good.
Thanks.

-Brian


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

Reply via email to