diff options
author | Brian Paul <brianp@vmware.com> | 2011-02-11 11:56:44 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2011-02-11 11:56:45 -0700 |
commit | da2e541218d65c8931f0061fc4badd8fdedfcb83 (patch) | |
tree | 9d2373c24f49d06dba281534bc17ca571e76feaa /src/gallium/drivers/svga/svga_resource_buffer_upload.c | |
parent | 8c617990519a113886fe743b5932525b0cb37544 (diff) | |
download | external_mesa3d-da2e541218d65c8931f0061fc4badd8fdedfcb83.zip external_mesa3d-da2e541218d65c8931f0061fc4badd8fdedfcb83.tar.gz external_mesa3d-da2e541218d65c8931f0061fc4badd8fdedfcb83.tar.bz2 |
svga: add max DMA size check in svga_winsys_buffer_create()
This fixes a problem when trying to use large (2K x 2K) texture
images. We'll DMA the image in chunks.
Patch written by Jose.
Diffstat (limited to 'src/gallium/drivers/svga/svga_resource_buffer_upload.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_resource_buffer_upload.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c b/src/gallium/drivers/svga/svga_resource_buffer_upload.c index 765d2f3..fdc0329 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c +++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c @@ -40,6 +40,9 @@ #include "svga_debug.h" +#define MAX_DMA_SIZE (8 * 1024 * 1024) + + /** * Allocate a winsys_buffer (ie. DMA, aka GMR memory). * @@ -57,6 +60,13 @@ svga_winsys_buffer_create( struct svga_context *svga, struct svga_winsys_screen *sws = svgascreen->sws; struct svga_winsys_buffer *buf; + /* XXX this shouldn't be a hard-coded number; it should be queried + * somehow. + */ + if (size > MAX_DMA_SIZE) { + return NULL; + } + /* Just try */ buf = sws->buffer_create(sws, alignment, usage, size); if(!buf) { |