projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
i965: Rewrite the HiZ op
[mesa.git]
/
src
/
mesa
/
drivers
/
dri
/
intel
/
intel_pixel_read.c
diff --git
a/src/mesa/drivers/dri/intel/intel_pixel_read.c
b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index b249f9a5a0bc648235a1207fe43e9196543a4980..34fed3d1f449f2fe276cfb2f6ed0df126a2a2f39 100644
(file)
--- a/
src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/
src/mesa/drivers/dri/intel/intel_pixel_read.c
@@
-31,8
+31,8
@@
#include "main/macros.h"
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
#include "main/image.h"
#include "main/bufferobj.h"
+#include "main/readpix.h"
#include "main/state.h"
#include "main/state.h"
-#include "swrast/swrast.h"
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_screen.h"
#include "intel_context.h"
@@
-42,6
+42,8
@@
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
#include "intel_pixel.h"
#include "intel_buffer_objects.h"
+#define FILE_DEBUG_FLAG DEBUG_PIXEL
+
/* For many applications, the new ability to pull the source buffers
* back out of the GTT and then do the packing/conversion operations
* in software will be as much of an improvement as trying to get the
/* For many applications, the new ability to pull the source buffers
* back out of the GTT and then do the packing/conversion operations
* in software will be as much of an improvement as trying to get the
@@
-64,7
+66,7
@@
* any case.
*/
* any case.
*/
-static
GLboolean
+static
bool
do_blit_readpixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
do_blit_readpixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
@@
-76,35
+78,32
@@
do_blit_readpixels(struct gl_context * ctx,
GLuint dst_offset;
GLuint rowLength;
drm_intel_bo *dst_buffer;
GLuint dst_offset;
GLuint rowLength;
drm_intel_bo *dst_buffer;
-
GLboolean
all;
+
bool
all;
GLint dst_x, dst_y;
GLint dst_x, dst_y;
+ GLuint dirty;
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s\n", __FUNCTION__);
+ DBG("%s\n", __FUNCTION__);
if (!src)
if (!src)
- return
GL_FALSE
;
+ return
false
;
if (!_mesa_is_bufferobj(pack->BufferObj)) {
/* PBO only for now:
*/
if (!_mesa_is_bufferobj(pack->BufferObj)) {
/* PBO only for now:
*/
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s - not PBO\n", __FUNCTION__);
- return GL_FALSE;
+ DBG("%s - not PBO\n", __FUNCTION__);
+ return false;
}
if (ctx->_ImageTransferState ||
!intel_check_blit_format(src, format, type)) {
}
if (ctx->_ImageTransferState ||
!intel_check_blit_format(src, format, type)) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s - bad format for blit\n", __FUNCTION__);
- return GL_FALSE;
+ DBG("%s - bad format for blit\n", __FUNCTION__);
+ return false;
}
if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
}
if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s: bad packing params\n", __FUNCTION__);
- return GL_FALSE;
+ DBG("%s: bad packing params\n", __FUNCTION__);
+ return false;
}
if (pack->RowLength > 0)
}
if (pack->RowLength > 0)
@@
-113,26
+112,28
@@
do_blit_readpixels(struct gl_context * ctx,
rowLength = width;
if (pack->Invert) {
rowLength = width;
if (pack->Invert) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
- return GL_FALSE;
+ DBG("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
+ return false;
}
else {
if (ctx->ReadBuffer->Name == 0)
rowLength = -rowLength;
}
}
else {
if (ctx->ReadBuffer->Name == 0)
rowLength = -rowLength;
}
- dst_offset = (GLintptr) _mesa_image_address(2, pack, pixels, width, height,
- format, type, 0, 0, 0);
+ dst_offset = (GLintptr)pixels;
+ dst_offset += _mesa_image_offset(2, pack, width, height,
+ format, type, 0, 0, 0);
if (!_mesa_clip_copytexsubimage(ctx,
&dst_x, &dst_y,
&x, &y,
&width, &height)) {
if (!_mesa_clip_copytexsubimage(ctx,
&dst_x, &dst_y,
&x, &y,
&width, &height)) {
- return
GL_TRUE
;
+ return
true
;
}
}
+ dirty = intel->front_buffer_dirty;
intel_prepare_render(intel);
intel_prepare_render(intel);
+ intel->front_buffer_dirty = dirty;
all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
@@
-141,27
+142,26
@@
do_blit_readpixels(struct gl_context * ctx,
dst_y = 0;
dst_buffer = intel_bufferobj_buffer(intel, dst,
dst_y = 0;
dst_buffer = intel_bufferobj_buffer(intel, dst,
-
all ? INTEL_WRITE_FULL :
-
INTEL_WRITE_PART);
+ all ? INTEL_WRITE_FULL :
+ INTEL_WRITE_PART);
if (ctx->ReadBuffer->Name == 0)
y = ctx->ReadBuffer->Height - (y + height);
if (!intelEmitCopyBlit(intel,
src->cpp,
if (ctx->ReadBuffer->Name == 0)
y = ctx->ReadBuffer->Height - (y + height);
if (!intelEmitCopyBlit(intel,
src->cpp,
- src->pitch, src->b
uffer
, 0, src->tiling,
- rowLength, dst_buffer, dst_offset,
GL_FALSE
,
+ src->pitch, src->b
o
, 0, src->tiling,
+ rowLength, dst_buffer, dst_offset,
false
,
x, y,
dst_x, dst_y,
width, height,
GL_COPY)) {
x, y,
dst_x, dst_y,
width, height,
GL_COPY)) {
- return
GL_FALSE
;
+ return
false
;
}
}
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s - DONE\n", __FUNCTION__);
+ DBG("%s - DONE\n", __FUNCTION__);
- return
GL_TRUE
;
+ return
true
;
}
void
}
void
@@
-171,12
+171,15
@@
intelReadPixels(struct gl_context * ctx,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
struct intel_context *intel = intel_context(ctx);
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
{
struct intel_context *intel = intel_context(ctx);
-
GLboolean
dirty;
+
bool
dirty;
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
+ intel_flush_rendering_to_batch(ctx);
- intel_flush(ctx);
+ DBG("%s\n", __FUNCTION__);
+
+ if (do_blit_readpixels
+ (ctx, x, y, width, height, format, type, pack, pixels))
+ return;
/* glReadPixels() wont dirty the front buffer, so reset the dirty
* flag after calling intel_prepare_render(). */
/* glReadPixels() wont dirty the front buffer, so reset the dirty
* flag after calling intel_prepare_render(). */
@@
-184,23
+187,17
@@
intelReadPixels(struct gl_context * ctx,
intel_prepare_render(intel);
intel->front_buffer_dirty = dirty;
intel_prepare_render(intel);
intel->front_buffer_dirty = dirty;
- if (do_blit_readpixels
- (ctx, x, y, width, height, format, type, pack, pixels))
- return;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s: fallback to swrast\n", __FUNCTION__);
+ fallback_debug("%s: fallback to swrast\n", __FUNCTION__);
- /* Update Mesa state before calling down into _swrast_ReadPixels, as
- * the spans code requires the computed buffer states to be up to date,
- * but _swrast_ReadPixels only updates Mesa state after setting up
- * the spans code.
+ /* Update Mesa state before calling _mesa_readpixels().
+ * XXX this may not be needed since ReadPixels no longer uses the
+ * span code.
*/
if (ctx->NewState)
_mesa_update_state(ctx);
*/
if (ctx->NewState)
_mesa_update_state(ctx);
- _
swrast_ReadP
ixels(ctx, x, y, width, height, format, type, pack, pixels);
+ _
mesa_readp
ixels(ctx, x, y, width, height, format, type, pack, pixels);
/* There's an intel_prepare_render() call in intelSpanRenderStart(). */
intel->front_buffer_dirty = dirty;
/* There's an intel_prepare_render() call in intelSpanRenderStart(). */
intel->front_buffer_dirty = dirty;