summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/radeon/radeon_cs_gem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libdrm/radeon/radeon_cs_gem.c b/libdrm/radeon/radeon_cs_gem.c
index e42ec48f..232ea7f3 100644
--- a/libdrm/radeon/radeon_cs_gem.c
+++ b/libdrm/radeon/radeon_cs_gem.c
@@ -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;