Introduce .editorconfig
[mesa.git] / src / mesa / drivers / dri / i915 / intel_pixel_read.c
index 26eb4965b8dca2cb6e76550e4856c17139c47ef9..e6fa8f2dce8e7ad95c5ae908340a3d99ffce9666 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2003 VMware, Inc.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,7 +18,7 @@
  * 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.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * 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.
@@ -79,11 +79,10 @@ do_blit_readpixels(struct gl_context * ctx,
    struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
    GLuint dst_offset;
    drm_intel_bo *dst_buffer;
-   bool all;
    GLint dst_x, dst_y;
    GLuint dirty;
 
-   DBG("%s\n", __FUNCTION__);
+   DBG("%s\n", __func__);
 
    assert(_mesa_is_bufferobj(pack->BufferObj));
 
@@ -92,13 +91,13 @@ do_blit_readpixels(struct gl_context * ctx,
 
    if (ctx->_ImageTransferState ||
        !_mesa_format_matches_format_and_type(irb->mt->format, format, type,
-                                             false)) {
-      DBG("%s - bad format for blit\n", __FUNCTION__);
+                                             false, NULL)) {
+      DBG("%s - bad format for blit\n", __func__);
       return false;
    }
 
    if (pack->SwapBytes || pack->LsbFirst) {
-      DBG("%s: bad packing params\n", __FUNCTION__);
+      DBG("%s: bad packing params\n", __func__);
       return false;
    }
 
@@ -127,12 +126,7 @@ do_blit_readpixels(struct gl_context * ctx,
    intel_prepare_render(intel);
    intel->front_buffer_dirty = dirty;
 
-   all = (width * height * irb->mt->cpp == dst->Base.Size &&
-         x == 0 && dst_offset == 0);
-
-   dst_buffer = intel_bufferobj_buffer(intel, dst,
-                                      all ? INTEL_WRITE_FULL :
-                                      INTEL_WRITE_PART);
+   dst_buffer = intel_bufferobj_buffer(intel, dst);
 
    struct intel_mipmap_tree *pbo_mt =
       intel_miptree_create_for_bo(intel,
@@ -148,12 +142,13 @@ do_blit_readpixels(struct gl_context * ctx,
                            pbo_mt, 0, 0,
                            0, 0, dst_flip,
                            width, height, GL_COPY)) {
+      intel_miptree_release(&pbo_mt);
       return false;
    }
 
    intel_miptree_release(&pbo_mt);
 
-   DBG("%s - DONE\n", __FUNCTION__);
+   DBG("%s - DONE\n", __func__);
 
    return true;
 }
@@ -169,7 +164,7 @@ intelReadPixels(struct gl_context * ctx,
 
    intel_flush_rendering_to_batch(ctx);
 
-   DBG("%s\n", __FUNCTION__);
+   DBG("%s\n", __func__);
 
    if (_mesa_is_bufferobj(pack->BufferObj)) {
       /* Using PBOs, so try the BLT based path. */
@@ -178,7 +173,7 @@ intelReadPixels(struct gl_context * ctx,
          return;
       }
 
-      perf_debug("%s: fallback to CPU mapping in PBO case\n", __FUNCTION__);
+      perf_debug("%s: fallback to CPU mapping in PBO case\n", __func__);
    }
 
    /* glReadPixels() wont dirty the front buffer, so reset the dirty