~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/gallium/drivers/softpipe/sp_query.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 */
31
31
 
32
32
#include "draw/draw_context.h"
 
33
#include "os/os_time.h"
33
34
#include "pipe/p_defines.h"
34
35
#include "util/u_memory.h"
35
36
#include "sp_context.h"
37
38
#include "sp_state.h"
38
39
 
39
40
struct softpipe_query {
 
41
   unsigned type;
40
42
   uint64_t start;
41
43
   uint64_t end;
 
44
   struct pipe_query_data_so_statistics so;
42
45
};
43
46
 
44
47
 
51
54
softpipe_create_query(struct pipe_context *pipe, 
52
55
                      unsigned type)
53
56
{
54
 
   assert(type == PIPE_QUERY_OCCLUSION_COUNTER);
55
 
   return (struct pipe_query *)CALLOC_STRUCT( softpipe_query );
 
57
   struct softpipe_query* sq;
 
58
 
 
59
   assert(type == PIPE_QUERY_OCCLUSION_COUNTER ||
 
60
          type == PIPE_QUERY_TIME_ELAPSED ||
 
61
          type == PIPE_QUERY_SO_STATISTICS ||
 
62
          type == PIPE_QUERY_GPU_FINISHED ||
 
63
          type == PIPE_QUERY_TIMESTAMP_DISJOINT);
 
64
   sq = CALLOC_STRUCT( softpipe_query );
 
65
   sq->type = type;
 
66
 
 
67
   return (struct pipe_query *)sq;
56
68
}
57
69
 
58
70
 
68
80
{
69
81
   struct softpipe_context *softpipe = softpipe_context( pipe );
70
82
   struct softpipe_query *sq = softpipe_query(q);
71
 
   
72
 
   sq->start = softpipe->occlusion_count;
 
83
 
 
84
   switch (sq->type) {
 
85
   case PIPE_QUERY_OCCLUSION_COUNTER:
 
86
      sq->start = softpipe->occlusion_count;
 
87
      break;
 
88
   case PIPE_QUERY_TIME_ELAPSED:
 
89
      sq->start = 1000*os_time_get();
 
90
      break;
 
91
   case PIPE_QUERY_SO_STATISTICS:
 
92
      sq->so.num_primitives_written = 0;
 
93
      sq->so.primitives_storage_needed = 0;
 
94
      break;
 
95
   case PIPE_QUERY_GPU_FINISHED:
 
96
      break;
 
97
   case PIPE_QUERY_TIMESTAMP_DISJOINT:
 
98
   default:
 
99
      assert(0);
 
100
      break;
 
101
   }
73
102
   softpipe->active_query_count++;
74
103
   softpipe->dirty |= SP_NEW_QUERY;
75
104
}
82
111
   struct softpipe_query *sq = softpipe_query(q);
83
112
 
84
113
   softpipe->active_query_count--;
85
 
   sq->end = softpipe->occlusion_count;
 
114
   switch (sq->type) {
 
115
   case PIPE_QUERY_OCCLUSION_COUNTER:
 
116
      sq->end = softpipe->occlusion_count;
 
117
      break;
 
118
   case PIPE_QUERY_TIME_ELAPSED:
 
119
      sq->end = 1000*os_time_get();
 
120
      break;
 
121
   case PIPE_QUERY_SO_STATISTICS:
 
122
      sq->so.num_primitives_written =
 
123
         softpipe->so_stats.num_primitives_written;
 
124
      sq->so.primitives_storage_needed =
 
125
         softpipe->so_stats.primitives_storage_needed;
 
126
      break;
 
127
   case PIPE_QUERY_GPU_FINISHED:
 
128
   case PIPE_QUERY_TIMESTAMP_DISJOINT:
 
129
      break;
 
130
   default:
 
131
      assert(0);
 
132
      break;
 
133
   }
86
134
   softpipe->dirty |= SP_NEW_QUERY;
87
135
}
88
136
 
91
139
softpipe_get_query_result(struct pipe_context *pipe, 
92
140
                          struct pipe_query *q,
93
141
                          boolean wait,
94
 
                          uint64_t *result )
 
142
                          void *vresult)
95
143
{
96
144
   struct softpipe_query *sq = softpipe_query(q);
97
 
   *result = sq->end - sq->start;
 
145
   uint64_t *result = (uint64_t*)vresult;
 
146
 
 
147
   switch (sq->type) {
 
148
   case PIPE_QUERY_SO_STATISTICS:
 
149
      memcpy(vresult, &sq->so,
 
150
             sizeof(struct pipe_query_data_so_statistics));
 
151
      break;
 
152
   case PIPE_QUERY_GPU_FINISHED:
 
153
      *result = TRUE;
 
154
      break;
 
155
   case PIPE_QUERY_TIMESTAMP_DISJOINT: {
 
156
      struct pipe_query_data_timestamp_disjoint td;
 
157
      /*os_get_time is in microseconds*/
 
158
      td.frequency = 1000000;
 
159
      td.disjoint = FALSE;
 
160
      memcpy(vresult, &sq->so,
 
161
             sizeof(struct pipe_query_data_timestamp_disjoint));
 
162
   }
 
163
      break;
 
164
   default:
 
165
      *result = sq->end - sq->start;
 
166
      break;
 
167
   }
98
168
   return TRUE;
99
169
}
100
170