Merge branch '965-glsl'
[mesa.git] / src / mesa / drivers / dri / i965 / intel_context.c
index a5d8be838653fbe535d97c3ea483e6a889eb9176..9850997aad1f7d8af7483bbade8fd7398de7535d 100644 (file)
@@ -46,6 +46,7 @@
 #include "drivers/common/driverfuncs.h"
 
 #include "intel_screen.h"
+#include "intel_chipset.h"
 
 #include "i830_dri.h"
 #include "i830_common.h"
@@ -66,6 +67,7 @@
 int INTEL_DEBUG = (0);
 #endif
 
+#define need_GL_NV_point_sprite
 #define need_GL_ARB_multisample
 #define need_GL_ARB_point_parameters
 #define need_GL_ARB_texture_compression
@@ -81,6 +83,7 @@ int INTEL_DEBUG = (0);
 #define need_GL_EXT_fog_coord
 #define need_GL_EXT_multi_draw_arrays
 #define need_GL_EXT_secondary_color
+#define need_GL_EXT_point_parameters
 #define need_GL_VERSION_2_0
 #define need_GL_VERSION_2_1
 #define need_GL_ARB_shader_objects
@@ -151,6 +154,7 @@ const struct dri_extension card_extensions[] =
     { "GL_ARB_multisample",                GL_ARB_multisample_functions },
     { "GL_ARB_multitexture",               NULL },
     { "GL_ARB_point_parameters",           GL_ARB_point_parameters_functions },
+    { "GL_NV_point_sprite",                GL_NV_point_sprite_functions },
     { "GL_ARB_texture_border_clamp",       NULL },
     { "GL_ARB_texture_compression",        GL_ARB_texture_compression_functions },
     { "GL_ARB_texture_cube_map",           NULL },
@@ -163,6 +167,8 @@ const struct dri_extension card_extensions[] =
     { "GL_NV_texture_rectangle",           NULL },
     { "GL_EXT_texture_rectangle",          NULL },
     { "GL_ARB_texture_rectangle",          NULL },
+    { "GL_ARB_point_sprite",               NULL},
+    { "GL_ARB_point_parameters",          NULL }, 
     { "GL_ARB_vertex_buffer_object",       GL_ARB_vertex_buffer_object_functions },
     { "GL_ARB_vertex_program",             GL_ARB_vertex_program_functions },
     { "GL_ARB_window_pos",                 GL_ARB_window_pos_functions },
@@ -182,6 +188,7 @@ const struct dri_extension card_extensions[] =
     { "GL_EXT_texture_env_dot3",           NULL },
     { "GL_EXT_texture_filter_anisotropic", NULL },
     { "GL_EXT_texture_lod_bias",           NULL },
+    { "GL_EXT_texture_sRGB",               NULL },
     { "GL_3DFX_texture_compression_FXT1",  NULL },
     { "GL_APPLE_client_storage",           NULL },
     { "GL_MESA_pack_invert",               NULL },
@@ -231,6 +238,7 @@ static const struct dri_debug_control debug_control[] =
     { "thre",  DEBUG_SINGLE_THREAD },
     { "wm",    DEBUG_WM },
     { "vs",    DEBUG_VS },
+    { "bat",   DEBUG_BATCH },
     { NULL,    0 }
 };
 
@@ -277,7 +285,7 @@ intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
        };
        intel->stats_wm++;
        intelFinish(&intel->ctx);
-       drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
+       drmCommandWrite(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
 }
 
 static void
@@ -291,7 +299,7 @@ intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
                .data = &tmp
        };
        intelFinish(&intel->ctx);
-       drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
+       drmCommandWrite(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
        q->Result = tmp - q->Result;
        q->Ready = GL_TRUE;
        intel->stats_wm--;
@@ -502,7 +510,7 @@ GLboolean intelInitContext( struct intel_context *intel,
       _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
       _mesa_enable_extension( ctx, "GL_S3_s3tc" );
    }
-   else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) {
+   else if (driQueryOptionb (&intel->optionCache, "force_s3tc_enable")) {
       _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
    }
 
@@ -584,6 +592,10 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
    if (driContextPriv) {
       struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
 
+      if (intel->driReadDrawable != driReadPriv) {
+          intel->driReadDrawable = driReadPriv;
+      }
+
       if ( intel->driDrawable != driDrawPriv ) {
         /* Shouldn't the readbuffer be stored also? */
         driDrawableInitVBlank( driDrawPriv, intel->vblank_flags,
@@ -672,19 +684,12 @@ void LOCK_HARDWARE( struct intel_context *intel )
 
    intel->locked = 1;
 
-   if (intel->aub_wrap) {
-      bm_fake_NotifyContendedLockTake( intel ); 
-      intel->vtbl.lost_hardware( intel );
-      intel->vtbl.aub_wrap(intel);
-      intel->aub_wrap = 0;
-   }
-
    if (bmError(intel)) {
       bmEvictAll(intel);
       intel->vtbl.lost_hardware( intel );
    }
 
-   /* Make sure nothing has been emitted prior to getting the lock: 
+   /* Make sure nothing has been emitted prior to getting the lock:
     */
    assert(intel->batch->map == 0);
 
@@ -717,8 +722,6 @@ void UNLOCK_HARDWARE( struct intel_context *intel )
    intel->vtbl.note_unlock( intel );
    intel->locked = 0;
 
-
-
    DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
    _glthread_UNLOCK_MUTEX(lockMutex); 
 }