intel: only enable occlusion query if the drm has defines.
[mesa.git] / src / mesa / drivers / dri / intel / intel_context.c
index f0ee96f18dac7c2178ee245d760175a0632b44c4..18e73484ae877efb89c3c031b9a11941b6f8fe50 100644 (file)
@@ -292,7 +292,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
        if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_region) {
          if (INTEL_DEBUG & DEBUG_DRI)
             fprintf(stderr, "(reusing depth buffer as stencil)\n");
-          region = depth_region;
+         intel_region_reference(&region, depth_region);
        }
        else
           region = intel_region_alloc_for_handle(intel, buffers[i].cpp,
@@ -409,10 +409,12 @@ static const struct dri_extension brw_extensions[] = {
    { NULL,                                NULL }
 };
 
+#ifdef I915_MMIO_READ
 static const struct dri_extension arb_oc_extensions[] = {
    {"GL_ARB_occlusion_query",            GL_ARB_occlusion_query_functions},
    {NULL, NULL}
 };
+#endif
 
 static const struct dri_extension ttm_extensions[] = {
    {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
@@ -437,10 +439,12 @@ void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
    if (intel == NULL || intel->ttm)
       driInitExtensions(ctx, ttm_extensions, GL_FALSE);
 
+#ifdef I915_MMIO_READ
    if (intel == NULL || 
        (IS_965(intel->intelScreen->deviceID) && 
        intel->intelScreen->drmMinor >= 8))
       driInitExtensions(ctx, arb_oc_extensions, GL_FALSE);
+#endif
 
    if (intel == NULL || IS_965(intel->intelScreen->deviceID))
       driInitExtensions(ctx, brw_extensions, GL_FALSE);
@@ -538,6 +542,7 @@ intelFinish(GLcontext * ctx)
    }
 }
 
+#ifdef I915_MMIO_READ
 static void
 intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
 {
@@ -568,6 +573,7 @@ intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
        q->Ready = GL_TRUE;
        intel->stats_wm--;
 }
+#endif
 
 /** Driver-specific fence emit implementation for the fake memory manager. */
 static unsigned int
@@ -684,8 +690,10 @@ intelInitDriverFunctions(struct dd_function_table *functions)
    functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
    functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
 
+#ifdef I915_MMIO_READ
    functions->BeginQuery = intelBeginQuery;
    functions->EndQuery = intelEndQuery;
+#endif
 
    intelInitTextureFuncs(functions);
    intelInitStateFuncs(functions);
@@ -921,14 +929,14 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
       struct intel_framebuffer *intel_fb =
         (struct intel_framebuffer *) driDrawPriv->driverPrivate;
       GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
-
-    intel_update_renderbuffers(driContextPriv, driDrawPriv);
-    if (driDrawPriv != driReadPriv)
-       intel_update_renderbuffers(driContextPriv, driReadPriv);
-
-      /* XXX FBO temporary fix-ups! */
-      /* if the renderbuffers don't have regions, init them from the context */
-      if (!driContextPriv->driScreenPriv->dri2.enabled) {
+      if (driContextPriv->driScreenPriv->dri2.enabled) {     
+          intel_update_renderbuffers(driContextPriv, driDrawPriv);
+          if (driDrawPriv != driReadPriv)
+              intel_update_renderbuffers(driContextPriv, driReadPriv);
+      } else {
+          /* XXX FBO temporary fix-ups! */
+          /* if the renderbuffers don't have regions, init them from the context */
          struct intel_renderbuffer *irbDepth
             = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
          struct intel_renderbuffer *irbStencil