[Mesa-dev] [PATCH] llvmpipe: fix timer query if there's no bins

2013-06-28 Thread sroland
From: Roland Scheidegger srol...@vmware.com

b04a295a4a0cd2defe352b3193b5fa79ca8fc9fc removed seemingly unnecessary
code in get_query. Turns out this code could in fact be reached - while
timestamps are always binned, if there are no bins (which happens if fb
size is 0) then the rasterization query code filling this in is still
never executed.
So fix this up by filling in some timestamp, but do it at EndQuery time
not GetQuery time which should be more appropriate.
Makes piglit arb_timer_query-timestamp-get happy again.
---
 src/gallium/drivers/llvmpipe/lp_setup.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c 
b/src/gallium/drivers/llvmpipe/lp_setup.c
index 49b61c3..65f61ed 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -40,6 +40,7 @@
 #include util/u_memory.h
 #include util/u_pack_color.h
 #include draw/draw_pipe.h
+#include os/os_time.h
 #include lp_context.h
 #include lp_memory.h
 #include lp_scene.h
@@ -1263,6 +1264,15 @@ lp_setup_end_query(struct lp_setup_context *setup, 
struct llvmpipe_query *pq)
   pq-type == PIPE_QUERY_OCCLUSION_PREDICATE ||
   pq-type == PIPE_QUERY_PIPELINE_STATISTICS ||
   pq-type == PIPE_QUERY_TIMESTAMP) {
+ if (pq-type == PIPE_QUERY_TIMESTAMP 
+   !(setup-scene-tiles_x | setup-scene-tiles_y)) {
+/*
+ * If there's a zero width/height framebuffer, there's no bins and
+ * hence no rast task is ever run. So fill in something here 
instead.
+ */
+pq-end[0] = os_time_get_nano();
+ }
+
  if (!lp_scene_bin_everywhere(setup-scene,
   LP_RAST_OP_END_QUERY,
   lp_rast_arg_query(pq))) {
-- 
1.7.9.5
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] llvmpipe: fix timer query if there's no bins

2013-06-28 Thread Jose Fonseca
Looks good.

- Original Message -
 From: Roland Scheidegger srol...@vmware.com
 
 b04a295a4a0cd2defe352b3193b5fa79ca8fc9fc removed seemingly unnecessary
 code in get_query. Turns out this code could in fact be reached - while
 timestamps are always binned, if there are no bins (which happens if fb
 size is 0) then the rasterization query code filling this in is still
 never executed.
 So fix this up by filling in some timestamp, but do it at EndQuery time
 not GetQuery time which should be more appropriate.
 Makes piglit arb_timer_query-timestamp-get happy again.
 ---
  src/gallium/drivers/llvmpipe/lp_setup.c |   10 ++
  1 file changed, 10 insertions(+)
 
 diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c
 b/src/gallium/drivers/llvmpipe/lp_setup.c
 index 49b61c3..65f61ed 100644
 --- a/src/gallium/drivers/llvmpipe/lp_setup.c
 +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
 @@ -40,6 +40,7 @@
  #include util/u_memory.h
  #include util/u_pack_color.h
  #include draw/draw_pipe.h
 +#include os/os_time.h
  #include lp_context.h
  #include lp_memory.h
  #include lp_scene.h
 @@ -1263,6 +1264,15 @@ lp_setup_end_query(struct lp_setup_context *setup,
 struct llvmpipe_query *pq)
pq-type == PIPE_QUERY_OCCLUSION_PREDICATE ||
pq-type == PIPE_QUERY_PIPELINE_STATISTICS ||
pq-type == PIPE_QUERY_TIMESTAMP) {
 + if (pq-type == PIPE_QUERY_TIMESTAMP 
 +   !(setup-scene-tiles_x | setup-scene-tiles_y)) {
 +/*
 + * If there's a zero width/height framebuffer, there's no bins
 and
 + * hence no rast task is ever run. So fill in something here
 instead.
 + */
 +pq-end[0] = os_time_get_nano();
 + }
 +
   if (!lp_scene_bin_everywhere(setup-scene,
LP_RAST_OP_END_QUERY,
lp_rast_arg_query(pq))) {
 --
 1.7.9.5
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev