コード例 #1
0
ファイル: nv40_query.c プロジェクト: toastpp/toastpp
static boolean
nv40_query_result(struct pipe_context *pipe, struct pipe_query *pq,
		  boolean wait, uint64_t *result)
{
	struct nv40_context *nv40 = nv40_context(pipe);
	struct nv40_query *q = nv40_query(pq);
	struct nouveau_winsys *nvws = nv40->nvws;

	assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER);

	if (!q->ready) {
		unsigned status;

		status = nvws->notifier_status(nv40->screen->query,
					       q->object->start);
		if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
			if (wait == FALSE)
				return FALSE;
			nvws->notifier_wait(nv40->screen->query, q->object->start,
					    NV_NOTIFY_STATE_STATUS_COMPLETED,
					    0);
		}

		q->result = nvws->notifier_retval(nv40->screen->query,
						  q->object->start);
		q->ready = TRUE;
		nvws->res_free(&q->object);
	}

	*result = q->result;
	return TRUE;
}
コード例 #2
0
ファイル: nv40_query.c プロジェクト: toastpp/toastpp
static void
nv40_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
{
	struct nv40_context *nv40 = nv40_context(pipe);
	struct nv40_query *q = nv40_query(pq);

	assert(q->type == PIPE_QUERY_OCCLUSION_COUNTER);

	/* Happens when end_query() is called, then another begin_query()
	 * without querying the result in-between.  For now we'll wait for
	 * the existing query to notify completion, but it could be better.
	 */
	if (q->object) {
		uint64_t tmp;
		pipe->get_query_result(pipe, pq, 1, &tmp);
	}

	if (nv40->nvws->res_alloc(nv40->screen->query_heap, 1, NULL, &q->object))
		assert(0);
	nv40->nvws->notifier_reset(nv40->screen->query, q->object->start);

	BEGIN_RING(curie, NV40TCL_QUERY_RESET, 1);
	OUT_RING  (1);
	BEGIN_RING(curie, NV40TCL_QUERY_UNK17CC, 1);
	OUT_RING  (1);

	q->ready = FALSE;
}
コード例 #3
0
ファイル: nv40_query.c プロジェクト: MttDs/new-rexeno-tindpe
static void
nv40_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
{
	struct nv40_query *q = nv40_query(pq);

	if (q->object)
		nouveau_resource_free(&q->object);
	FREE(q);
}
コード例 #4
0
ファイル: nv40_query.c プロジェクト: toastpp/toastpp
static void
nv40_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
{
	struct nv40_context *nv40 = nv40_context(pipe);
	struct nv40_query *q = nv40_query(pq);

	if (q->object)
		nv40->nvws->res_free(&q->object);
	FREE(q);
}
コード例 #5
0
ファイル: nv40_query.c プロジェクト: toastpp/toastpp
static void
nv40_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
	struct nv40_context *nv40 = nv40_context(pipe);
	struct nv40_query *q = nv40_query(pq);

	BEGIN_RING(curie, NV40TCL_QUERY_GET, 1);
	OUT_RING  ((0x01 << NV40TCL_QUERY_GET_UNK24_SHIFT) |
		   ((q->object->start * 32) << NV40TCL_QUERY_GET_OFFSET_SHIFT));
	FIRE_RING(NULL);
}