aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pbo.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa/pbo: Handle zero width, height or depth when validating accessNeil Roberts2015-09-031-0/+6
| | | | | | | | | | | | | | | It's legal to call glTexSubImage with zero values for the width, height or depth. Previously this was breaking the PBO access validation because it tries to work out the last pixel accessed by getting the pixel at height-1 and depth-1 which would end up with bogus values. This was causing GL errors to be generated during the Piglit texsubimage test, although the test was passing anyway. v2: Also check for width == 0. Don't validate the start pointer if any of the dimensions are zero. Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: Separate PBO validation checks from buffer mapping, to allow reuseEduardo Lima Mitev2015-03-131-31/+86
| | | | | | | | | | | Internal PBO functions such as _mesa_map_validate_pbo_source() and _mesa_validate_pbo_compressed_teximage() perform validation and buffer mapping within the same call. This patch takes out the validation into separate functions to allow reuse of functionality by other code (i.e, gl(Compressed)Tex(Sub)Image). Reviewed-by: Laura Ekstrand <[email protected]>
* mesa: Set the correct image size in _mesa_validate_pbo_access()Eduardo Lima Mitev2015-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _mesa_validate_pbo_access() provides a generic way to check that a requested pixel transfer operation on a PBO falls within the boundaries of the buffer. It is used in various other places, and depending on the caller, some arguments are used or not. In particular, the 'clientMemSize' argument is used only by calls that are knowledgeable of the total size of the user data involved in a pixel transfer, such as the case of compressed texture image calls. Other calls don't provide 'clientMemSize' directly since it is made implicit from the size and format of the texture, and its data type. In these cases, a sufficiently big value is passed to 'clientMemSize' (INT_MAX) to avoid an incorrect constrain. The problem is that _mesa_validate_pbo_access() use uint pointers to make the calculations, which are 64 bits long in 64 bits platforms, meanwhile the dummy INT_MAX passed in 'clientMemSize' is just 32 bits. This causes a constrain that is not desired. This patch fixes that by checking that if 'clientMemSize' is MAX_INT, then UINTPTR_MAX is assumed instead. This is an ugly workaround to the fact that _mesa_validate_pbo_access() intends to be a one function fits all. The clean solution here would be to break it into different functions that provide the adequate API for each of the possible code paths and validation needs. Since there are callers relying on passing INT_MAX to 'clientMemSize', this patch is necessary to deal with the problem above while a cleaner implementation of the PBO API is not implemented. Reviewed-by: Laura Ekstrand <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-4/+4
| | | | Acked-by: Eric Anholt <[email protected]>
* mesa: allow buffers to be mapped multiple timesMarek Olšák2014-02-251-7/+11
| | | | | | | | | | | | | | | | | | | OpenGL allows a buffer to be mapped only once, but we also map buffers internally, e.g. in the software primitive restart fallback, for PBOs, vbo_get_minmax_index, etc. This has always been a problem, but it will be a bigger problem with persistent buffer mappings, which will prevent all Mesa functions from mapping buffers for internal purposes. This adds a driver interface to core Mesa which supports multiple buffer mappings and allows 2 mappings: one for the GL user and one for Mesa. Note that Gallium supports an unlimited number of buffer and texture mappings, so it's not really an issue for Gallium. v2: fix unmapping in xm_dd.c, remove the GL errors there v3: fix the intel driver (by Fredrik) Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: allow buffers mapped with the persistent flag to be used by the GPUMarek Olšák2014-02-251-2/+2
| | | | | | v2: also fixed InvalidateBufferData, added citations from the 4.4 spec Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <[email protected]>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | This brings the license text in line with the MIT License as published on the Open Source Initiative website: http://opensource.org/licenses/mit-license.php Generated automatically be the following shell command: $ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {} This introduces some wrapping issues, to be fixed in the next commit. Reviewed-by: Brian Paul <[email protected]>
* mesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_,}teximage.Paul Berry2013-01-021-5/+10
| | | | | | | | | | | The old error reporting was completely bogus, passing _mesa_error() a format string that didn't even match the remaining arguments. Also, in many cases the number of dimensions in the TexImage call was not preserved in the error message (e.g. an error in glTexImage2D was reported simply as an error in glTexImage). Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa: move more format helper functions to glformats.cBrian Paul2012-07-241-0/+1
|
* mesa: whitespace fixes in pbo.cBrian Paul2012-07-201-14/+14
|
* mesa,intel: use _mesa_image_offset() for PBOsnobled2011-12-081-13/+16
| | | | | | | | 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 <[email protected]>
* mesa: generate error if pbo offset is not aligned with the size of specified ↵Yuanhan Liu2011-10-191-0/+13
| | | | | | | | | | | | | | | | type v2: quote the spec; explicitly exclude the GL_BITMAP case to make code more readable. (comments from Ian) v3: Cast the offset by GLintptr to remove the compile warning(comments from Brian). I also found that I should use _mesa_sizeof_packed_type() instead, as it includes packed pixel type, like GL_UNSIGNED_SHORT_5_6_5. Signed-off-by: Yuanhan Liu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Eliminate dd_function_table::MapBufferIan Romanick2011-08-231-9/+15
| | | | | | | | | | Replace all calls to dd_function_table::MapBuffer with appropriate calls to dd_function_table::MapBufferRange, then remove all the cruft. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Remove target parameter from dd_function_table::MapBufferIan Romanick2011-08-231-6/+5
| | | | | | | | | | No driver used that parameter, and most drivers ended up with a bunch of unused-parameter warnings because it was there. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Remove target parameter from dd_function_table::UnmapBufferIan Romanick2011-08-231-5/+3
| | | | | | | | | | No driver used that parameter, and most drivers ended up with a bunch of unused-parameter warnings because it was there. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* Squashed commit of the following:Brian Paul2011-04-261-44/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 864fe253b04105b7469e5f7b064dc37637b944f8 Author: Brian Paul <[email protected]> Date: Thu Apr 21 20:13:07 2011 -0600 mesa: s/exec/disp/ in _mesa_init_histogram_dispatch() This function isn't normally compiled (FEATURE_histogram). commit f4bf45e2b94b582cacd19cdca873c5be627e4250 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:58 2011 -0600 mesa: hook up GL_ARB_robustness dispatch functions ...and advertise the extension. Signed-off-by: Brian Paul <[email protected]> commit 2b89e38e5f572dc40cebc06381ae7c5d04386998 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:58 2011 -0600 mesa: regenerated API files for GL_ARB_robustness Signed-off-by: Brian Paul <[email protected]> commit 5d5ebfb7135cec9d833adef86cbf4d0f3d9beca8 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 glapi: add ARB_robustness xml Signed-off-by: Brian Paul <[email protected]> commit 0159d1d6d99f4bbc18381dc2081c20d3aff17ac9 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: implement GL_ARB_robustness functions Signed-off-by: Brian Paul <[email protected]> commit 938fd71f4c4742f274922d53492a7290ab8d9c9b Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: add context fields for GL_ARB_robustness Signed-off-by: Brian Paul <[email protected]> commit 72075137bc79e65be03dac7e97b6dba93c3a86a4 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: standardize more bounds-checking error messages Signed-off-by: Brian Paul <[email protected]> commit 32a3fc23746db49da903fbc08afa0135af3007d2 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: standardize some bounds-checking error messages Signed-off-by: Brian Paul <[email protected]> commit cecbf1f4d164207de373dec0cadee2e84e1f9656 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: add more bounds-checking support for client memory buffers Signed-off-by: Brian Paul <[email protected]> commit edc895b52383d5bd274422db56adead1d81daf5f Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: add bounds-checking support for client memory buffers Signed-off-by: Brian Paul <[email protected]> commit 3a96ef28a538f158a219b406cd090dee70470c85 Author: nobled <[email protected]> Date: Thu Apr 21 07:53:57 2011 -0600 mesa: use is_bufferobj() helper function Signed-off-by: Brian Paul <[email protected]>
* mesa: minor whitespace fixesBrian Paul2011-03-241-2/+2
|
* mesa: move PBO-related functions into a new fileBrian Paul2011-02-281-0/+372