u_upload_mgr: assert failure for large uploads
When replaying the trace from #2878 (closed) the following assert fails:
assert(size < INT32_MAX / 2); /* prevent overflows of reference.count */
because size is 2147483520
.
Stacktrace:
#3 in __GI___assert_fail (assertion=0x7ffff5431544 "size < INT32_MAX / 2", file=0x7ffff54314f0 "../src/gallium/auxiliary/util/u_upload_mgr.c", line=231, function=0x7ffff54315f0 <__PRETTY_FUNCTION__.2> "u_upload_alloc_buffer") at assert.c:101
#4 in u_upload_alloc_buffer (upload=0x555556079360, min_size=2147483520) at ../src/gallium/auxiliary/util/u_upload_mgr.c:231
#5 in u_upload_alloc (upload=0x555556079360, min_out_offset=0, size=2147483520, alignment=64, out_offset=0x7fff6c0f56c0, outbuf=0x7fff6c0f56b8, ptr=0x7fff7b7fd8d8) at ../src/gallium/auxiliary/util/u_upload_mgr.c:269
#6 in tc_transfer_map (_pipe=0x55555605ac60, resource=0x7fff5e889e80, level=0, usage=1610612994, box=0x7fff7b7fd940, transfer=0x7fff7b7fd958) at ../src/gallium/auxiliary/util/u_threaded_context.c:1651
#7 in tc_buffer_subdata (_pipe=0x55555605ac60, resource=0x7fff5e889e80, usage=1610612994, offset=0, size=2147483520, data=0x7ffedc000010) at ../src/gallium/auxiliary/util/u_threaded_context.c:1920
#8 in pipe_buffer_write (pipe=0x55555605ac60, buf=0x7fff5e889e80, offset=0, size=2147483520, data=0x7ffedc000010) at ../src/gallium/auxiliary/util/u_inlines.h:417
#9 in bufferobj_data (obj=0x7fff6d6b2ab0, storageFlags=259, usage=35044, offset=0, memObj=0x0, data=0x7ffedc000010, size=2147483520, target=35345, ctx=0x555556079700) at ../src/mesa/state_tracker/st_cb_bufferobjects.c:387
#10 st_bufferobj_data (ctx=0x555556079700, target=35345, size=2147483520, data=0x7ffedc000010, usage=35044, storageFlags=259, obj=0x7fff6d6b2ab0) at ../src/mesa/state_tracker/st_cb_bufferobjects.c:434
#11 in buffer_data (no_error=false, func=0x7ffff53000cc "glBufferData", usage=35044, data=0x7ffedc000010, size=2147483520, target=35345, bufObj=0x7fff6d6b2ab0, ctx=0x555556079700) at ../src/mesa/main/bufferobj.c:2269
#12 buffer_data_error (ctx=0x555556079700, bufObj=0x7fff6d6b2ab0, target=35345, size=2147483520, data=0x7ffedc000010, usage=35044, func=0x7ffff53000cc "glBufferData") at ../src/mesa/main/bufferobj.c:2295
#13 in _mesa_buffer_data (ctx=0x555556079700, bufObj=0x7fff6d6b2ab0, target=35345, size=2147483520, data=0x7ffedc000010, usage=35044, func=0x7ffff53000cc "glBufferData") at ../src/mesa/main/bufferobj.c:2311
#14 in _mesa_BufferData (target=35345, size=2147483520, data=0x7ffedc000010, usage=35044) at ../src/mesa/main/bufferobj.c:2336
This is caused by the "gallium/u_upload_mgr: eliminate all atomics for the upload buffer" commit from !8298 (merged).
cc @mareko
Edited by Pierre-Eric Pelloux-Prayer