i965/vec4: Don't lose the force_writemask_all flag during CSE.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_screen.c
index 30321242f43982be58d77abd4fa72f582ea8aa19..3640b675471eabfe4fb17338703c00225746b3bd 100644 (file)
@@ -37,7 +37,7 @@
 #include "main/fbobject.h"
 #include "main/version.h"
 #include "swrast/s_renderbuffer.h"
-#include "glsl/ralloc.h"
+#include "util/ralloc.h"
 
 #include "utils.h"
 #include "xmlpool.h"
@@ -61,10 +61,6 @@ DRI_CONF_BEGIN
       DRI_CONF_OPT_BEGIN_B(hiz, "true")
         DRI_CONF_DESC(en, "Enable Hierarchical Z on gen6+")
       DRI_CONF_OPT_END
-
-      DRI_CONF_OPT_BEGIN_B(disable_derivative_optimization, "false")
-        DRI_CONF_DESC(en, "Derivatives with finer granularity by default")
-      DRI_CONF_OPT_END
    DRI_CONF_SECTION_END
 
    DRI_CONF_SECTION_QUALITY
@@ -84,6 +80,7 @@ DRI_CONF_BEGIN
       DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
       DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
       DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
+      DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
 
       DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")
         DRI_CONF_DESC(en, "Perform code generation at shader link time.")
@@ -95,12 +92,11 @@ DRI_CONF_END
 #include "intel_batchbuffer.h"
 #include "intel_buffers.h"
 #include "intel_bufmgr.h"
-#include "intel_chipset.h"
 #include "intel_fbo.h"
 #include "intel_mipmap_tree.h"
 #include "intel_screen.h"
 #include "intel_tex.h"
-#include "intel_regions.h"
+#include "intel_image.h"
 
 #include "brw_context.h"
 
@@ -140,7 +136,6 @@ aub_dump_bmp(struct gl_context *ctx)
            continue;
         }
 
-         assert(irb->mt->pitch % irb->mt->cpp == 0);
          drm_intel_gem_bo_aub_dump_bmp(irb->mt->bo,
                                       irb->draw_x,
                                       irb->draw_y,
@@ -179,10 +174,10 @@ intel_dri2_flush_with_flags(__DRIcontext *cPriv,
    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;
-   }
+   if (reason == __DRI2_THROTTLE_SWAPBUFFER)
+      brw->need_swap_throttle = true;
+   if (reason == __DRI2_THROTTLE_FLUSHFRONT)
+      brw->need_flush_throttle = true;
 
    intel_batchbuffer_flush(brw);
 
@@ -217,12 +212,18 @@ static struct intel_image_format intel_image_formats[] = {
    { __DRI_IMAGE_FOURCC_ARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } },
 
+   { __DRI_IMAGE_FOURCC_ABGR8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_ABGR8888, 4 } } },
+
    { __DRI_IMAGE_FOURCC_SARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
 
    { __DRI_IMAGE_FOURCC_XRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
 
+   { __DRI_IMAGE_FOURCC_XBGR8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
+     { { 0, 0, 0, __DRI_IMAGE_FORMAT_XBGR8888, 4 }, } },
+
    { __DRI_IMAGE_FOURCC_RGB565, __DRI_IMAGE_COMPONENTS_RGB, 1,
      { { 0, 0, 0, __DRI_IMAGE_FORMAT_RGB565, 2 } } },
 
@@ -846,10 +847,6 @@ brw_query_renderer_integer(__DRIscreen *psp, int param, unsigned int *value)
    case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
       value[0] = 1;
       return 0;
-   case __DRI2_RENDERER_PREFERRED_PROFILE:
-      value[0] = (psp->max_gl_core_version != 0)
-         ? (1U << __DRI_API_OPENGL_CORE) : (1U << __DRI_API_OPENGL);
-      return 0;
    default:
       return driQueryRendererIntegerCommon(psp, param, value);
    }
@@ -1265,15 +1262,11 @@ set_max_gl_versions(struct intel_screen *screen)
    __DRIscreen *psp = screen->driScrnPriv;
 
    switch (screen->devinfo->gen) {
+   case 9:
    case 8:
    case 7:
-      psp->max_gl_core_version = 33;
-      psp->max_gl_compat_version = 30;
-      psp->max_gl_es1_version = 11;
-      psp->max_gl_es2_version = 30;
-      break;
    case 6:
-      psp->max_gl_core_version = 31;
+      psp->max_gl_core_version = 33;
       psp->max_gl_compat_version = 30;
       psp->max_gl_es1_version = 11;
       psp->max_gl_es2_version = 30;
@@ -1286,8 +1279,7 @@ set_max_gl_versions(struct intel_screen *screen)
       psp->max_gl_es2_version = 20;
       break;
    default:
-      assert(!"unrecognized intel_screen::gen");
-      break;
+      unreachable("unrecognized intel_screen::gen");
    }
 }
 
@@ -1377,7 +1369,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 
 struct intel_buffer {
    __DRIbuffer base;
-   struct intel_region *region;
+   drm_intel_bo *bo;
 };
 
 static __DRIbuffer *
@@ -1396,23 +1388,27 @@ intelAllocateBuffer(__DRIscreen *screen,
       return NULL;
 
    /* The front and back buffers are color buffers, which are X tiled. */
-   intelBuffer->region = intel_region_alloc(intelScreen,
-                                            I915_TILING_X,
-                                            format / 8,
-                                            width,
-                                            height,
-                                            true);
-
-   if (intelBuffer->region == NULL) {
+   uint32_t tiling = I915_TILING_X;
+   unsigned long pitch;
+   int cpp = format / 8;
+   intelBuffer->bo = drm_intel_bo_alloc_tiled(intelScreen->bufmgr,
+                                              "intelAllocateBuffer",
+                                              width,
+                                              height,
+                                              cpp,
+                                              &tiling, &pitch,
+                                              BO_ALLOC_FOR_RENDER);
+
+   if (intelBuffer->bo == NULL) {
           free(intelBuffer);
           return NULL;
    }
 
-   drm_intel_bo_flink(intelBuffer->region->bo, &intelBuffer->base.name);
+   drm_intel_bo_flink(intelBuffer->bo, &intelBuffer->base.name);
 
    intelBuffer->base.attachment = attachment;
-   intelBuffer->base.cpp = intelBuffer->region->cpp;
-   intelBuffer->base.pitch = intelBuffer->region->pitch;
+   intelBuffer->base.cpp = cpp;
+   intelBuffer->base.pitch = pitch;
 
    return &intelBuffer->base;
 }
@@ -1422,7 +1418,7 @@ intelReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
 {
    struct intel_buffer *intelBuffer = (struct intel_buffer *) buffer;
 
-   intel_region_release(&intelBuffer->region);
+   drm_intel_bo_unreference(intelBuffer->bo);
    free(intelBuffer);
 }