mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-28 07:30:13 +01:00
radeon: fix allocation
The old code increments the command stream size by another kbyte, but does not make sure that the requested packet size fits into the stream. The patch ensures that the whole next packet fits there and rounds the allocated size to a power of two. Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
This commit is contained in:
parent
b0b96636db
commit
6eafd1cf38
1 changed files with 2 additions and 1 deletions
|
|
@ -226,7 +226,8 @@ static int cs_gem_begin(struct radeon_cs *cs,
|
|||
if (cs->cdw + ndw > cs->ndw) {
|
||||
uint32_t tmp, *ptr;
|
||||
|
||||
tmp = (cs->ndw + 1 + 0x3FF) & (~0x3FF);
|
||||
/* round up the required size to a multiple of 1024 */
|
||||
tmp = (cs->cdw + ndw + 0x3FF) & (~0x3FF);
|
||||
ptr = (uint32_t*)realloc(cs->packets, 4 * tmp);
|
||||
if (ptr == NULL) {
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue