Revert "i965/wm: use proper API buffer size for the surfaces."
[mesa.git] / src / mesa / drivers / dri / i965 / intel_buffer_objects.c
index 3b0a206d886755b9ec06f64cec0eb9b71c20e23e..7a5b3fca595e3f3db46eb97553d75d37fc015d5f 100644 (file)
@@ -1,5 +1,4 @@
-/**************************************************************************
- *
+/*
  * Copyright 2003 VMware, Inc.
  * All Rights Reserved.
  *
@@ -7,7 +6,7 @@
  * copy of this software and associated documentation files (the
  * "Software"), to deal in the Software without restriction, including
  * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
+ * distribute, sublicense, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
  *
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
+ */
 
 /**
  * @file intel_buffer_objects.c
@@ -108,6 +106,8 @@ alloc_buffer_object(struct brw_context *brw,
     */
    if (intel_obj->Base.UsageHistory & USAGE_UNIFORM_BUFFER)
       brw->ctx.NewDriverState |= BRW_NEW_UNIFORM_BUFFER;
+   if (intel_obj->Base.UsageHistory & USAGE_SHADER_STORAGE_BUFFER)
+      brw->ctx.NewDriverState |= BRW_NEW_UNIFORM_BUFFER;
    if (intel_obj->Base.UsageHistory & USAGE_TEXTURE_BUFFER)
       brw->ctx.NewDriverState |= BRW_NEW_TEXTURE_BUFFER;
    if (intel_obj->Base.UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER)
@@ -254,9 +254,9 @@ brw_buffer_subdata(struct gl_context *ctx,
     * (otherwise, an app that might occasionally stall but mostly not will end
     * up with blitting all the time, at the cost of bandwidth)
     */
-   if (brw->has_llc) {
-      if (offset + size <= intel_obj->gpu_active_start ||
-          intel_obj->gpu_active_end <= offset) {
+   if (offset + size <= intel_obj->gpu_active_start ||
+       intel_obj->gpu_active_end <= offset) {
+      if (brw->has_llc) {
          drm_intel_gem_bo_map_unsynchronized(intel_obj->buffer);
          memcpy(intel_obj->buffer->virtual + offset, data, size);
          drm_intel_bo_unmap(intel_obj->buffer);
@@ -264,6 +264,8 @@ brw_buffer_subdata(struct gl_context *ctx,
          if (intel_obj->gpu_active_end > intel_obj->gpu_active_start)
             intel_obj->prefer_stall_to_blit = true;
          return;
+      } else {
+         perf_debug("BufferSubData could be unsynchronized, but !LLC doesn't support it yet\n");
       }
    }
 
@@ -437,9 +439,13 @@ brw_map_buffer_range(struct gl_context *ctx,
       return obj->Mappings[index].Pointer;
    }
 
-   if (access & GL_MAP_UNSYNCHRONIZED_BIT)
+   if (access & GL_MAP_UNSYNCHRONIZED_BIT) {
+      if (!brw->has_llc && brw->perf_debug &&
+          drm_intel_bo_busy(intel_obj->buffer)) {
+         perf_debug("MapBufferRange with GL_MAP_UNSYNCHRONIZED_BIT stalling (it's actually synchronized on non-LLC platforms)\n");
+      }
       drm_intel_gem_bo_map_unsynchronized(intel_obj->buffer);
-   else if (!brw->has_llc && (!(access & GL_MAP_READ_BIT) ||
+   else if (!brw->has_llc && (!(access & GL_MAP_READ_BIT) ||
                               (access & GL_MAP_PERSISTENT_BIT))) {
       drm_intel_gem_bo_map_gtt(intel_obj->buffer);
       mark_buffer_inactive(intel_obj);
@@ -554,7 +560,7 @@ brw_unmap_buffer(struct gl_context *ctx,
        * flush.  Once again, we wish for a domain tracker in libdrm to cover
        * usage inside of a batchbuffer.
        */
-      intel_batchbuffer_emit_mi_flush(brw);
+      brw_emit_mi_flush(brw);
 
       drm_intel_bo_unreference(intel_obj->range_map_bo[index]);
       intel_obj->range_map_bo[index] = NULL;
@@ -626,7 +632,7 @@ brw_copy_buffer_subdata(struct gl_context *ctx,
     * flush.  Once again, we wish for a domain tracker in libdrm to cover
     * usage inside of a batchbuffer.
     */
-   intel_batchbuffer_emit_mi_flush(brw);
+   brw_emit_mi_flush(brw);
 }
 
 void