summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Cencora <[email protected]>2009-08-16 01:56:29 +0200
committerMaciej Cencora <[email protected]>2009-08-16 01:56:29 +0200
commit30e9c753b8434778a167f708550983688677b232 (patch)
treef35c97a4cd6a9b5a8ad9a34d0a2504987704f8a4
parent57f55af21995f8ec8629503752864fc6c3f38a32 (diff)
parent60587182d4ade36df75ee13edf8df6b529fbb0f1 (diff)
Merge branch 'oq'
-rw-r--r--src/mesa/drivers/dri/r300/Makefile1
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c16
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h17
-rw-r--r--src/mesa/drivers/dri/r300/r300_draw.c7
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c13
-rw-r--r--src/mesa/drivers/dri/r300/r300_queryobj.c250
-rw-r--r--src/mesa/drivers/dri/r300/r300_queryobj.h34
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h12
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_buffer_objects.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c12
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.h1
14 files changed, 361 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index 2390d1896ac..77b3d168f34 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -54,6 +54,7 @@ DRIVER_SOURCES = \
r300_shader.c \
r300_emit.c \
r300_swtcl.c \
+ r300_queryobj.c \
$(RADEON_COMMON_SOURCES) \
$(EGL_SOURCES) \
$(CS_SOURCES)
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 1baae8fc765..91fa77a1690 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -64,6 +64,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_ioctl.h"
#include "r300_tex.h"
#include "r300_emit.h"
+#include "r300_queryobj.h"
#include "r300_swtcl.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_buffer_objects.h"
@@ -74,6 +75,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xmlpool.h" /* for symbolic values of enum-type options */
#define need_GL_VERSION_2_0
+#define need_GL_ARB_occlusion_query
#define need_GL_ARB_point_parameters
#define need_GL_ARB_vertex_program
#define need_GL_EXT_blend_equation_separate
@@ -94,6 +96,7 @@ const struct dri_extension card_extensions[] = {
/* *INDENT-OFF* */
{"GL_ARB_depth_texture", NULL},
{"GL_ARB_fragment_program", NULL},
+ {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
{"GL_ARB_multitexture", NULL},
{"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
{"GL_ARB_shadow", NULL},
@@ -310,6 +313,11 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.FragmentProgram.MaxNativeTexIndirections = R300_PFS_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
}
+
+ if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530)
+ r300->num_z_pipes = 2;
+ else
+ r300->num_z_pipes = r300->radeon.radeonScreen->num_gb_pipes;
}
static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
@@ -352,6 +360,11 @@ static void r300InitGLExtensions(GLcontext *ctx)
} else if (r300->options.s3tc_force_disabled) {
_mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc");
}
+
+ if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries ||
+ !r300->options.hw_tcl_enabled) {
+ _mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
+ }
}
/* Create the device specific rendering context.
@@ -383,6 +396,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
r300InitStateFuncs(&functions);
r300InitTextureFuncs(&functions);
r300InitShaderFuncs(&functions);
+ r300InitQueryObjFunctions(&functions);
radeonInitBufferObjectFuncs(&functions);
if (!radeonInitContext(&r300->radeon, &functions,
@@ -439,6 +453,8 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
r300InitGLExtensions(ctx);
+ make_empty_list(&r300->query.not_flushed_head);
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index d6204174229..3ba34266084 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -505,6 +505,16 @@ struct r300_index_buffer {
GLuint count;
};
+struct r300_query_object {
+ struct gl_query_object Base;
+ struct radeon_bo *bo;
+ int curr_offset;
+ GLboolean emitted_begin;
+
+ /* Double linked list of not flushed query objects */
+ struct r300_query_object *prev, *next;
+};
+
/**
* \brief R300 context structure.
*/
@@ -539,6 +549,13 @@ struct r300_context {
uint32_t fallback;
DECLARE_RENDERINPUTS(render_inputs_bitset);
+
+ struct {
+ struct r300_query_object *current;
+ struct r300_query_object not_flushed_head;
+ } query;
+
+ int num_z_pipes;
};
#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index d6ebdcbfe97..fb416a05c08 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -36,6 +36,7 @@
#include "r300_context.h"
#include "r300_emit.h"
#include "r300_render.h"
+#include "r300_queryobj.h"
#include "r300_state.h"
#include "r300_tex.h"
@@ -507,7 +508,7 @@ static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *ar
radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, r300->vbuf.attribs[i].bo, RADEON_GEM_DOMAIN_GTT, 0);
}
}
-
+
r300->radeon.tcl.aos_count = vbuf->num_attribs;
ret = radeon_cs_space_check_with_bo(r300->radeon.cmdbuf.cs, r300->radeon.dma.current, RADEON_GEM_DOMAIN_GTT, 0);
if (ret)
@@ -581,12 +582,16 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx,
r300EmitCacheFlush(r300);
radeonEmitState(&r300->radeon);
+ r300EmitQueryBegin(ctx);
+
for (i = 0; i < nr_prims; ++i) {
r300RunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, prim[i].mode);
}
r300EmitCacheFlush(r300);
+ r300EmitQueryEnd(ctx);
+
r300FreeData(ctx);
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index 7558f9e225b..da801f42e4c 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -44,6 +44,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/imports.h"
#include "main/macros.h"
#include "main/context.h"
+#include "main/simple_list.h"
#include "swrast/swrast.h"
#include "radeon_common.h"
@@ -56,6 +57,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_reg.h"
#include "r300_emit.h"
#include "r300_context.h"
+#include "r300_queryobj.h"
#include "vblank.h"
@@ -753,10 +755,19 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask)
}
}
+static void r300Flush(GLcontext *ctx)
+{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+
+ radeonFlush(ctx);
+
+ make_empty_list(&r300->query.not_flushed_head);
+}
+
void r300InitIoctlFuncs(struct dd_function_table *functions)
{
functions->Clear = r300Clear;
functions->Finish = radeonFinish;
- functions->Flush = radeonFlush;
+ functions->Flush = r300Flush;
}
diff --git a/src/mesa/drivers/dri/r300/r300_queryobj.c b/src/mesa/drivers/dri/r300/r300_queryobj.c
new file mode 100644
index 00000000000..df1fb32ee78
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/r300_queryobj.c
@@ -0,0 +1,250 @@
+/*
+ * Copyright © 2008-2009 Maciej Cencora <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Maciej Cencora <[email protected]>
+ *
+ */
+
+#include "r300_queryobj.h"
+#include "r300_emit.h"
+
+#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)
+{
+ struct r300_query_object *query = (struct r300_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);
+}
+
+static struct gl_query_object * r300NewQueryObject(GLcontext *ctx, GLuint id)
+{
+ struct r300_query_object *query;
+
+ query = _mesa_calloc(sizeof(struct r300_query_object));
+
+ query->Base.Id = id;
+ query->Base.Result = 0;
+ 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;
+}
+
+static void r300DeleteQuery(GLcontext *ctx, struct gl_query_object *q)
+{
+ 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);
+ }
+
+ _mesa_free(query);
+}
+
+static void r300BeginQuery(GLcontext *ctx, struct gl_query_object *q)
+{
+ 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) {
+ query->bo = radeon_bo_open(r300->radeon.radeonScreen->bom, 0, PAGE_SIZE, PAGE_SIZE, RADEON_GEM_DOMAIN_GTT, 0);
+ }
+ query->curr_offset = 0;
+
+ r300->query.current = query;
+ insert_at_tail(&r300->query.not_flushed_head, query);
+}
+
+static void r300EndQuery(GLcontext *ctx, struct gl_query_object *q)
+{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+
+ if (DDEBUG) fprintf(stderr, "%s: query id %d\n", __FUNCTION__, q->Id);
+
+ r300EmitQueryEnd(ctx);
+
+ r300->query.current = NULL;
+}
+
+static void r300WaitQuery(GLcontext *ctx, struct gl_query_object *q)
+{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+ struct r300_query_object *tmp, *query = (struct r300_query_object *)q;
+
+ /* If the cmdbuf with packets for this query hasn't been flushed yet, do it now */
+ {
+ GLboolean found = GL_FALSE;
+ foreach(tmp, &r300->query.not_flushed_head) {
+ if (tmp == query) {
+ found = GL_TRUE;
+ break;
+ }
+ }
+
+ if (found)
+ 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;
+}
+
+
+/**
+ * TODO:
+ * should check if bo is idle, bo there's no interface to do it
+ * just wait for result now
+ */
+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);
+}
+
+void r300EmitQueryBegin(GLcontext *ctx)
+{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+ struct r300_query_object *query = r300->query.current;
+ BATCH_LOCALS(&r300->radeon);
+
+ 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);
+ OUT_BATCH_REGVAL(R300_ZB_ZPASS_DATA, 0);
+ END_BATCH();
+ } else {
+ BEGIN_BATCH_NO_AUTOSTATE(4);
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL);
+ OUT_BATCH_REGVAL(R300_ZB_ZPASS_DATA, 0);
+ END_BATCH();
+ }
+
+ query->emitted_begin = GL_TRUE;
+}
+
+void r300EmitQueryEnd(GLcontext *ctx)
+{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+ struct r300_query_object *query = r300->query.current;
+ BATCH_LOCALS(&r300->radeon);
+
+ 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);
+
+ if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530) {
+ BEGIN_BATCH_NO_AUTOSTATE(14);
+ OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
+ OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_BATCH_RELOC(0, query->bo, query->curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1);
+ OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_BATCH_RELOC(0, query->bo, query->curr_offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
+ END_BATCH();
+ } else {
+ BEGIN_BATCH_NO_AUTOSTATE(3 * 2 *r300->num_z_pipes + 2);
+ switch (r300->num_z_pipes) {
+ case 4:
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_3);
+ OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_BATCH_RELOC(0, query->bo, query->curr_offset+3*sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ case 3:
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_2);
+ OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_BATCH_RELOC(0, query->bo, query->curr_offset+2*sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ case 2:
+ if (r300->radeon.radeonScreen->chip_family <= CHIP_FAMILY_RV380) {
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_3);
+ } else {
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_1);
+ }
+ OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_BATCH_RELOC(0, query->bo, query->curr_offset+1*sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ case 1:
+ default:
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_0);
+ OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
+ OUT_BATCH_RELOC(0, query->bo, query->curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ break;
+ }
+ OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL);
+ END_BATCH();
+ }
+
+ query->curr_offset += r300->num_z_pipes * sizeof(uint32_t);
+ assert(query->curr_offset < PAGE_SIZE);
+ query->emitted_begin = GL_FALSE;
+}
+
+void r300InitQueryObjFunctions(struct dd_function_table *functions)
+{
+ functions->NewQueryObject = r300NewQueryObject;
+ functions->DeleteQuery = r300DeleteQuery;
+ functions->BeginQuery = r300BeginQuery;
+ functions->EndQuery = r300EndQuery;
+ functions->CheckQuery = r300CheckQuery;
+ functions->WaitQuery = r300WaitQuery;
+}
diff --git a/src/mesa/drivers/dri/r300/r300_queryobj.h b/src/mesa/drivers/dri/r300/r300_queryobj.h
new file mode 100644
index 00000000000..f301f0b1133
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/r300_queryobj.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2008 Maciej Cencora <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Maciej Cencora <[email protected]>
+ *
+ */
+
+#include "main/imports.h"
+#include "r300_context.h"
+
+extern void r300EmitQueryBegin(GLcontext *ctx);
+extern void r300EmitQueryEnd(GLcontext *ctx);
+
+extern void r300InitQueryObjFunctions(struct dd_function_table *functions);
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index dd32e6c730a..39b4b61a105 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -1128,6 +1128,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* SU Depth Offset value */
#define R300_SU_DEPTH_OFFSET 0x42c4
+#define R300_SU_REG_DEST 0x42c8
+# define R300_RASTER_PIPE_SELECT_0 (1 << 0)
+# define R300_RASTER_PIPE_SELECT_1 (1 << 1)
+# define R300_RASTER_PIPE_SELECT_2 (1 << 2)
+# define R300_RASTER_PIPE_SELECT_3 (1 << 3)
+# define R300_RASTER_PIPE_SELECT_ALL 0xf
+
/* BEGIN: Rasterization / Interpolators - many guesses */
@@ -2014,6 +2021,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R500_FG_ALPHA_VALUE 0x4be0
# define R500_FG_ALPHA_VALUE_MASK 0x0000ffff
+#define RV530_FG_ZBREG_DEST 0x4be8
+# define RV530_FG_ZBREG_DEST_PIPE_SELECT_0 (1 << 0)
+# define RV530_FG_ZBREG_DEST_PIPE_SELECT_1 (1 << 1)
+# define RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL (3 << 0)
+
/* gap */
/* Fragment program parameters in 7.16 floating point */
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 4bf09c2e89a..369c3edcd09 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -76,6 +76,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_tex.h"
#include "r300_emit.h"
#include "r300_fragprog_common.h"
+#include "r300_queryobj.h"
#include "r300_swtcl.h"
/**
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 050e8cd2a7d..f39d7460b20 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -462,7 +462,7 @@ static GLboolean current_fragment_program_writes_depth(GLcontext* ctx)
static void r300SetEarlyZState(GLcontext * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- GLuint topZ = R300_ZTOP_ENABLE;
+ GLuint topZ = R300_ZTOP_DISABLE;
GLuint w_fmt, fgdepthsrc;
if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS)
diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
index 69556923b66..827f1d253d6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
+++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
@@ -181,7 +181,7 @@ radeonMapBuffer(GLcontext * ctx,
struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj);
if (access == GL_WRITE_ONLY_ARB) {
- radeonFlush(ctx);
+ ctx->Driver.Flush(ctx);
}
if (radeon_obj->bo == NULL) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index 330c2c8a86e..0614c894595 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -880,7 +880,7 @@ void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei he
if (!radeon->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) {
if (radeon->is_front_buffer_rendering) {
- radeonFlush(ctx);
+ ctx->Driver.Flush(ctx);
}
radeon_update_renderbuffers(driContext, driContext->driDrawablePriv);
if (driContext->driDrawablePriv != driContext->driReadablePriv)
@@ -1211,7 +1211,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa)
rmesa->cmdbuf.size = size;
radeon_cs_space_set_flush(rmesa->cmdbuf.cs,
- (void (*)(void *))radeonFlush, rmesa->glCtx);
+ (void (*)(void *))rmesa->glCtx->Driver.Flush, rmesa->glCtx);
if (!rmesa->radeonScreen->kernel_mm) {
radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, rmesa->radeonScreen->texSize[0]);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 7b759661ca7..c8d491621a8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -999,6 +999,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->drmSupportsPointSprites = (sPriv->drm_version.minor >= 13);
screen->drmSupportsCubeMapsR100 = (sPriv->drm_version.minor >= 15);
screen->drmSupportsVertexProgram = (sPriv->drm_version.minor >= 25);
+ screen->drmSupportsOcclusionQueries = (sPriv->drm_version.minor >= 30);
}
ret = radeon_set_screen_flags(screen, dri_priv->deviceID);
@@ -1094,7 +1095,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
/* +r6/r7 */
if(screen->chip_family >= CHIP_FAMILY_R600)
{
- if (ret)
+ if (ret)
{
FREE( screen );
fprintf(stderr, "Unable to get fb location need newer drm\n");
@@ -1107,18 +1108,18 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
}
else
{
- if (ret)
+ if (ret)
{
if (screen->chip_family < CHIP_FAMILY_RS600 && !screen->kernel_mm)
screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff) << 16;
- else
+ else
{
FREE( screen );
fprintf(stderr, "Unable to get fb location need newer drm\n");
return NULL;
}
- }
- else
+ }
+ else
{
screen->fbLocation = (temp & 0xffff) << 16;
}
@@ -1298,6 +1299,7 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv)
screen->drmSupportsPointSprites = 1;
screen->drmSupportsCubeMapsR100 = 1;
screen->drmSupportsVertexProgram = 1;
+ screen->drmSupportsOcclusionQueries = 1;
screen->irq = 1;
ret = radeonGetParam(sPriv, RADEON_PARAM_DEVICE_ID, &device_id);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index 2a2f6b1b0b8..f0dd46b0b13 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -99,6 +99,7 @@ typedef struct radeon_screen {
GLboolean drmSupportsPointSprites; /* need radeon kernel module >= 1.13 */
GLboolean drmSupportsCubeMapsR100; /* need radeon kernel module >= 1.15 */
GLboolean drmSupportsVertexProgram; /* need radeon kernel module >= 1.25 */
+ GLboolean drmSupportsOcclusionQueries; /* need radeon kernel module >= 1.30 */
GLboolean depthHasSurface;
/* Configuration cache with default values for all contexts */