summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/intel_context.c27
-rw-r--r--src/mesa/drivers/dri/i965/intel_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c6
3 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c
index 459ed109ed..388600dbbe 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -184,9 +184,17 @@ const struct dri_extension card_extensions[] =
{ NULL, NULL }
};
-static const struct dri_extension arb_oc_extension =
+const struct dri_extension arb_oc_extension =
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions};
+void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
+{
+ struct intel_context *intel = ctx?intel_context(ctx):NULL;
+ driInitExtensions(ctx, card_extensions, enable_imaging);
+ if (!ctx || intel->intelScreen->drmMinor >= 8)
+ driInitSingleExtension (ctx, &arb_oc_extension);
+}
+
static const struct dri_debug_control debug_control[] =
{
{ "fall", DEBUG_FALLBACKS },
@@ -248,28 +256,29 @@ static void
intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
{
struct intel_context *intel = intel_context( ctx );
- GLuint64EXT tmp = 0;
drmI830MMIO io = {
.read_write = MMIO_WRITE,
.reg = MMIO_REGS_PS_DEPTH_COUNT,
- .data = &tmp
+ .data = &q->Result
};
intel->stats_wm = GL_TRUE;
intelFinish(&intel->ctx);
- drmCommandWrite(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
+ drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
}
static void
intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
{
struct intel_context *intel = intel_context( ctx );
+ GLuint64EXT tmp;
drmI830MMIO io = {
.read_write = MMIO_READ,
.reg = MMIO_REGS_PS_DEPTH_COUNT,
- .data = &q->Result
+ .data = &tmp
};
intelFinish(&intel->ctx);
drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
+ q->Result = tmp - q->Result;
q->Ready = GL_TRUE;
intel->stats_wm = GL_FALSE;
}
@@ -409,12 +418,7 @@ GLboolean intelInitContext( struct intel_context *intel,
_mesa_printf("IRQs not active. Exiting\n");
exit(1);
}
-
- driInitExtensions( ctx, card_extensions,
- GL_TRUE );
-
- if (intel->intelScreen->drmMinor >= 8)
- driInitSingleExtension (ctx, &arb_oc_extension);
+ intelInitExtensions(ctx, GL_TRUE);
INTEL_DEBUG = driParseDebugString( getenv( "INTEL_DEBUG" ),
debug_control );
@@ -693,3 +697,4 @@ void UNLOCK_HARDWARE( struct intel_context *intel )
_glthread_UNLOCK_MUTEX(lockMutex);
}
+
diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h
index fe7ee382a1..d51536c3fe 100644
--- a/src/mesa/drivers/dri/i965/intel_context.h
+++ b/src/mesa/drivers/dri/i965/intel_context.h
@@ -500,6 +500,7 @@ void intelBitmap(GLcontext * ctx,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * pixels);
+void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging);
#define _NEW_WINDOW_POS 0x40000000
@@ -522,6 +523,5 @@ static inline struct intel_texture_image *intel_texture_image( struct gl_texture
return (struct intel_texture_image *)img;
}
-
#endif
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 8269deba66..08f0bb340f 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -38,6 +38,7 @@
#include "intel_screen.h"
+#include "intel_context.h"
#include "intel_tex.h"
#include "intel_span.h"
#include "intel_ioctl.h"
@@ -61,8 +62,6 @@ const GLuint __driNConfigOptions = 4;
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /*USE_NEW_INTERFACE*/
-extern const struct dri_extension card_extensions[];
-
/**
* Map all the memory regions described by the screen.
* \return GL_TRUE if success, GL_FALSE if error.
@@ -687,7 +686,6 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
GL_TRUE );
-
/* Calling driInitExtensions here, with a NULL context pointer, does not actually
* enable the extensions. It just makes sure that all the dispatch offsets for all
* the extensions that *might* be enables are known. This is needed because the
@@ -696,7 +694,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
*
* Hello chicken. Hello egg. How are you two today?
*/
- driInitExtensions( NULL, card_extensions, GL_FALSE );
+ intelInitExtensions(NULL, GL_FALSE);
}
return (void *) psp;