#include "main/imports.h"
#include "main/simple_list.h"
+#define DDEBUG 0
+
#define PAGE_SIZE 4096
static void r300QueryGetResult(GLcontext *ctx, struct gl_query_object *q)
uint32_t *result;
int i;
+ if (DDEBUG) fprintf(stderr, "%s: query id %d, result %d\n", __FUNCTION__, query->Base.Id, (int) query->Base.Result);
+
radeon_bo_map(query->bo, GL_FALSE);
result = query->bo->ptr;
query->Base.Result = 0;
for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) {
query->Base.Result += result[i];
+ if (DDEBUG) fprintf(stderr, "result[%d] = %d\n", i, result[i]);
}
radeon_bo_unmap(query->bo);
query->Base.Active = GL_FALSE;
query->Base.Ready = GL_TRUE;
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, query->Base.Id);
+
return &query->Base;
}
{
struct r300_query_object *query = (struct r300_query_object *)q;
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, q->Id);
+
if (query->bo) {
radeon_bo_unref(query->bo);
}
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_query_object *query = (struct r300_query_object *)q;
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, q->Id);
+
assert(r300->query.current == NULL);
if (!query->bo) {
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, q->Id);
+
r300EmitQueryEnd(ctx);
r300->query.current = NULL;
ctx->Driver.Flush(ctx);
}
+ if (DDEBUG) fprintf(stderr, "%s: query id %d, bo %p, offset %d\n", __FUNCTION__, q->Id, query->bo, query->curr_offset);
+
r300QueryGetResult(ctx, q);
query->Base.Ready = GL_TRUE;
*/
static void r300CheckQuery(GLcontext *ctx, struct gl_query_object *q)
{
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, q->Id);
+
r300WaitQuery(ctx, q);
}
if (!query || query->emitted_begin)
return;
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, query->Base.Id);
+
if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530) {
BEGIN_BATCH_NO_AUTOSTATE(4);
OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
if (!query || !query->emitted_begin)
return;
+ if (DDEBUG) fprintf(stderr, "%s: query id %d, bo %p, offset %d\n", __FUNCTION__, query->Base.Id, query->bo, query->curr_offset);
+
radeon_cs_space_check_with_bo(r300->radeon.cmdbuf.cs,
query->bo,
0, RADEON_GEM_DOMAIN_GTT);