insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \
} while (0)
-/*
+static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ struct radeon_query_object *query = radeon->query.current;
+ int count;
+
+ if (!query || query->emitted_begin)
+ count = 0;
+ else
+ count = atom->cmd_size;
+ radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count);
+ return count;
+}
+
+static void evergreenSendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ struct radeon_query_object *query = radeon->query.current;
+ BATCH_LOCALS(radeon);
+ radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
+
+ /* clear the buffer */
+ radeon_bo_map(query->bo, GL_FALSE);
+ memset(query->bo->ptr, 0, 8 * 2 * sizeof(uint64_t)); /* 8 DBs, 2 qwords each */
+ radeon_bo_unmap(query->bo);
+
+ radeon_cs_space_check_with_bo(radeon->cmdbuf.cs,
+ query->bo,
+ 0, RADEON_GEM_DOMAIN_GTT);
+
+ BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
+ R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
+ R600_OUT_BATCH(query->curr_offset); /* hw writes qwords */
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ END_BATCH();
+ query->emitted_begin = GL_TRUE;
+}
+
static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ)
{
radeon->query.queryobj.cmd_size = (SZ);
radeon->query.queryobj.idx = 0;
radeon->query.queryobj.check = check_queryobj;
radeon->query.queryobj.dirty = GL_FALSE;
- radeon->query.queryobj.emit = r700SendQueryBegin;
+ radeon->query.queryobj.emit = evergreenSendQueryBegin;
radeon->hw.max_state_size += (SZ);
insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj);
}
-*/
+
static int check_always(GLcontext *ctx, struct radeon_state_atom *atom)
{
EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT);
EVERGREEN_ALLOC_STATE(timestamp, always, 3, evergreenSendTIMESTAMP);
- //evergreen_init_query_stateobj(&context->radeon, 6 * 2);
+ evergreen_init_query_stateobj(&context->radeon, 6 * 2);
context->radeon.hw.is_dirty = GL_TRUE;
context->radeon.hw.all_dirty = GL_TRUE;
#include "evergreen_context.h"
#include "evergreen_state.h"
#include "evergreen_blit.h"
+#include "r600_cmdbuf.h"
static void evergreen_get_lock(radeonContextPtr rmesa)
{
static void evergreen_emit_query_finish(radeonContextPtr radeon)
{
- //TODO apr.01
- //context_t *context = (context_t*) radeon;
- //BATCH_LOCALS(&context->radeon);
+ context_t *context = (context_t*) radeon;
+ BATCH_LOCALS(&context->radeon);
struct radeon_query_object *query = radeon->query.current;
- //BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
- //R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
- //R600_OUT_BATCH(ZPASS_DONE);
- //R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */
- //R600_OUT_BATCH(0x00000000);
- //R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
- //END_BATCH();
- //assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
+ BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
+ R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
+ R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ END_BATCH();
+ assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
query->emitted_begin = GL_FALSE;
}