i965/vec4: Only zero out unused message components when there are any.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_screen.c
index 12a96c03f73e12eef42f5629f63e4d16f037a696..eb6515e763d2a6a7318fc5ff5c530a1d5bb11ed5 100644 (file)
@@ -77,8 +77,6 @@ PUBLIC const char __driConfigOptions[] =
    DRI_CONF_SECTION_END
 DRI_CONF_END;
 
-const GLuint __driNConfigOptions = 12;
-
 #include "intel_batchbuffer.h"
 #include "intel_buffers.h"
 #include "intel_bufmgr.h"
@@ -153,29 +151,55 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
 };
 
 static void
-intelDRI2Flush(__DRIdrawable *drawable)
+intel_dri2_flush_with_flags(__DRIcontext *cPriv,
+                            __DRIdrawable *dPriv,
+                            unsigned flags,
+                            enum __DRI2throttleReason reason)
 {
-   GET_CURRENT_CONTEXT(ctx);
-   struct brw_context *brw = brw_context(ctx);
-   if (brw == NULL)
+   struct brw_context *brw = cPriv->driverPrivate;
+
+   if (!brw)
       return;
 
-   intel_resolve_for_dri2_flush(brw, drawable);
-   brw->need_throttle = true;
+   struct gl_context *ctx = &brw->ctx;
+
+   FLUSH_VERTICES(ctx, 0);
 
-   if (brw->batch.used)
-      intel_batchbuffer_flush(brw);
+   if (flags & __DRI2_FLUSH_DRAWABLE)
+      intel_resolve_for_dri2_flush(brw, dPriv);
+
+   if (reason == __DRI2_THROTTLE_SWAPBUFFER ||
+       reason == __DRI2_THROTTLE_FLUSHFRONT) {
+      brw->need_throttle = true;
+   }
+
+   intel_batchbuffer_flush(brw);
 
    if (INTEL_DEBUG & DEBUG_AUB) {
       aub_dump_bmp(ctx);
    }
 }
 
+/**
+ * Provides compatibility with loaders that only support the older (version
+ * 1-3) flush interface.
+ *
+ * That includes libGL up to Mesa 9.0, and the X Server at least up to 1.13.
+ */
+static void
+intel_dri2_flush(__DRIdrawable *drawable)
+{
+   intel_dri2_flush_with_flags(drawable->driContextPriv, drawable,
+                               __DRI2_FLUSH_DRAWABLE,
+                               __DRI2_THROTTLE_SWAPBUFFER);
+}
+
 static const struct __DRI2flushExtensionRec intelFlushExtension = {
-    .base = { __DRI2_FLUSH, 3 },
+    .base = { __DRI2_FLUSH, 4 },
 
-    .flush              = intelDRI2Flush,
+    .flush              = intel_dri2_flush,
     .invalidate         = dri2InvalidateDrawable,
+    .flush_with_flags   = intel_dri2_flush_with_flags,
 };
 
 static struct intel_image_format intel_image_formats[] = {
@@ -506,6 +530,9 @@ intel_create_image(__DRIscreen *screen,
       tiling = I915_TILING_NONE;
    }
 
+   if (use & __DRI_IMAGE_USE_LINEAR)
+      tiling = I915_TILING_NONE;
+
    image = intel_allocate_image(format, loaderPrivate);
    if (image == NULL)
       return NULL;
@@ -719,6 +746,7 @@ intel_create_image_from_dma_bufs(__DRIscreen *screen,
       return NULL;
    }
 
+   image->dma_buf_imported = true;
    image->yuv_color_space = yuv_color_space;
    image->sample_range = sample_range;
    image->horizontal_siting = horizontal_siting;
@@ -1258,8 +1286,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
       return false;
    }
    /* parse information in __driConfigOptions */
-   driParseOptionInfo(&intelScreen->optionCache,
-                      __driConfigOptions, __driNConfigOptions);
+   driParseOptionInfo(&intelScreen->optionCache, __driConfigOptions);
 
    intelScreen->driScrnPriv = psp;
    psp->driverPrivate = (void *) intelScreen;