Re: [Mesa-dev] [PATCH] mesa: Fix multithreaded buffer object refcounting.
Hi Brian, On Tuesday, October 18, 2011 17:05:53 Brian Paul wrote: This was brought up a few weeks ago by someone else. I had posted the start of a patch to fix it. I'm attaching an updated version that I think is pretty clean. But there's a few lines missing and it's totally untested. Maybe you could finish this up. Look for 'XXX' comments. Yes, the code of this approach looks way cleaner. Hmm, I am observing that you are deleting the gl_array_object with the drivers DeleteArrayOject callback but you only malloc'ed the struct. This should be symmetric at least. This raises a question for me: Should the push/pop just save a bunch or driver independent variables or should we use full driver provided array object? I ended up with the conclusion that we should do that independent of the driver because the driver provided array objects - even if currently not overloaded by any driver - will probably do additional work. Work with is never used by the push/pop code because it will never really bind the object to the context. Also doing this with the driver provided array objects will have a lot of overhead since we at first reference the null buffer objects for every array object from the drivers NewArrayObject that probably calls _mesa_initialize_array_object call chain. Then immediately overwrite all of them with the current state of the buffer objects. This lead me to an approach that uses less library functions and in a first step just makes sure that programs dont crash. This appears more efficient in the end. But doing this in the way you started, by doing this with full blown array objects, could share much more code. Which is probably more maintainable. Which variant? Also, when we are at a clean solution, should we just copy/rereference back all the array objects on pop or should we really rebind all of them using the _mesa_* buffer object function calls? This would ensure that the drivers BindBuffer logic is called the way it is used every time. Also this would ensure that, by looking up the arrays by their names, already deleted buffer objects, that are already removed from the name hash and forcefully unbound from the current state but might still be referenced by the attribute stack, are not poped back into the current state. Greetings Mathias ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] glsl: Short-circuit lower_if_to_cond_assign when MaxIfDepth is UINT_MAX.
Looks good to me. Bryan On 10/18/2011 05:20 PM, Kenneth Graunke wrote: Setting MaxIfDepth to UINT_MAX effectively means don't lower anything. Explicitly checking for this common case allows us to avoid walking the IR, computing nesting levels, and so on. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: Bryan Cain bryanca...@gmail.com Cc: Ian Romanick i...@freedesktop.org --- src/glsl/lower_if_to_cond_assign.cpp |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/glsl/lower_if_to_cond_assign.cpp b/src/glsl/lower_if_to_cond_assign.cpp index 7b89a15..2c5d561 100644 --- a/src/glsl/lower_if_to_cond_assign.cpp +++ b/src/glsl/lower_if_to_cond_assign.cpp @@ -79,6 +79,9 @@ public: bool lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth) { + if (max_depth == UINT_MAX) + return false; + ir_if_to_cond_assign_visitor v(max_depth); visit_list_elements(v, instructions); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] texgetimage: add missing return on error
Missed this back in the arb_robustness branch 6b329b9274b18c50f4177eef7ee087d50ebc1525. --- src/mesa/main/texgetimage.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index f911886..e6edb45 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -849,6 +849,7 @@ getcompressedteximage_error_check(struct gl_context *ctx, GLenum target, _mesa_error(ctx, GL_INVALID_OPERATION, glGetnCompressedTexImageARB(out of bounds access: bufSize (%d) is too small), clientMemSize); + return GL_TRUE; } } else { /* do bounds checking on PBO write */ -- 1.7.6.msysgit.0 0001-texgetimage-add-missing-return-on-error.patch Description: Binary data ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] mesa/image: delete dead store
The return value here is a) always zero, b) never used. --- src/mesa/main/image.c |7 --- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 7d95dd6..ca5771c 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1148,16 +1148,9 @@ _mesa_image_address( GLuint dimensions, if (type == GL_BITMAP) { /* BITMAP data */ GLint comp_per_pixel; /* components per pixel */ - GLint bytes_per_comp; /* bytes per component */ GLint bytes_per_row; GLint bytes_per_image; - /* Compute bytes per component */ - bytes_per_comp = _mesa_sizeof_packed_type( type ); - if (bytes_per_comp 0) { - return NULL; - } - /* Compute number of components per pixel */ comp_per_pixel = _mesa_components_in_format( format ); if (comp_per_pixel 0) { -- 1.7.6.msysgit.0 0006-mesa-image-delete-dead-store.patch Description: Binary data ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] mesa/image: assert on bad format
NULL as an error indicator is meaningless, since it will return NULL on success anyway if the caller passes in zero as the image's address and asks to calculate the offset of the first pixel. For example, _mesa_validate_pbo_access() does this. This also matches the code in the non-GL_BITMAP codepath, which already has an assert like this. --- src/mesa/main/image.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ca5771c..3e0ca05 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1093,17 +1093,17 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) * Pixel unpacking/packing parameters are observed according to \p packing. * * \param dimensions either 1, 2 or 3 to indicate dimensionality of image + * \param packing the pixelstore attributes * \param image starting address of image data * \param width the image width - * \param height theimage height - * \param format the pixel format - * \param type the pixel data type - * \param packing the pixelstore attributes + * \param height the image height + * \param format the pixel format (must be validated beforehand) + * \param type the pixel data type (must be validated beforehand) * \param img which image in the volume (0 for 1D or 2D images) * \param row row of pixel in the image (0 for 1D images) * \param column column of pixel in the image * - * \return address of pixel on success, or NULL on error. + * \return address of pixel. * * \sa gl_pixelstore_attrib. */ @@ -1153,9 +1153,9 @@ _mesa_image_address( GLuint dimensions, /* Compute number of components per pixel */ comp_per_pixel = _mesa_components_in_format( format ); - if (comp_per_pixel 0) { - return NULL; - } + + /* The pixel type and format should have been error checked earlier */ + assert(comp_per_pixel 0); bytes_per_row = alignment * CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); -- 1.7.6.msysgit.0 From adb592410ca506107b5294222eadd84c35584ed5 Mon Sep 17 00:00:00 2001 From: nobled nob...@dreamwidth.org Date: Mon, 17 Oct 2011 21:34:44 + Subject: [PATCH 2/4] mesa/image: assert on bad format NULL as an error indicator is meaningless, since it will return NULL on success anyway if the caller passes in zero as the image's address and asks to calculate the offset of the first pixel. For example, _mesa_validate_pbo_access() does this. This also matches the code in the non-GL_BITMAP codepath, which already has an assert like this. --- src/mesa/main/image.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ca5771c..3e0ca05 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1093,17 +1093,17 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) * Pixel unpacking/packing parameters are observed according to \p packing. * * \param dimensions either 1, 2 or 3 to indicate dimensionality of image + * \param packing the pixelstore attributes * \param image starting address of image data * \param width the image width - * \param height theimage height - * \param format the pixel format - * \param type the pixel data type - * \param packing the pixelstore attributes + * \param height the image height + * \param format the pixel format (must be validated beforehand) + * \param type the pixel data type (must be validated beforehand) * \param img which image in the volume (0 for 1D or 2D images) * \param row row of pixel in the image (0 for 1D images) * \param column column of pixel in the image * - * \return address of pixel on success, or NULL on error. + * \return address of pixel. * * \sa gl_pixelstore_attrib. */ @@ -1153,9 +1153,9 @@ _mesa_image_address( GLuint dimensions, /* Compute number of components per pixel */ comp_per_pixel = _mesa_components_in_format( format ); - if (comp_per_pixel 0) { - return NULL; - } + + /* The pixel type and format should have been error checked earlier */ + assert(comp_per_pixel 0); bytes_per_row = alignment * CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); -- 1.7.6.msysgit.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] mesa: add _mesa_image_offset()
--- src/mesa/main/image.c | 67 src/mesa/main/image.h |7 + 2 files changed, 57 insertions(+), 17 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 3e0ca05..ba66c8a 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1088,13 +1088,12 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) /** - * Return the address of a specific pixel in an image (1D, 2D or 3D). + * Return the byte offset of a specific pixel in an image (1D, 2D or 3D). * * Pixel unpacking/packing parameters are observed according to \p packing. * * \param dimensions either 1, 2 or 3 to indicate dimensionality of image * \param packing the pixelstore attributes - * \param image starting address of image data * \param width the image width * \param height the image height * \param format the pixel format (must be validated beforehand) @@ -1102,18 +1101,17 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) * \param img which image in the volume (0 for 1D or 2D images) * \param row row of pixel in the image (0 for 1D images) * \param column column of pixel in the image - * - * \return address of pixel. + * + * \return offset of pixel. * * \sa gl_pixelstore_attrib. */ -GLvoid * -_mesa_image_address( GLuint dimensions, - const struct gl_pixelstore_attrib *packing, - const GLvoid *image, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - GLint img, GLint row, GLint column ) +GLintptr +_mesa_image_offset( GLuint dimensions, +const struct gl_pixelstore_attrib *packing, +GLsizei width, GLsizei height, +GLenum format, GLenum type, +GLint img, GLint row, GLint column ) { GLint alignment;/* 1, 2 or 4 */ GLint pixels_per_row; @@ -1121,7 +1119,7 @@ _mesa_image_address( GLuint dimensions, GLint skiprows; GLint skippixels; GLint skipimages; /* for 3-D volume images */ - GLubyte *pixel_addr; + GLintptr offset; ASSERT(dimensions = 1 dimensions = 3); @@ -1162,8 +1160,7 @@ _mesa_image_address( GLuint dimensions, bytes_per_image = bytes_per_row * rows_per_image; - pixel_addr = (GLubyte *) image - + (skipimages + img) * bytes_per_image + offset = (skipimages + img) * bytes_per_image + (skiprows + row) * bytes_per_row + (skippixels + column) / 8; } @@ -1196,14 +1193,50 @@ _mesa_image_address( GLuint dimensions, } /* compute final pixel address */ - pixel_addr = (GLubyte *) image - + (skipimages + img) * bytes_per_image + offset = (skipimages + img) * bytes_per_image + topOfImage + (skiprows + row) * bytes_per_row + (skippixels + column) * bytes_per_pixel; } - return (GLvoid *) pixel_addr; + return offset; +} + + +/** + * Return the address of a specific pixel in an image (1D, 2D or 3D). + * + * Pixel unpacking/packing parameters are observed according to \p packing. + * + * \param dimensions either 1, 2 or 3 to indicate dimensionality of image + * \param packing the pixelstore attributes + * \param image starting address of image data + * \param width the image width + * \param height the image height + * \param format the pixel format (must be validated beforehand) + * \param type the pixel data type (must be validated beforehand) + * \param img which image in the volume (0 for 1D or 2D images) + * \param row row of pixel in the image (0 for 1D images) + * \param column column of pixel in the image + * + * \return address of pixel. + * + * \sa gl_pixelstore_attrib. + */ +GLvoid * +_mesa_image_address( GLuint dimensions, + const struct gl_pixelstore_attrib *packing, + const GLvoid *image, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint img, GLint row, GLint column ) +{ + const GLubyte *addr = (const GLubyte *) image; + + addr += _mesa_image_offset(dimensions, packing, width, height, + format, type, img, row, column); + + return (GLvoid *) addr; } diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index 46adaec..f0ce029 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -84,6 +84,13 @@ _mesa_is_integer_format(GLenum format); extern GLboolean _mesa_is_compressed_format(struct gl_context *ctx, GLenum format); +extern GLintptr +_mesa_image_offset( GLuint dimensions, +const struct gl_pixelstore_attrib *packing, +GLsizei width, GLsizei height, +GLenum format, GLenum type, +GLint img, GLint row, GLint column ); +
[Mesa-dev] [PATCH 4/4] mesa, intel: use _mesa_image_offset() for PBOs
This avoids forming invalid pointers needlessly, which even if never dereferenced is undefined behavior. It also makes _mesa_validate_pbo_access() more comprehensible. --- src/mesa/drivers/dri/intel/intel_pixel_read.c |5 +++-- src/mesa/main/pbo.c | 25 ++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index c8e415d..d45a442 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -120,8 +120,9 @@ do_blit_readpixels(struct gl_context * ctx, 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, diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index 4e7e6f9..023662d 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -68,8 +68,8 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, GLsizei clientMemSize, const GLvoid *ptr) { - const GLvoid *start, *end, *offset; - const GLubyte *sizeAddr; /* buffer size, cast to a pointer */ + /* unsigned, to detect overflow/wrap-around */ + uintptr_t start, end, offset, size; /* If no PBO is bound, 'ptr' is a pointer to client memory containing 'clientMemSize' bytes. @@ -78,29 +78,32 @@ _mesa_validate_pbo_access(GLuint dimensions, */ if (!_mesa_is_bufferobj(pack-BufferObj)) { offset = 0; - sizeAddr = ((const GLubyte *) 0) + clientMemSize; + size = clientMemSize; } else { offset = ptr; - sizeAddr = ((const GLubyte *) 0) + pack-BufferObj-Size; + size = pack-BufferObj-Size; } - if (sizeAddr == 0) + if (size == 0) /* no buffer! */ return GL_FALSE; /* get the offset to the first pixel we'll read/write */ - start = _mesa_image_address(dimensions, pack, offset, width, height, - format, type, 0, 0, 0); + start = _mesa_image_offset(dimensions, pack, width, height, + format, type, 0, 0, 0); /* get the offset to just past the last pixel we'll read/write */ - end = _mesa_image_address(dimensions, pack, offset, width, height, - format, type, depth-1, height-1, width); + end = _mesa_image_offset(dimensions, pack, width, height, + format, type, depth-1, height-1, width); - if ((const GLubyte *) start sizeAddr) { + start += offset; + end += offset; + + if (start size) { /* This will catch negative values / wrap-around */ return GL_FALSE; } - if ((const GLubyte *) end sizeAddr) { + if (end size) { /* Image read/write goes beyond end of buffer */ return GL_FALSE; } -- 1.7.6.msysgit.0 From 0fec8cecad17894d77d6cd677bd7b2ec7773 Mon Sep 17 00:00:00 2001 From: nobled nob...@dreamwidth.org Date: Wed, 19 Oct 2011 06:35:53 + Subject: [PATCH 9/9] mesa,intel: use _mesa_image_offset() for PBOs This avoids forming invalid pointers needlessly, which even if never dereferenced is undefined behavior. It also makes _mesa_validate_pbo_access() more comprehensible. --- src/mesa/drivers/dri/intel/intel_pixel_read.c |5 +++-- src/mesa/main/pbo.c | 25 ++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index c8e415d..d45a442 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -120,8 +120,9 @@ do_blit_readpixels(struct gl_context * ctx, 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, diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index 4e7e6f9..023662d 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -68,8 +68,8 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, GLsizei clientMemSize, const GLvoid *ptr) { - const GLvoid *start, *end, *offset; - const GLubyte *sizeAddr; /* buffer size, cast to a pointer */ + /* unsigned, to
Re: [Mesa-dev] [PATCH] texgetimage: add missing return on error
On 10/19/2011 05:54 AM, nobled wrote: Missed this back in the arb_robustness branch 6b329b9274b18c50f4177eef7ee087d50ebc1525. --- src/mesa/main/texgetimage.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index f911886..e6edb45 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -849,6 +849,7 @@ getcompressedteximage_error_check(struct gl_context *ctx, GLenum target, _mesa_error(ctx, GL_INVALID_OPERATION, glGetnCompressedTexImageARB(out of bounds access: bufSize (%d) is too small), clientMemSize); + return GL_TRUE; } } else { /* do bounds checking on PBO write */ Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] mesa/image: assert on bad format
On 10/19/2011 06:02 AM, nobled wrote: NULL as an error indicator is meaningless, since it will return NULL on success anyway if the caller passes in zero as the image's address and asks to calculate the offset of the first pixel. For example, _mesa_validate_pbo_access() does this. This also matches the code in the non-GL_BITMAP codepath, which already has an assert like this. --- src/mesa/main/image.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ca5771c..3e0ca05 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1093,17 +1093,17 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) * Pixel unpacking/packing parameters are observed according to \p packing. * * \param dimensions either 1, 2 or 3 to indicate dimensionality of image + * \param packing the pixelstore attributes * \param image starting address of image data * \param width the image width - * \param height theimage height - * \param format the pixel format - * \param type the pixel data type - * \param packing the pixelstore attributes + * \param height the image height + * \param format the pixel format (must be validated beforehand) + * \param type the pixel data type (must be validated beforehand) * \param img which image in the volume (0 for 1D or 2D images) * \param row row of pixel in the image (0 for 1D images) * \param column column of pixel in the image * - * \return address of pixel on success, or NULL on error. + * \return address of pixel. * * \sa gl_pixelstore_attrib. */ @@ -1153,9 +1153,9 @@ _mesa_image_address( GLuint dimensions, /* Compute number of components per pixel */ comp_per_pixel = _mesa_components_in_format( format ); - if (comp_per_pixel 0) { - return NULL; - } + + /* The pixel type and format should have been error checked earlier */ + assert(comp_per_pixel 0); bytes_per_row = alignment * CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); For the GL_BITMAP case I think that we could just assert that format==GL_COLOR_INDEX || format== G_STENCIL_INDEX. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/4] mesa: add _mesa_image_offset()
On 10/19/2011 06:03 AM, nobled wrote: --- src/mesa/main/image.c | 67 src/mesa/main/image.h |7 + 2 files changed, 57 insertions(+), 17 deletions(-) Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] mesa, intel: use _mesa_image_offset() for PBOs
On 10/19/2011 06:03 AM, nobled wrote: This avoids forming invalid pointers needlessly, which even if never dereferenced is undefined behavior. It also makes _mesa_validate_pbo_access() more comprehensible. Reviewed-by: Brian Paul bri...@vmware.com BTW, be sure to test these changes with the glean pbo test. It covers quite a few cases. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 41999] New: GL_OES_mapbuffer is advertised but calling glMapBufferOES throws a warning
https://bugs.freedesktop.org/show_bug.cgi?id=41999 Bug #: 41999 Summary: GL_OES_mapbuffer is advertised but calling glMapBufferOES throws a warning Classification: Unclassified Product: Mesa Version: git Platform: Other OS/Version: All Status: NEW Severity: normal Priority: medium Component: Mesa core AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: n...@linux.intel.com When using a GLES2 context, the GL_OES_mapbuffer extension is advertised but if you actually try to call it ends up in generic_nop and throws a warning. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] remove unused but set variables
from osmesa, radeon and r600 classic drivers.diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index cc584ca..10c88d7 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -498,7 +498,6 @@ GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx) unsigned int ui, i; unsigned int unNumOfReg; unsigned int unBit; -GLuint exportCount; GLboolean point_sprite = GL_FALSE; if(GL_FALSE == fp-loaded) @@ -717,8 +716,6 @@ GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx) } } -exportCount = (evergreen-SQ_PGM_EXPORTS_PS.u32All EXPORT_MODE_mask) / (1 EXPORT_MODE_shift); - return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 74563ca..7016063 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -689,8 +689,6 @@ static void evergreenAlignDataToDword(struct gl_context *ctx, static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) { context_t *context = EVERGREEN_CONTEXT(ctx); -GLuint stride; -int ret; int i, index; EVERGREEN_STATECHANGE(context, vtx); @@ -700,8 +698,6 @@ static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client struct radeon_aos *aos = context-radeon.tcl.aos[index]; i = context-stream_desc[index].element; -stride = (input[i]-StrideB == 0) ? getTypeSize(input[i]-Type) * input[i]-Size : input[i]-StrideB; - if (input[i]-Type == GL_DOUBLE || input[i]-Type == GL_UNSIGNED_INT || input[i]-Type == GL_INT #if MESA_BIG_ENDIAN || getTypeSize(input[i]-Type) != 4 @@ -781,10 +777,6 @@ static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client RADEON_GEM_DOMAIN_GTT, 0); } } - -ret = radeon_cs_space_check_with_bo(context-radeon.cmdbuf.cs, -first_elem(context-radeon.dma.reserved)-bo, -RADEON_GEM_DOMAIN_GTT, 0); } static void evergreenFreeData(struct gl_context *ctx) diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 117916a..a968eaf 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -454,11 +454,6 @@ static void evergreenTranslateAttrib(struct gl_context *ctx, GLuint unLoc, int c StreamDesc * pStreamDesc = (context-stream_desc[context-nNumActiveAos]); - GLuint stride; - - stride = (input-StrideB == 0) ? evergreen_getTypeSize(input-Type) * input-Size - : input-StrideB; - if (input-Type == GL_DOUBLE || input-Type == GL_UNSIGNED_INT || input-Type == GL_INT #if MESA_BIG_ENDIAN || evergreen_getTypeSize(input-Type) != 4 diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 216ff0b..bc58695 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -954,7 +954,6 @@ GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, VTX_FETCH_METHOD* pFetchMethod) { GLuint client_size_inbyte; - GLuint data_format; GLuint mega_fetch_count; GLuint is_mega_fetch_flag; @@ -975,8 +974,6 @@ GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, vfetch_instruction_ptr = assembled_vfetch_instruction_ptr; } - data_format = GetSurfaceFormat(dataElementType, number_of_elements, client_size_inbyte); - if(GL_TRUE == pFetchMethod-bEnableMini) //More conditions here { //TODO : mini fetch @@ -2668,8 +2665,6 @@ GLboolean check_scalar(r700_AssemblerBase* pAsm, BITS sel; BITS chan; -BITS rel; -BITS neg; GLuint src; @@ -2711,8 +2706,6 @@ GLboolean check_scalar(r700_AssemblerBase* pAsm, { sel = src_sel [src]; chan = src_chan[src]; -rel = src_rel [src]; -neg = src_neg [src]; if (is_const( sel )) { @@ -2731,8 +2724,6 @@ GLboolean check_scalar(r700_AssemblerBase* pAsm, { sel = src_sel [src]; chan = src_chan[src]; -rel = src_rel [src]; -neg = src_neg [src]; if( is_gpr(sel) ) { @@ -2767,8 +2758,6 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, BITS sel; BITS chan; -BITS rel; -BITS neg; BITS src_sel [3] = {0,0,0}; BITS src_chan[3] = {0,0,0}; @@ -2809,8 +2798,6 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, { sel = src_sel [src]; chan = src_chan[src]; -rel = src_rel [src]; -neg = src_neg [src]; bank_swizzle =
Re: [Mesa-dev] [PATCH] glsl-fs-normalmatrix: New test program for gl_NormalMatrix.
Not sure this needs it, but LGTM. You might want to add yourself to the Authors comment, but *shrug*. -tom On 10/18/2011 06:33 PM, Eric Anholt wrote: From: tom fogaltfo...@sci.utah.edu v2: lots of hacking by anholt to make it look more like a normal piglit test and make all results visible at once. --- tests/all.tests |1 + tests/shaders/CMakeLists.gl.txt |1 + tests/shaders/glsl-fs-normalmatrix.c | 166 ++ 3 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 tests/shaders/glsl-fs-normalmatrix.c diff --git a/tests/all.tests b/tests/all.tests index 0248164..89bd03d 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -396,6 +396,7 @@ add_plain_test(shaders, 'glsl-fs-loop') add_plain_test(shaders, 'glsl-fs-loop-nested') add_plain_test(shaders, 'glsl-fs-mix') add_plain_test(shaders, 'glsl-fs-mix-constant') +add_concurrent_test(shaders, 'glsl-fs-normalmatrix') add_plain_test(shaders, 'glsl-fs-pointcoord') add_plain_test(shaders, 'glsl-fs-raytrace-bug27060') add_plain_test(shaders, 'glsl-fs-sampler-numbering') diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt index 3dce256..ed72b21 100644 --- a/tests/shaders/CMakeLists.gl.txt +++ b/tests/shaders/CMakeLists.gl.txt @@ -82,6 +82,7 @@ add_executable (glsl-fs-loop glsl-fs-loop.c) add_executable (glsl-fs-loop-nested glsl-fs-loop-nested.c) add_executable (glsl-fs-mix glsl-fs-mix.c) add_executable (glsl-fs-mix-constant glsl-fs-mix-constant.c) +add_executable (glsl-fs-normalmatrix glsl-fs-normalmatrix.c) IF (NOT MSVC) add_executable (glsl-fs-raytrace-bug27060 glsl-fs-raytrace-bug27060.c) ENDIF (NOT MSVC) diff --git a/tests/shaders/glsl-fs-normalmatrix.c b/tests/shaders/glsl-fs-normalmatrix.c new file mode 100644 index 000..b55a80a --- /dev/null +++ b/tests/shaders/glsl-fs-normalmatrix.c @@ -0,0 +1,166 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a + * 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, 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 above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Tom Fogal + * + */ + +/** @file glsl-fs-normalmatrix.c + * + * Tests gl_NormalMatrix for appropriate initial values. + */ + +#include piglit-util.h + +int piglit_width = 30, piglit_height = 30; +int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; + +static const char vert[] = { + void main()\n + {\n + gl_Position = ftransform();\n + }\n +}; + +/* Creates a fragment shader which colors everything green if + * gl_NormalMatrix[col].row + * is between 'low' and 'high', otherwise everything is red. + * The returned string is dynamically allocated and must be free'd by the + * caller. + */ +static char * +generate_fs(int row, int col) +{ + static const char *fs_template = + void main()\n + {\n + if (%f= gl_NormalMatrix[%u].%c\n + gl_NormalMatrix[%u].%c= %f)\n + gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n + else\n + gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);\n + }\n; + char *result; + char row_char = xyz[row]; + float expected_matrix[] = { + 1, 0, 0, + 0, 1, 0, + 0, 0, 1, + }; + float expected = expected_matrix[row * 3 + col]; + float low = expected - .01; + float high = expected + .01; + + if (0) { + printf(test: %g= gl_NormalMatrix[%u].%c= %g\n, + low, col, row_char, high); + } + + result = calloc(1, strlen(fs_template) + 100); + sprintf(result, fs_template, low, col, row_char, col, row_char, high); + + return result; +} + +static bool +test(int row, int col) +{ + GLint vs, fs, prog; + float green[] = {0.0, 1.0, 0.0, 0.0}; + char *fs_source; + bool pass; + int w = piglit_width / 3; + int h = piglit_height / 3; + int x = col *
Re: [Mesa-dev] r600g shader optimization
On Wed, 2011-10-19 at 10:49 -0400, Tom Stellard wrote: On Fri, 2011-10-07 at 10:14 -0400, Vadim Girlin wrote: Hi, Recently I've been working on the shader optimization for r600g, and now I have the initial working implementation of simple alu scheduler and register allocator. It has no piglit regressions, though it's still a work in progress and there are known issues with some applications. I've pushed the working branch to github: https://github.com/VadimGirlin/mesa/tree/r600_shader_opt Hi Vadim, What's the current status of this branch? Is there anything in there that is stable and ready to merge? I think it's not ready yet. I'm still working on the features such as barrier bit usage for parallel execution of the alu and fetch instructions. Experiments with some relatively simple algorithms for this doesn't show any benefits, so I'm thinking about rewriting the scheduler to use more complex approach. So far simple unification of the fetch instructions to minimize mixing of the different clause types (without using barrier bit for parallel execution) gives the best result for me (this is already implemented in my branch, though it might need still uncommitted patch to reduce register pressure in some cases). Also there are regressions with some applications. Currently I'm mostly working on the new features, but probably at least all known issues should be fixed before trying to merge it. And finally it will need the cleanup and coding style fixes. Vadim -Tom ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] i965: Fix incorrect dirty bit in gen6_prepare_wm_push_constants.
On Tue, 18 Oct 2011 17:05:28 -0700, Kenneth Graunke kenn...@whitecape.org wrote: We definitely want CACHE_NEW_WM_PROG, not CACHE_NEW_VS_PROG. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Kenneth Graunke kenn...@whitecape.org This series is Reviewed-by: Eric Anholt e...@anholt.net --- src/mesa/drivers/dri/i965/gen6_wm_state.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 00fadb9..370516d 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -49,7 +49,7 @@ gen6_prepare_wm_push_constants(struct brw_context *brw) /* XXX: Should this happen somewhere before to get our state flag set? */ _mesa_load_state_parameters(ctx, fp-program.Base.Parameters); - /* CACHE_NEW_VS_PROG */ + /* CACHE_NEW_WM_PROG */ if (brw-wm.prog_data-nr_params != 0) { float *constants; unsigned int i; @@ -85,7 +85,7 @@ const struct brw_tracked_state gen6_wm_constants = { .mesa = _NEW_PROGRAM_CONSTANTS, .brw = (BRW_NEW_BATCH | BRW_NEW_FRAGMENT_PROGRAM), - .cache = CACHE_NEW_VS_PROG, + .cache = CACHE_NEW_WM_PROG, }, .prepare = gen6_prepare_wm_push_constants, }; I think this first bug could have resulted in real problems if, for example, proj_attrib_mask but nothing else fragment program related changed between draw calls (since we'd end up with different computation in the shader, and thus different sets of live uniform components to be uploaded). Texture swizzles might do it, too. I'm having trouble coming up with a likely behavior in a non-testcase app to trigger it, but I don't want to think about the issue any more, so cherry-picking seems like a good idea. :) pgp9obRkCJ5uD.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Fix detection of whether an ARB_vp is enabled for two sided lighting.
When there is no ARB_vertex_program program enabled, the Current pointer points at a default program, so we were always using VERTEX_PROGRAM_TWO_SIDE, even for fixed function lighting. Fixes piglit two-sided-lighting* --- src/mesa/main/state.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 98ca733..80fd03b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -461,7 +461,7 @@ static void update_twoside(struct gl_context *ctx) { if (ctx-Shader.CurrentVertexProgram || - ctx-VertexProgram.Current) { + ctx-VertexProgram._Enabled) { ctx-VertexProgram._TwoSideEnabled = ctx-VertexProgram.TwoSideEnabled; } else { ctx-VertexProgram._TwoSideEnabled = (ctx-Light.Enabled -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 34401] glXGetScreenDriver doesn't report the same driver name as used in ~/.drirc
https://bugs.freedesktop.org/show_bug.cgi?id=34401 Michal Suchanek hramr...@gmail.com changed: What|Removed |Added CC||hramr...@gmail.com -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Fix detection of whether an ARB_vp is enabled for two sided lighting.
On 10/19/2011 10:49 AM, Eric Anholt wrote: When there is no ARB_vertex_program program enabled, the Current pointer points at a default program, so we were always using VERTEX_PROGRAM_TWO_SIDE, even for fixed function lighting. Fixes piglit two-sided-lighting* --- src/mesa/main/state.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 98ca733..80fd03b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -461,7 +461,7 @@ static void update_twoside(struct gl_context *ctx) { if (ctx-Shader.CurrentVertexProgram || - ctx-VertexProgram.Current) { + ctx-VertexProgram._Enabled) { ctx-VertexProgram._TwoSideEnabled = ctx-VertexProgram.TwoSideEnabled; } else { ctx-VertexProgram._TwoSideEnabled = (ctx-Light.Enabled Was this failing on i965 for you? The two-sided tests pass for me on my GM45 Express. In any case, Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/5] intel: Add function intel_renderbuffer_hiz_alloc
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/18/2011 03:51 PM, Eric Anholt wrote: On Mon, 17 Oct 2011 07:40:27 -0700, Chad Versace c...@chad-versace.us wrote: This function allocates the HiZ region and initializes the HiZ control state for a depthbuffer. It is wise to define the logic for HiZ region allocation in a single location, since when MSAA arrives that logic will become more complicated. Signed-off-by: Chad Versace c...@chad-versace.us --- src/mesa/drivers/dri/intel/intel_fbo.c | 21 + src/mesa/drivers/dri/intel/intel_fbo.h |8 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index b7cfdb9..17397e1 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -110,6 +110,27 @@ intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb) return NULL; } +bool +intel_renderbuffer_alloc_hiz(struct intel_context *intel, + struct intel_renderbuffer *depth_irb) +{ + struct intel_region *depth_region = depth_irb-region; + struct intel_hiz_control *hiz = depth_irb-region-hiz; + + hiz-region = intel_region_alloc(intel-intelScreen, +I915_TILING_Y, +depth_region-cpp, +depth_region-width, +depth_region-height, +GL_TRUE); + if (!hiz-region) + return false; + + hiz-need_resolve = INTEL_HIZ_NEED_NO_RESOLVE; + hiz-depth_format = depth_irb-Base.Format; + return true; +} The region is supposed to be a fraction of the depth region's height, right? Right. Width and height should be (rb-Width) and (ALIGN(rb-Height, 2) / 2). I'll add a comment too referring to the equation in the spec. Sometime soon I'll post a patch to fix this for DDX. - -- Chad Versace c...@chad-versace.us -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOnwt5AAoJEAIvNt057x8i9h0P/29UW59Gyi00ozND5oUi1/uK wP3mzX+KwQOAduq8BAIV7xpemrElU6IpqUTn9jpzC0LJF8vpM/XBeE4QEQWDo+4E cZlyuTzNMYerMR6xDOld8AQAxNaZVgattSJH5GleFxNIjBIFROzGDcKYIk3lV/pD 5yj1kMLROp0hyN2X/oZ/v/hNgzI0dqlgeGXGRcenN/U4aTQFUygt3iaT34wiVH/w 8T+5X3mFY3MBd4dBydLSVRk07DPu8zjqlXbU54KAeWjJykAka6D/ACphlF+epGBZ LBlrFaJPQX+ZUMHNApsFr+dd1bqKqx/lk9bCoOrCAEaa89tKj0UPAE0Wh5oGa/q6 AJuJFHqS8kI5YSDM7+154yvCsKw1IedLobP5732WqyV7xlpkl1hZaizgMOBtQgwN mXBj0/bVNHsYR22ZMglviZRjq4ed7wjUEHBJBh/bpRkxpElen9KeB7qp6ELsmlW7 Hidt/pKFMHaHCi4DdIsWkMXCN0X4UoBRirYaIPoPfqp60bhSMwCwh+Q/Im9emMiW +his968f6EJUGHh05GQpxwoaAKU9DzSqPO0YPQzU8GhYi/EYMvMXvA0UGrtllBmN T0ecU0r5fMxawhkRlg8JfWHw7vaYALzwSOwgxc/Rm4ZMVBY5D8tZrFyBZH3pL0py 7mCkxFETwhK6p3gO/KyB =rbhJ -END PGP SIGNATURE- ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/5] intel: Remove intel_renderbuffer::hiz_region
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/18/2011 03:57 PM, Eric Anholt wrote: On Mon, 17 Oct 2011 07:40:28 -0700, Chad Versace c...@chad-versace.us wrote: Replace it with intel_renderbuffer::region::hiz::region. Signed-off-by: Chad Versace c...@chad-versace.us --- src/mesa/drivers/dri/i965/brw_misc_state.c | 27 + src/mesa/drivers/dri/intel/intel_context.c | 10 -- src/mesa/drivers/dri/intel/intel_fbo.c | 36 +-- src/mesa/drivers/dri/intel/intel_fbo.h |3 -- src/mesa/drivers/dri/intel/intel_mipmap_tree.c |1 - src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 14 - 6 files changed, 29 insertions(+), 62 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 2e6780b..6b521e0 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -583,21 +574,10 @@ intel_update_tex_wrapper_regions(struct intel_context *intel, /* Allocate the texture's hiz region if necessary. */ if (intel-vtbl.is_hiz_depth_format(intel, rb-Format) -!intel_image-mt-hiz_region) { - intel_image-mt-hiz_region = - intel_region_alloc(intel-intelScreen, -I915_TILING_Y, -_mesa_get_format_bytes(rb-Format), -rb-Width, -rb-Height, -GL_TRUE); - if (!intel_image-mt-hiz_region) - return GL_FALSE; - } - - /* Point the renderbuffer's hiz region to the texture's hiz region. */ - if (irb-hiz_region != intel_image-mt-hiz_region) { - intel_region_reference(irb-hiz_region, intel_image-mt-hiz_region); +irb-region-hiz.region == NULL) { + bool ok = intel_renderbuffer_alloc_hiz(intel, irb); + if (!ok) + return false; } I think you're aware of this already, but just in case: The hiz region allocated here using the new rb_alloc_hiz looks like it will be based on the size of the whole texture miptree (since it looks up the region's size, not rb w/h), while all that should be needed is the maximum size of any texture image. I was aware of that, and chose to do that because it was compatible with my vague plan of handling miptrees. But... I think we could just use Width/Height, if we resolved at FinishRenderTexture time and freed the renderbuffer's hiz region (which I think would be reasonable for now, and should make mipmapped depth hiz pretty straightforward). I like that approach. It's much simpler than my original plan, and it shouldn't cause unnecessary resolves for apps that are written correctly. After rendering to a depth texture, the app, if sensible, will eventually sample from the texture. The depth resolve must happen eventually, so we might as well straightforwardly do it when detaching the texture. At first, I though this plan would cause problems when multiple images/layers/levels of the same texture object were attached to an FBO. But I no longer see a problem there. An FBO has only one depth attachment point, so each image would be attached to a different FBO, which ensures that FinishRenderTexture gets called each time we render to a new image/layer/level. - -- Chad Versace c...@chad-versace.us -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOnxMaAAoJEAIvNt057x8iqMAQAMEYYxdHOVykZ5OuGw/aD3w8 EcwI7wc1KLIMT3aZv7vNZ1h0m2E9a024l2UyG52Oz1hB1tJXyDepEmHYUDWTj91n dccV1c0D//pvir/oh6H48Ewh84/nBr4MGZs+mtWfAbw90FpDXX3i7IB37wnnwdSZ kaXhA8zD4RhdL/LSqLWgazWQ+s4k75L/6x9dMRD8uZtj6bHKfJs6kyP9PnFhzgjh wNF85BQ9xNUs6U2wCbF7Akja8dB6eIc5OQjC/HlyRmwH/pRJbSq2ip7SFAPdG33K +dZ3uNG0grovRgjxsDuSqwhBPdXlI7rF0VVbRZDke7oAAtxsJdtjV1VizyiuUOCB 5ayI/50OkPpvbAKR+gJN89DP+0UYk9O/vq9t8L19YQ5PuZIpfy+Gh5PeA0wleGeJ +3SCb7/QogDCM0i9pcS/NZaoIO/qe3Ond/HWo7x3DdeixUBMWqWETlUQ0R9B/ANT LrHF+0IQ+3yYC6XK3AoJC63SJKLP1XQBz9lUFk4ns/BNIU/eP2dFbYlskxjpOYBf vB40IWkZocDcKAOvEiXutU3Ori7MRDF6X4Jg+QvjM0zS1HrX50Vrql0KpJmzO27f b6Y4BLT6rXtNI3pw6vFk1071SZbFXZza22tf1B5m6y9XVdiOogkSjB3Or+YBUU8l T7N/ct8+to1QQA6r3VZa =YWg+ -END PGP SIGNATURE- ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: Fix gl_NormalMatrix swizzle setup to match i965's invariants.
On 18 October 2011 17:33, Eric Anholt e...@anholt.net wrote: A driver trying to set up builtin uniforms is faced with a problem: How do I walk the ir_variable structure (representing an array of structs, or array of matrices, or struct, or whatever), and set up driver structures so that dereference of that uniform gets the corresponding ParameterValues[] entry. The rule in general is that each corresponding vector-sized field of an array of structs is one builtin uniform state slot. i965 relied on another invariant: each state slot has a number of unique channel swizzles corresponding to the number of elements in the field's vector, to avoid needing to walk the glsl_type in parallel to get at vector_elements. Since only the i965 driver relies on this invariant, it would be easy for a mesa core developer to mess this up in the future and not notice. Can we add an assertion to ir_variable.cpp's add_uniform() function to verify the invariant? That would also serve as a nice place to document why the invariant is necessary. Either way, the patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] i965: silence signed/unsigned comparison warning
On 18 October 2011 18:07, Brian Paul brian.e.p...@gmail.com wrote: From: Brian Paul bri...@vmware.com --- src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index e003020..0ea6d31 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -1549,7 +1549,8 @@ vec4_visitor::try_rewrite_rhs_to_dst(ir_assignment *ir, * potentially reswizzle the operands of many instructions so that * we could handle out of order channels, but don't yet. */ - for (int i = 0; i 4; i++) { + + for (unsigned i = 0; i 4; i++) { if (dst.writemask (1 i)) { if (!(last_rhs_inst-dst.writemask (1 i))) return false; -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev Reviewed-by: Paul Berry stereotype...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] i965: use a cast to silence a signed/unsigned comparison warning
On 18 October 2011 18:07, Brian Paul brian.e.p...@gmail.com wrote: From: Brian Paul bri...@vmware.com --- .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp index 1ace91f..6de7682 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp @@ -217,7 +217,7 @@ vec4_visitor::reg_allocate() int reg = ra_get_node_reg(g, i); hw_reg_mapping[i] = first_assigned_grf + brw-vs.ra_reg_to_grf[reg]; - prog_data-total_grf = MAX2(prog_data-total_grf, + prog_data-total_grf = MAX2((int) prog_data-total_grf, hw_reg_mapping[i] + virtual_grf_sizes[i]); Since we're storing the result into an unsigned value, I'd prefer to fix the warning by converting the second argument of MAX2 to GLuint rather than converting the first argument of MAX2 to int. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] i965: use a cast to silence a signed/unsigned comparison warning
On 10/19/2011 01:53 PM, Paul Berry wrote: On 18 October 2011 18:07, Brian Paul brian.e.p...@gmail.com mailto:brian.e.p...@gmail.com wrote: From: Brian Paul bri...@vmware.com mailto:bri...@vmware.com --- .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp index 1ace91f..6de7682 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp @@ -217,7 +217,7 @@ vec4_visitor::reg_allocate() int reg = ra_get_node_reg(g, i); hw_reg_mapping[i] = first_assigned_grf + brw-vs.ra_reg_to_grf[reg]; - prog_data-total_grf = MAX2(prog_data-total_grf, + prog_data-total_grf = MAX2((int) prog_data-total_grf, hw_reg_mapping[i] + virtual_grf_sizes[i]); Since we're storing the result into an unsigned value, I'd prefer to fix the warning by converting the second argument of MAX2 to GLuint rather than converting the first argument of MAX2 to int. I was wondering which way that should go. The types in that expression are: GLuint total_grf; int hw_reg_mapping[]; can hw_reg_mapping[] values be negative? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl-fs-normalmatrix: New test program for gl_NormalMatrix.
On 18 October 2011 17:33, Eric Anholt e...@anholt.net wrote: From: tom fogal tfo...@sci.utah.edu v2: lots of hacking by anholt to make it look more like a normal piglit test and make all results visible at once. --- tests/all.tests |1 + tests/shaders/CMakeLists.gl.txt |1 + tests/shaders/glsl-fs-normalmatrix.c | 166 ++ 3 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 tests/shaders/glsl-fs-normalmatrix.c diff --git a/tests/all.tests b/tests/all.tests index 0248164..89bd03d 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -396,6 +396,7 @@ add_plain_test(shaders, 'glsl-fs-loop') add_plain_test(shaders, 'glsl-fs-loop-nested') add_plain_test(shaders, 'glsl-fs-mix') add_plain_test(shaders, 'glsl-fs-mix-constant') +add_concurrent_test(shaders, 'glsl-fs-normalmatrix') add_plain_test(shaders, 'glsl-fs-pointcoord') add_plain_test(shaders, 'glsl-fs-raytrace-bug27060') add_plain_test(shaders, 'glsl-fs-sampler-numbering') diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt index 3dce256..ed72b21 100644 --- a/tests/shaders/CMakeLists.gl.txt +++ b/tests/shaders/CMakeLists.gl.txt @@ -82,6 +82,7 @@ add_executable (glsl-fs-loop glsl-fs-loop.c) add_executable (glsl-fs-loop-nested glsl-fs-loop-nested.c) add_executable (glsl-fs-mix glsl-fs-mix.c) add_executable (glsl-fs-mix-constant glsl-fs-mix-constant.c) +add_executable (glsl-fs-normalmatrix glsl-fs-normalmatrix.c) IF (NOT MSVC) add_executable (glsl-fs-raytrace-bug27060 glsl-fs-raytrace-bug27060.c) ENDIF (NOT MSVC) diff --git a/tests/shaders/glsl-fs-normalmatrix.c b/tests/shaders/glsl-fs-normalmatrix.c new file mode 100644 index 000..b55a80a --- /dev/null +++ b/tests/shaders/glsl-fs-normalmatrix.c @@ -0,0 +1,166 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a + * 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, 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 above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Tom Fogal + * + */ + +/** @file glsl-fs-normalmatrix.c + * + * Tests gl_NormalMatrix for appropriate initial values. + */ + +#include piglit-util.h + +int piglit_width = 30, piglit_height = 30; +int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; + +static const char vert[] = { + void main()\n + {\n + gl_Position = ftransform();\n + }\n +}; + +/* Creates a fragment shader which colors everything green if + * gl_NormalMatrix[col].row + * is between 'low' and 'high', otherwise everything is red. + * The returned string is dynamically allocated and must be free'd by the + * caller. + */ +static char * +generate_fs(int row, int col) +{ + static const char *fs_template = + void main()\n + {\n + if (%f = gl_NormalMatrix[%u].%c \n + gl_NormalMatrix[%u].%c = %f)\n + gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n + else\n + gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);\n + }\n; I think it would be clearer to use uniforms rather than all of this string interpolation. If we did that, then if I'm not mistaken, this whole test could be converted into a shader_runner test.. + char *result; + char row_char = xyz[row]; + float expected_matrix[] = { + 1, 0, 0, + 0, 1, 0, + 0, 0, 1, + }; + float expected = expected_matrix[row * 3 + col]; + float low = expected - .01; + float high = expected + .01; + + if (0) { + printf(test: %g = gl_NormalMatrix[%u].%c = %g\n, + low, col, row_char, high); + } + + result = calloc(1, strlen(fs_template) + 100); + sprintf(result, fs_template, low, col, row_char, col, row_char, high); + + return result;
Re: [Mesa-dev] [PATCH 2/2] i965: use a cast to silence a signed/unsigned comparison warning
On 19 October 2011 12:58, Brian Paul bri...@vmware.com wrote: On 10/19/2011 01:53 PM, Paul Berry wrote: On 18 October 2011 18:07, Brian Paul brian.e.p...@gmail.com mailto:brian.e.p...@gmail.com** wrote: From: Brian Paul bri...@vmware.com mailto:bri...@vmware.com --- .../drivers/dri/i965/brw_vec4_**reg_allocate.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/**brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/**brw_vec4_reg_allocate.cpp index 1ace91f..6de7682 100644 --- a/src/mesa/drivers/dri/i965/**brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/**brw_vec4_reg_allocate.cpp @@ -217,7 +217,7 @@ vec4_visitor::reg_allocate() int reg = ra_get_node_reg(g, i); hw_reg_mapping[i] = first_assigned_grf + brw-vs.ra_reg_to_grf[reg]; - prog_data-total_grf = MAX2(prog_data-total_grf, + prog_data-total_grf = MAX2((int) prog_data-total_grf, hw_reg_mapping[i] + virtual_grf_sizes[i]); Since we're storing the result into an unsigned value, I'd prefer to fix the warning by converting the second argument of MAX2 to GLuint rather than converting the first argument of MAX2 to int. I was wondering which way that should go. The types in that expression are: GLuint total_grf; int hw_reg_mapping[]; can hw_reg_mapping[] values be negative? -Brian No, every element of hw_reg_mapping is a register number, and those go from zero up. It's possible that a better fix would be to make hw_reg_mapping[] and and virtual_grf_sizes[] unsigned, but that might have more cascading effects than you want to deal with. Eric, do you have an opinion? Aside: what compiler (and compiler options) are you using to see these warnings? I don't get them with GCC. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Only use gcc visibility support with gcc4+.
I had a colleague hitting issues compiling with an old gcc3.2 system. These patches got them through. --- include/GL/gl.h |2 +- src/mesa/main/compiler.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index 998a83a..e65e1bc 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -67,7 +67,7 @@ #elif defined(__CYGWIN__) defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall -#elif defined(__GNUC__)|| (defined(__SUNPRO_C) (__SUNPRO_C = 0x590)) +#elif (defined(__GNUC__) __GNUC__ = 4) || (defined(__SUNPRO_C) (__SUNPRO_C = 0x590)) # define GLAPI __attribute__((visibility(default))) # define GLAPIENTRY #endif /* WIN32 !CYGWIN */ diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 89d6cda9..921e302 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -150,7 +150,7 @@ extern C { * inline a static function that we later use in an alias. - ajax */ #ifndef PUBLIC -# if defined(__GNUC__) || (defined(__SUNPRO_C) (__SUNPRO_C = 0x590)) +# if (defined(__GNUC__) __GNUC__ = 4) || (defined(__SUNPRO_C) (__SUNPRO_C = 0x590)) #define PUBLIC __attribute__((visibility(default))) #define USED __attribute__((used)) # else -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium: implement WGL_ARB_create_context
--- src/gallium/state_trackers/wgl/SConscript |1 + src/gallium/state_trackers/wgl/stw_context.c | 39 ++-- .../state_trackers/wgl/stw_getprocaddress.c|3 ++ src/gallium/state_trackers/wgl/stw_icd.h |8 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 7cb953b..1014b45 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -22,6 +22,7 @@ if not env['gles']: sources = [ 'stw_context.c', 'stw_device.c', +'stw_ext_context.c', 'stw_ext_extensionsstring.c', 'stw_ext_gallium.c', 'stw_ext_pbuffer.c', diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index c2839fe..875d713 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -27,6 +27,11 @@ #include windows.h +#define WGL_WGLEXT_PROTOTYPES + +#include GL/gl.h +#include GL/wglext.h + #include pipe/p_compiler.h #include pipe/p_context.h #include pipe/p_state.h @@ -121,11 +126,23 @@ DrvCreateLayerContext( HDC hdc, INT iLayerPlane ) { + return DrvCreateContextAttribs(hdc, iLayerPlane, 0, 1, 0, 0, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB); +} + +DHGLRC APIENTRY +DrvCreateContextAttribs( + HDC hdc, + INT iLayerPlane, + DHGLRC hShareContext, + int majorVersion, int minorVersion, + int contextFlags, int profileMask) +{ int iPixelFormat; const struct stw_pixelformat_info *pfi; struct st_context_attribs attribs; struct stw_context *ctx = NULL; - + struct stw_context *shareCtx = NULL; + if(!stw_dev) return 0; @@ -137,7 +154,13 @@ DrvCreateLayerContext( return 0; pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); - + + if (hShareContext != 0) { + pipe_mutex_lock( stw_dev-ctx_mutex ); + shareCtx = stw_lookup_context_locked( hShareContext ); + pipe_mutex_unlock( stw_dev-ctx_mutex ); + } + ctx = CALLOC_STRUCT( stw_context ); if (ctx == NULL) goto no_ctx; @@ -148,9 +171,19 @@ DrvCreateLayerContext( memset(attribs, 0, sizeof(attribs)); attribs.profile = ST_PROFILE_DEFAULT; attribs.visual = pfi-stvis; + attribs.major = majorVersion; + attribs.minor = minorVersion; + if (contextFlags WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) + attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE; + if (contextFlags WGL_CONTEXT_DEBUG_BIT_ARB) + attribs.flags |= ST_CONTEXT_FLAG_DEBUG; + if (profileMask WGL_CONTEXT_CORE_PROFILE_BIT_ARB) + attribs.flags |= ST_CONTEXT_FLAG_CORE_PROFILE; + if (profileMask WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) + attribs.flags |= ST_CONTEXT_FLAG_COMPATIBLE_PROFILE; ctx-st = stw_dev-stapi-create_context(stw_dev-stapi, - stw_dev-smapi, attribs, NULL); + stw_dev-smapi, attribs, shareCtx ? shareCtx-st : NULL); if (ctx-st == NULL) goto no_st_ctx; diff --git a/src/gallium/state_trackers/wgl/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/stw_getprocaddress.c index b0aef94..a1df44c 100644 --- a/src/gallium/state_trackers/wgl/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/stw_getprocaddress.c @@ -73,6 +73,9 @@ static const struct stw_extension_entry stw_extension_entries[] = { STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ), STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ), + /* WGL_ARB_create_context */ + STW_EXTENSION_ENTRY( wglCreateContextAttribsARB ), + { NULL, NULL } }; diff --git a/src/gallium/state_trackers/wgl/stw_icd.h b/src/gallium/state_trackers/wgl/stw_icd.h index 02eb543..9ff8d7a 100644 --- a/src/gallium/state_trackers/wgl/stw_icd.h +++ b/src/gallium/state_trackers/wgl/stw_icd.h @@ -502,6 +502,14 @@ DrvCopyContext( UINT fuMask ); DHGLRC APIENTRY +DrvCreateContextAttribs( + HDC hdc, + INT iLayerPlane, + DHGLRC hShareContext, + int majorVersion, int minorVersion, + int contextFlags, int profileMask); + +DHGLRC APIENTRY DrvCreateLayerContext( HDC hdc, INT iLayerPlane ); -- 1.7.7.msysgit.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium: implement WGL_ARB_create_context
- Original Message - --- src/gallium/state_trackers/wgl/SConscript |1 + src/gallium/state_trackers/wgl/stw_context.c | 39 ++-- .../state_trackers/wgl/stw_getprocaddress.c|3 ++ src/gallium/state_trackers/wgl/stw_icd.h |8 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 7cb953b..1014b45 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -22,6 +22,7 @@ if not env['gles']: sources = [ 'stw_context.c', 'stw_device.c', +'stw_ext_context.c', The file stw_ext_context.c was not included in the patch. Please add it and resend. 'stw_ext_extensionsstring.c', 'stw_ext_gallium.c', 'stw_ext_pbuffer.c', diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index c2839fe..875d713 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -27,6 +27,11 @@ #include windows.h +#define WGL_WGLEXT_PROTOTYPES + +#include GL/gl.h +#include GL/wglext.h + #include pipe/p_compiler.h #include pipe/p_context.h #include pipe/p_state.h @@ -121,11 +126,23 @@ DrvCreateLayerContext( HDC hdc, INT iLayerPlane ) { + return DrvCreateContextAttribs(hdc, iLayerPlane, 0, 1, 0, 0, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB); +} + +DHGLRC APIENTRY +DrvCreateContextAttribs( + HDC hdc, + INT iLayerPlane, + DHGLRC hShareContext, + int majorVersion, int minorVersion, + int contextFlags, int profileMask) +{ The Drv* prefix is for entrypoints that are part of the ICD. But don't think that a DrvCreateContextAttribs has been defined by Microsoft as part of the ICD. If so, please use a different funtion name, e.g., stw_create_context_attribs, and declare in it stw_context.h, instead of stw_icd.h Jose ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Only use gcc visibility support with gcc4+.
On 10/19/11 13:44, Tom Fogal wrote: I had a colleague hitting issues compiling with an old gcc3.2 system. These patches got them through. --- include/GL/gl.h |2 +- src/mesa/main/compiler.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index 998a83a..e65e1bc 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -67,7 +67,7 @@ #elif defined(__CYGWIN__) defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall -#elif defined(__GNUC__)|| (defined(__SUNPRO_C) (__SUNPRO_C= 0x590)) +#elif (defined(__GNUC__) __GNUC__= 4) || (defined(__SUNPRO_C) (__SUNPRO_C= 0x590)) # define GLAPI __attribute__((visibility(default))) That seems to match what X.Org's X11/Xfuncproto.h does for gcc visibility attributes (the SUNPRO bits differ since Xorg supported visibility attributes there in versions before they added compatibility with the gcc style attributes): #if defined(__GNUC__) (__GNUC__ = 4) !defined(__CYGWIN__) # define _X_EXPORT __attribute__((visibility(default))) # define _X_HIDDEN __attribute__((visibility(hidden))) # define _X_INTERNAL__attribute__((visibility(internal))) #elif defined(__SUNPRO_C) (__SUNPRO_C = 0x550) # define _X_EXPORT __global # define _X_HIDDEN __hidden # define _X_INTERNAL__hidden #else /* not gcc = 4 and not Sun Studio = 8 */ # define _X_EXPORT # define _X_HIDDEN # define _X_INTERNAL #endif /* GNUC = 4 */ -- -Alan Coopersmith-alan.coopersm...@oracle.com Oracle Solaris Platform Engineering: X Window System ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4 v2] mesa/image: assert on bad format
NULL as an error indicator is meaningless, since it will return NULL on success anyway if the caller passes in zero as the image's address and asks to calculate the offset of the first pixel. For example, _mesa_validate_pbo_access() does this. This also matches the code in the non-GL_BITMAP codepath, which already has an assert like this. v2: Per Brian Paul's review, remove the function call entirely and tighten the assert to only accept the two formats compatible with GL_BITMAP. They always have one component per pixel. --- src/mesa/main/image.c | 20 +--- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ca5771c..af96107 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1093,17 +1093,17 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) * Pixel unpacking/packing parameters are observed according to \p packing. * * \param dimensions either 1, 2 or 3 to indicate dimensionality of image + * \param packing the pixelstore attributes * \param image starting address of image data * \param width the image width - * \param height theimage height - * \param format the pixel format - * \param type the pixel data type - * \param packing the pixelstore attributes + * \param height the image height + * \param format the pixel format (must be validated beforehand) + * \param type the pixel data type (must be validated beforehand) * \param img which image in the volume (0 for 1D or 2D images) * \param row row of pixel in the image (0 for 1D images) * \param column column of pixel in the image * - * \return address of pixel on success, or NULL on error. + * \return address of pixel. * * \sa gl_pixelstore_attrib. */ @@ -1147,15 +1147,13 @@ _mesa_image_address( GLuint dimensions, if (type == GL_BITMAP) { /* BITMAP data */ - GLint comp_per_pixel; /* components per pixel */ GLint bytes_per_row; GLint bytes_per_image; + /* components per pixel for color or stencil index: */ + const GLint comp_per_pixel = 1; - /* Compute number of components per pixel */ - comp_per_pixel = _mesa_components_in_format( format ); - if (comp_per_pixel 0) { - return NULL; - } + /* The pixel type and format should have been error checked earlier */ + assert(format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX); bytes_per_row = alignment * CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); -- 1.7.6.msysgit.0 0007-mesa-image-assert-on-bad-format.patch Description: Binary data ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4 v2] mesa, intel: use _mesa_image_offset() for PBOs
This avoids forming invalid pointers needlessly, which even if never dereferenced is undefined behavior. It also makes _mesa_validate_pbo_access() more comprehensible. --- v2: Now rebased on top of the recent commit 9024d8af0ae. src/mesa/drivers/dri/intel/intel_pixel_read.c |5 ++- src/mesa/main/pbo.c | 27 +--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 803d714..1107017 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -120,8 +120,9 @@ do_blit_readpixels(struct gl_context * ctx, 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, diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index 41ff2ff..28e1a2c 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -68,8 +68,8 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, GLsizei clientMemSize, const GLvoid *ptr) { - const GLvoid *start, *end, *offset; - const GLubyte *sizeAddr; /* buffer size, cast to a pointer */ + /* unsigned, to detect overflow/wrap-around */ + uintptr_t start, end, offset, size; /* If no PBO is bound, 'ptr' is a pointer to client memory containing 'clientMemSize' bytes. @@ -78,10 +78,10 @@ _mesa_validate_pbo_access(GLuint dimensions, */ if (!_mesa_is_bufferobj(pack-BufferObj)) { offset = 0; - sizeAddr = ((const GLubyte *) 0) + clientMemSize; + size = clientMemSize; } else { offset = ptr; - sizeAddr = ((const GLubyte *) 0) + pack-BufferObj-Size; + size = pack-BufferObj-Size; /* The ARB_pixel_buffer_object spec says: *INVALID_OPERATION is generated by ColorTable, ColorSubTable, *ConvolutionFilter2D, ConvolutionFilter1D, SeparableFilter2D, @@ -93,27 +93,30 @@ _mesa_validate_pbo_access(GLuint dimensions, *parameter. */ if (type != GL_BITMAP - ((GLintptr)offset % _mesa_sizeof_packed_type(type))) + (offset % _mesa_sizeof_packed_type(type))) return GL_FALSE; } - if (sizeAddr == 0) + if (size == 0) /* no buffer! */ return GL_FALSE; /* get the offset to the first pixel we'll read/write */ - start = _mesa_image_address(dimensions, pack, offset, width, height, - format, type, 0, 0, 0); + start = _mesa_image_offset(dimensions, pack, width, height, + format, type, 0, 0, 0); /* get the offset to just past the last pixel we'll read/write */ - end = _mesa_image_address(dimensions, pack, offset, width, height, - format, type, depth-1, height-1, width); + end = _mesa_image_offset(dimensions, pack, width, height, + format, type, depth-1, height-1, width); - if ((const GLubyte *) start sizeAddr) { + start += offset; + end += offset; + + if (start size) { /* This will catch negative values / wrap-around */ return GL_FALSE; } - if ((const GLubyte *) end sizeAddr) { + if (end size) { /* Image read/write goes beyond end of buffer */ return GL_FALSE; } -- 1.7.6.msysgit.0 0010-mesa-intel-use-_mesa_image_offset-for-PBOs.patch Description: Binary data ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4 dri] st/dri: factor out software texbuffer code
--- src/gallium/state_trackers/dri/sw/dri_drawable.c | 72 -- 1 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/gallium/state_trackers/dri/sw/dri_drawable.c b/src/gallium/state_trackers/dri/sw/dri_drawable.c index 05c64b6..66997fb 100644 --- a/src/gallium/state_trackers/dri/sw/dri_drawable.c +++ b/src/gallium/state_trackers/dri/sw/dri_drawable.c @@ -187,6 +187,44 @@ dri_drawable_validate_att(struct dri_drawable *drawable, drawable-base.validate(drawable-base, statts, count, NULL); } +static void +drisw_copy_drawable(struct dri_context *ctx, __DRIdrawable *dPriv, +struct pipe_resource *res) +{ + struct st_context *stctx = (struct st_context *)ctx-st; + struct pipe_context *pipe = stctx-pipe; + struct pipe_transfer *tex_xfer; + char *map; + __DRIscreen *sPriv = dPriv-driScreenPriv; + int x, y, w, h, line, ximage_stride; + + sPriv-swrast_loader-getDrawableInfo(dPriv, x, y, w, h, + dPriv-loaderPrivate); + + tex_xfer = pipe_get_transfer(pipe, res, +0, 0,/* level, layer */ +PIPE_TRANSFER_WRITE, +x, y, +w, h); + + map = pipe_transfer_map(pipe, tex_xfer); + + /* Copy the Drawable content to the mapped texture buffer */ + sPriv-swrast_loader-getImage(dPriv, x, y, w, h, map, + dPriv-loaderPrivate); + + /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. + We assume 32 bit pixels. */ + ximage_stride = w * 4; + for (line = h-1; line; --line) { + memmove(map[line * tex_xfer-stride], + map[line * ximage_stride], ximage_stride); + } + + pipe_transfer_unmap(pipe, tex_xfer); + pipe_transfer_destroy(pipe, tex_xfer); +} + /** * These are used for GLX_EXT_texture_from_pixmap */ @@ -197,15 +235,7 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, struct dri_context *ctx = dri_context(pDRICtx); struct dri_drawable *drawable = dri_drawable(dPriv); struct pipe_resource *res; - struct st_context *stctx = (struct st_context *)ctx-st; - struct pipe_context *pipe = stctx-pipe; - struct pipe_transfer *tex_xfer; - char *map; - __DRIscreen *sPriv = dPriv-driScreenPriv; - int x, y, w, h, line, ximage_stride; - sPriv-swrast_loader-getDrawableInfo(dPriv, x, y, w, h, dPriv-loaderPrivate); - dri_drawable_validate_att(drawable, ST_ATTACHMENT_FRONT_LEFT); /* Use the pipe resource associated with the X drawable */ @@ -228,30 +258,8 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, } } - - tex_xfer = pipe_get_transfer(pipe, res, -0, 0,// level, layer -PIPE_TRANSFER_WRITE, -x, y, -w, h); - - - map = pipe_transfer_map(pipe, tex_xfer); - - /* Copy the Drawable content to the mapped texture buffer */ - sPriv-swrast_loader-getImage(dPriv, x, y, w, h, map, - dPriv-loaderPrivate); - - /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. - We assume 32 bit pixels. */ - ximage_stride = w * 4; - for (line = h-1; line; --line) { - memmove(map[line * tex_xfer-stride], map[line * ximage_stride], ximage_stride); - } - - pipe_transfer_unmap(pipe, tex_xfer); - - pipe_transfer_destroy(pipe, tex_xfer); + /* needed only for drisw: */ + drisw_copy_drawable(ctx, dPriv, res); ctx-st-teximage(ctx-st, (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT, -- 1.7.6.msysgit.0 0002-st-dri-factor-out-software-texbuffer-code.patch Description: Binary data ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4 dri] st/dri: add copy_drawable() callback
This moves drisw-specific code into drisw.c, making it possible to eliminate the extra copy of dri_drawable.c. --- .../state_trackers/dri/common/dri_context.h|4 ++ src/gallium/state_trackers/dri/drm/dri2.c | 26 +- src/gallium/state_trackers/dri/sw/dri_drawable.c | 42 +--- src/gallium/state_trackers/dri/sw/drisw.c | 55 +++- 4 files changed, 84 insertions(+), 43 deletions(-) diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h index cfc8e33..e2738d2 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.h +++ b/src/gallium/state_trackers/dri/common/dri_context.h @@ -64,6 +64,10 @@ struct dri_context struct st_context_iface *st; struct pp_queue_t *pp; unsigned int pp_enabled[PP_FILTERS]; + + /* copy the contents of the __DRIdrawable to the pipe_resource: */ + void (*copy_drawable)(struct dri_context *, __DRIdrawable *, + struct pipe_resource *); }; static INLINE struct dri_context * diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index f3c9e10..20a230c 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -711,6 +711,30 @@ dri2_create_buffer(__DRIscreen * sPriv, return TRUE; } +static void +dri2_copy_drawable(struct dri_context *ctx, __DRIdrawable *dPriv, + struct pipe_resource *res) +{ + /* no-op */ + (void)ctx; + (void)dPriv; + (void)res; +} + +static GLboolean +dri2_create_context(gl_api api, const struct gl_config * visual, +__DRIcontext * cPriv, void *sharedContextPrivate) +{ + struct dri_context *ctx; + + if (!dri_create_context(api, visual, cPriv, sharedContextPrivate)) + return FALSE; + + ctx = dri_context(cPriv); + ctx-copy_drawable = dri2_copy_drawable; + return TRUE; +} + /** * DRI driver virtual function table. * @@ -720,7 +744,7 @@ const struct __DriverAPIRec driDriverAPI = { .InitScreen = NULL, .InitScreen2 = dri2_init_screen, .DestroyScreen = dri_destroy_screen, - .CreateContext = dri_create_context, + .CreateContext = dri2_create_context, .DestroyContext = dri_destroy_context, .CreateBuffer = dri2_create_buffer, .DestroyBuffer = dri_destroy_buffer, diff --git a/src/gallium/state_trackers/dri/sw/dri_drawable.c b/src/gallium/state_trackers/dri/sw/dri_drawable.c index 66997fb..41e2a8d 100644 --- a/src/gallium/state_trackers/dri/sw/dri_drawable.c +++ b/src/gallium/state_trackers/dri/sw/dri_drawable.c @@ -38,7 +38,6 @@ #include util/u_memory.h #include util/u_inlines.h -#include state_tracker/st_context.h static boolean dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, @@ -187,44 +186,6 @@ dri_drawable_validate_att(struct dri_drawable *drawable, drawable-base.validate(drawable-base, statts, count, NULL); } -static void -drisw_copy_drawable(struct dri_context *ctx, __DRIdrawable *dPriv, -struct pipe_resource *res) -{ - struct st_context *stctx = (struct st_context *)ctx-st; - struct pipe_context *pipe = stctx-pipe; - struct pipe_transfer *tex_xfer; - char *map; - __DRIscreen *sPriv = dPriv-driScreenPriv; - int x, y, w, h, line, ximage_stride; - - sPriv-swrast_loader-getDrawableInfo(dPriv, x, y, w, h, - dPriv-loaderPrivate); - - tex_xfer = pipe_get_transfer(pipe, res, -0, 0,/* level, layer */ -PIPE_TRANSFER_WRITE, -x, y, -w, h); - - map = pipe_transfer_map(pipe, tex_xfer); - - /* Copy the Drawable content to the mapped texture buffer */ - sPriv-swrast_loader-getImage(dPriv, x, y, w, h, map, - dPriv-loaderPrivate); - - /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. - We assume 32 bit pixels. */ - ximage_stride = w * 4; - for (line = h-1; line; --line) { - memmove(map[line * tex_xfer-stride], - map[line * ximage_stride], ximage_stride); - } - - pipe_transfer_unmap(pipe, tex_xfer); - pipe_transfer_destroy(pipe, tex_xfer); -} - /** * These are used for GLX_EXT_texture_from_pixmap */ @@ -258,8 +219,7 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, } } - /* needed only for drisw: */ - drisw_copy_drawable(ctx, dPriv, res); + ctx-copy_drawable(ctx, dPriv, res); ctx-st-teximage(ctx-st, (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT, diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 082df55..7d45b00 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -39,6 +39,7 @@ #include util/u_inlines.h #include
[Mesa-dev] [PATCH 3/4 dri] st/dri: sync the sw/ changes to dri_drawable.c
The sw copy needs to go away. It's already missing several new patches to the original. --- .../state_trackers/dri/common/dri_drawable.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index 340404e..7cf7219 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -203,14 +203,15 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, { struct dri_context *ctx = dri_context(pDRICtx); struct dri_drawable *drawable = dri_drawable(dPriv); - struct pipe_resource *pt; + struct pipe_resource *res; dri_drawable_validate_att(drawable, ST_ATTACHMENT_FRONT_LEFT); - pt = drawable-textures[ST_ATTACHMENT_FRONT_LEFT]; + /* Use the pipe resource associated with the X drawable */ + res = drawable-textures[ST_ATTACHMENT_FRONT_LEFT]; - if (pt) { - enum pipe_format internal_format = pt-format; + if (res) { + enum pipe_format internal_format = res-format; if (format == __DRI_TEXTURE_FORMAT_RGB) { /* only need to cover the formats recognized by dri_fill_st_visual */ @@ -226,9 +227,11 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, } } + ctx-copy_drawable(ctx, dPriv, res); + ctx-st-teximage(ctx-st, (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT, -0, internal_format, pt, FALSE); +0, internal_format, res, FALSE); } } -- 1.7.6.msysgit.0 0004-st-dri-sync-the-sw-changes-to-dri_drawable.c.patch Description: Binary data ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4 dri] Revert Duplicate state_tracker/dri/sw/dri_drawable.c
This reverts commit 569bde1fa7d03fb7688d0d391b32e61e857ad44e. --- src/gallium/state_trackers/dri/sw/dri_drawable.c | 274 +- 1 files changed, 1 insertions(+), 273 deletions(-) mode change 100644 = 12 src/gallium/state_trackers/dri/sw/dri_drawable.c diff --git a/src/gallium/state_trackers/dri/sw/dri_drawable.c b/src/gallium/state_trackers/dri/sw/dri_drawable.c deleted file mode 100644 index 41e2a8d..000 --- a/src/gallium/state_trackers/dri/sw/dri_drawable.c +++ /dev/null @@ -1,273 +0,0 @@ -/** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * 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 - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * 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 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. - * - **/ -/* - * Author: Keith Whitwell kei...@vmware.com - * Author: Jakob Bornecrantz wallbra...@gmail.com - */ - -#include dri_screen.h -#include dri_context.h -#include dri_drawable.h - -#include pipe/p_screen.h -#include util/u_format.h -#include util/u_memory.h -#include util/u_inlines.h - - -static boolean -dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, -const enum st_attachment_type *statts, -unsigned count, -struct pipe_resource **out) -{ - struct dri_drawable *drawable = - (struct dri_drawable *) stfbi-st_manager_private; - struct dri_screen *screen = dri_screen(drawable-sPriv); - unsigned statt_mask, new_mask; - boolean new_stamp; - int i; - - statt_mask = 0x0; - for (i = 0; i count; i++) - statt_mask |= (1 statts[i]); - - /* record newly allocated textures */ - new_mask = (statt_mask ~drawable-texture_mask); - - /* -* dPriv-pStamp is the server stamp. It should be accessed with a lock, at -* least for DRI1. dPriv-lastStamp is the client stamp. It has the value -* of the server stamp when last checked. -*/ - new_stamp = (drawable-texture_stamp != drawable-dPriv-lastStamp); - - if (new_stamp || new_mask || screen-broken_invalidate) { - if (new_stamp drawable-update_drawable_info) - drawable-update_drawable_info(drawable); - - drawable-allocate_textures(drawable, statts, count); - - /* add existing textures */ - for (i = 0; i ST_ATTACHMENT_COUNT; i++) { - if (drawable-textures[i]) -statt_mask |= (1 i); - } - - drawable-texture_stamp = drawable-dPriv-lastStamp; - drawable-texture_mask = statt_mask; - } - - if (!out) - return TRUE; - - for (i = 0; i count; i++) { - out[i] = NULL; - pipe_resource_reference(out[i], drawable-textures[statts[i]]); - } - - return TRUE; -} - -static boolean -dri_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi, - enum st_attachment_type statt) -{ - struct dri_drawable *drawable = - (struct dri_drawable *) stfbi-st_manager_private; - - /* XXX remove this and just set the correct one on the framebuffer */ - drawable-flush_frontbuffer(drawable, statt); - - return TRUE; -} - -/** - * This is called when we need to set up GL rendering to a new X window. - */ -boolean -dri_create_buffer(__DRIscreen * sPriv, - __DRIdrawable * dPriv, - const struct gl_config * visual, boolean isPixmap) -{ - struct dri_screen *screen = sPriv-private; - struct dri_drawable *drawable = NULL; - - if (isPixmap) - goto fail; /* not implemented */ - - drawable = CALLOC_STRUCT(dri_drawable); - if (drawable == NULL) - goto fail; - - dri_fill_st_visual(drawable-stvis, screen, visual); - - /* setup the st_framebuffer_iface */ - drawable-base.visual = drawable-stvis; - drawable-base.flush_front = dri_st_framebuffer_flush_front; - drawable-base.validate = dri_st_framebuffer_validate; -
Re: [Mesa-dev] [PATCH 2/2] i965: use a cast to silence a signed/unsigned comparison warning
On 10/19/2011 02:24 PM, Paul Berry wrote: On 19 October 2011 12:58, Brian Paul bri...@vmware.com mailto:bri...@vmware.com wrote: On 10/19/2011 01:53 PM, Paul Berry wrote: On 18 October 2011 18:07, Brian Paul brian.e.p...@gmail.com mailto:brian.e.p...@gmail.com mailto:brian.e.p...@gmail.com mailto:brian.e.p...@gmail.com__ wrote: From: Brian Paul bri...@vmware.com mailto:bri...@vmware.com mailto:bri...@vmware.com mailto:bri...@vmware.com --- .../drivers/dri/i965/brw_vec4___reg_allocate.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/__brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/__brw_vec4_reg_allocate.cpp index 1ace91f..6de7682 100644 --- a/src/mesa/drivers/dri/i965/__brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/__brw_vec4_reg_allocate.cpp @@ -217,7 +217,7 @@ vec4_visitor::reg_allocate() int reg = ra_get_node_reg(g, i); hw_reg_mapping[i] = first_assigned_grf + brw-vs.ra_reg_to_grf[reg]; - prog_data-total_grf = MAX2(prog_data-total_grf, + prog_data-total_grf = MAX2((int) prog_data-total_grf, hw_reg_mapping[i] + virtual_grf_sizes[i]); Since we're storing the result into an unsigned value, I'd prefer to fix the warning by converting the second argument of MAX2 to GLuint rather than converting the first argument of MAX2 to int. I was wondering which way that should go. The types in that expression are: GLuint total_grf; int hw_reg_mapping[]; can hw_reg_mapping[] values be negative? -Brian No, every element of hw_reg_mapping is a register number, and those go from zero up. It's possible that a better fix would be to make hw_reg_mapping[] and and virtual_grf_sizes[] unsigned, but that might have more cascading effects than you want to deal with. Eric, do you have an opinion? Aside: what compiler (and compiler options) are you using to see these warnings? I don't get them with GCC. I built with 'make linux-dri-debug'. It uses -Wall but I don't think the autoconf method sets that flag. gcc -c -I. -Iserver -I../../../../../include -I../../../../../src/egl/drivers/dri -I../../../../../src/egl/main -I../../../../../src/mapi -I../../../../../src/mesa -I../../../../../src/mesa/drivers/dri/common -I/usr/local/include -I/usr/local/include/libdrm -I/usr/local/include -I/usr/local/include/libdrm -Wall -O0 -g -fPIC -DDEBUG -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN -fno-strict-aliasing -I../../../../../src -I../../../../../src/mesa/drivers/dri/intel brw_vec4_reg_allocate.cpp -o brw_vec4_reg_allocate.o brw_vec4_reg_allocate.cpp: In member function ‘void brw::vec4_visitor::reg_allocate()’: brw_vec4_reg_allocate.cpp:220: warning: comparison between signed and unsigned integer expressions I general, I like to enable as many warnings as practical to catch things that might be errors w/ other compilers (like MSVC). I used to use -ansi -pedantic too. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Fix detection of whether an ARB_vp is enabled for two sided lighting.
On Wed, 19 Oct 2011 11:28:42 -0600, Brian Paul bri...@vmware.com wrote: On 10/19/2011 10:49 AM, Eric Anholt wrote: When there is no ARB_vertex_program program enabled, the Current pointer points at a default program, so we were always using VERTEX_PROGRAM_TWO_SIDE, even for fixed function lighting. Fixes piglit two-sided-lighting* --- src/mesa/main/state.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 98ca733..80fd03b 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -461,7 +461,7 @@ static void update_twoside(struct gl_context *ctx) { if (ctx-Shader.CurrentVertexProgram || - ctx-VertexProgram.Current) { + ctx-VertexProgram._Enabled) { ctx-VertexProgram._TwoSideEnabled = ctx-VertexProgram.TwoSideEnabled; } else { ctx-VertexProgram._TwoSideEnabled = (ctx-Light.Enabled Was this failing on i965 for you? The two-sided tests pass for me on my GM45 Express. In any case, Reviewed-by: Brian Paul bri...@vmware.com They pass for you because I never fixed pre-gen6 to respect VERTEX_PROGRAM_TWO_SIDE using this flag :) pgpRKY2qKVOvU.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4 v2] mesa/image: assert on bad format
On Wed, Oct 19, 2011 at 6:10 PM, nobled nob...@dreamwidth.org wrote: NULL as an error indicator is meaningless, since it will return NULL on success anyway if the caller passes in zero as the image's address and asks to calculate the offset of the first pixel. For example, _mesa_validate_pbo_access() does this. This also matches the code in the non-GL_BITMAP codepath, which already has an assert like this. v2: Per Brian Paul's review, remove the function call entirely and tighten the assert to only accept the two formats compatible with GL_BITMAP. They always have one component per pixel. Looks good, thanks! Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4 v2] mesa, intel: use _mesa_image_offset() for PBOs
On Wed, Oct 19, 2011 at 6:13 PM, nobled nob...@dreamwidth.org wrote: This avoids forming invalid pointers needlessly, which even if never dereferenced is undefined behavior. It also makes _mesa_validate_pbo_access() more comprehensible. --- v2: Now rebased on top of the recent commit 9024d8af0ae. Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] Add solaris detection for PIPE_ARCH_LITTLE_ENDIAN/PIPE_ARCH_BIG_ENDIAN
Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- src/gallium/include/pipe/p_config.h |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index b3a7b33..7cd42c6 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -129,6 +129,15 @@ # define PIPE_ARCH_BIG_ENDIAN #endif +#elif defined(__sun) +#include sys/isa_defs.h + +#if defined(_LITTLE_ENDIAN) +# define PIPE_ARCH_LITTLE_ENDIAN +#elif defined(_BIG_ENDIAN) +# define PIPE_ARCH_BIG_ENDIAN +#endif + #else #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) -- 1.7.3.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] i965: Avoid generating MOVs for most ir_assignment handling.
On Sat, Aug 27, 2011 at 03:23, Kenneth Graunke kenn...@whitecape.org wrote: This is a port of vec4_visitor::try_rewrite_rhs_to_dst to fs_visitor. Not only is this technique less invasive and more robust, it also generates better code. Over and above the previous technique, this reduced instruction count in shader-db: With all FS optimizations (register coalescing and such) disabled, this reduced instruction count by 6.23% on average and 36% in the best case. With optimizations left enabled, it still reduced instruction count by 0.28% on average and 1.4% in the best case. In no case did this technique result in more code than the prior method. Hi, This regresses yuv tests in glbench here. The shaders regressing are the .glslf files there, and glbench can be found in the same repo: http://git.chromium.org/gitweb/?p=chromiumos/third_party/autotest.git;a=tree;f=client/deps/glbench/src;h=8c533f2d21e87c143f512f693947d7a660c2b4bc;hb=HEAD Stéphane ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev