#include "lp_query.h"
#include "lp_screen.h"
#include "lp_state.h"
+#include "lp_rast.h"
static struct llvmpipe_query *llvmpipe_query( struct pipe_query *p )
case PIPE_QUERY_OCCLUSION_PREDICATE:
for (i = 0; i < num_threads; i++) {
/* safer (still not guaranteed) when there's an overflow */
- *result = *result || pq->count[i];
+ vresult->b = vresult->b || pq->count[i];
}
break;
case PIPE_QUERY_TIMESTAMP:
*result = os_time_get_nano();
}
break;
+ case PIPE_QUERY_TIMESTAMP_DISJOINT: {
+ struct pipe_query_data_timestamp_disjoint *td =
+ (struct pipe_query_data_timestamp_disjoint *)vresult;
+ /* os_get_time_nano return nanoseconds */
+ td->frequency = UINT64_C(1000000000);
+ td->disjoint = FALSE;
+ }
+ break;
+ case PIPE_QUERY_GPU_FINISHED:
+ vresult->b = TRUE;
+ break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
*result = pq->num_primitives_generated;
break;
*result = pq->num_primitives_written;
break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
- *result = pq->so_has_overflown;
+ vresult->b = pq->so_has_overflown;
break;
case PIPE_QUERY_SO_STATISTICS: {
struct pipe_query_data_so_statistics *stats =
case PIPE_QUERY_PIPELINE_STATISTICS: {
struct pipe_query_data_pipeline_statistics *stats =
(struct pipe_query_data_pipeline_statistics *)vresult;
+ /* only ps_invocations come from binned query */
+ for (i = 0; i < num_threads; i++) {
+ pq->stats.ps_invocations += pq->count[i];
+ }
+ pq->stats.ps_invocations *= LP_RASTER_BLOCK_SIZE * LP_RASTER_BLOCK_SIZE;
*stats = pq->stats;
}
break;
* allocated 4x4 blocks hence need to filter them out here.
*/
if ((x % TILE_SIZE) < task->width && (y % TILE_SIZE) < task->height) {
+ if (task->query[PIPE_QUERY_PIPELINE_STATISTICS]) {
+ /* not very accurate would need a popcount on the mask */
+ task->ps_invocations++;
+ }
/* run shader on 4x4 block */
BEGIN_JIT_CALL(state, task);
variant->jit_function[RAST_EDGE_TEST](&state->jit_context,
case PIPE_QUERY_OCCLUSION_PREDICATE:
task->thread_data.vis_counter = 0;
break;
+ case PIPE_QUERY_PIPELINE_STATISTICS:
+ task->ps_invocations = 0;
+ break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
- case PIPE_QUERY_PIPELINE_STATISTICS:
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+ case PIPE_QUERY_TIMESTAMP_DISJOINT:
break;
default:
assert(0);
const union lp_rast_cmd_arg arg)
{
struct llvmpipe_query *pq = arg.query_obj;
- assert(task->query[pq->type] == pq || pq->type == PIPE_QUERY_TIMESTAMP);
+ assert(task->query[pq->type] == pq ||
+ pq->type == PIPE_QUERY_TIMESTAMP ||
+ pq->type == PIPE_QUERY_GPU_FINISHED);
switch (pq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
case PIPE_QUERY_TIMESTAMP:
pq->count[task->thread_index] = os_time_get_nano();
break;
+ case PIPE_QUERY_PIPELINE_STATISTICS:
+ pq->count[task->thread_index] += task->ps_invocations;
+ break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
- case PIPE_QUERY_PIPELINE_STATISTICS:
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
+ case PIPE_QUERY_TIMESTAMP_DISJOINT:
+ case PIPE_QUERY_GPU_FINISHED:
break;
default:
assert(0);
/* occlude counter for visible pixels */
struct lp_jit_thread_data thread_data;
- uint64_t query_start;
struct llvmpipe_query *query[PIPE_QUERY_TYPES];
+ uint64_t ps_invocations;
pipe_semaphore work_ready;
pipe_semaphore work_done;
* allocated 4x4 blocks hence need to filter them out here.
*/
if ((x % TILE_SIZE) < task->width && (y % TILE_SIZE) < task->height) {
+ if (task->query[PIPE_QUERY_PIPELINE_STATISTICS]) {
+ /* not very accurate would need a popcount on the mask */
+ task->ps_invocations++;
+ }
/* run shader on 4x4 block */
BEGIN_JIT_CALL(state, task);
variant->jit_function[RAST_WHOLE]( &state->jit_context,
assert(setup->active_query[pq->type] == NULL);
set_scene_state(setup, SETUP_ACTIVE, "begin_query");
-
+
setup->active_query[pq->type] = pq;
/* XXX: It is possible that a query is created before the scene
{
set_scene_state(setup, SETUP_ACTIVE, "end_query");
- if (pq->type != PIPE_QUERY_TIMESTAMP) {
+ if (pq->type != PIPE_QUERY_TIMESTAMP && pq->type != PIPE_QUERY_GPU_FINISHED) {
assert(setup->active_query[pq->type] == pq);
setup->active_query[pq->type] = NULL;
}
#include "lp_rast.h"
#include "lp_state_fs.h"
#include "lp_state_setup.h"
+#include "lp_context.h"
#define NUM_CHANNELS 4
y[3] = subpixel_snap(v1[0][1] + y_offset - setup->pixel_offset);
}
-
-
- LP_COUNT(nr_tris);
-
-
/* Bounding rectangle (in pixels) */
{
/* Yes this is necessary to accurately calculate bounding boxes
line->v[1][1] = v2[0][1];
#endif
+ LP_COUNT(nr_tris);
+
+ if (setup->active_query[PIPE_QUERY_PIPELINE_STATISTICS]) {
+ struct llvmpipe_context *lp_context = (struct llvmpipe_context *)setup->pipe;
+ lp_context->pipeline_statistics.c_primitives++;
+ }
+
/* calculate the deltas */
plane = GET_PLANES(line);
plane[0].dcdy = x[0] - x[1];
* Binning code for points
*/
-#include "lp_setup_context.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "lp_setup_context.h"
#include "lp_perf.h"
#include "lp_rast.h"
#include "lp_state_fs.h"
#include "lp_state_setup.h"
+#include "lp_context.h"
#include "tgsi/tgsi_scan.h"
#define NUM_CHANNELS 4
point->v[0][1] = v0[0][1];
#endif
+ LP_COUNT(nr_tris);
+
+ if (setup->active_query[PIPE_QUERY_PIPELINE_STATISTICS]) {
+ struct llvmpipe_context *lp_context = (struct llvmpipe_context *)setup->pipe;
+ lp_context->pipeline_statistics.c_primitives++;
+ }
+
info.v0 = v0;
info.dx01 = 0;
info.dx12 = fixed_width;
#include "lp_rast.h"
#include "lp_state_fs.h"
#include "lp_state_setup.h"
+#include "lp_context.h"
#define NUM_CHANNELS 4
LP_COUNT(nr_tris);
+ if (setup->active_query[PIPE_QUERY_PIPELINE_STATISTICS]) {
+ struct llvmpipe_context *lp_context = (struct llvmpipe_context *)setup->pipe;
+ lp_context->pipeline_statistics.c_primitives++;
+ }
+
/* Setup parameter interpolants:
*/
setup->setup.variant->jit_function( v0,
/**
* Subdivide this triangle by bisecting edge (v0, v1).
* \param pv the provoking vertex (must = v0 or v1 or v2)
+ * TODO: should probably think about non-overflowing arithmetic elsewhere.
+ * This will definitely screw with pipeline counters for instance.
*/
static void
subdiv_tri(struct lp_setup_context *setup,