aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-03-12 10:21:21 +1000
committerDave Airlie <[email protected]>2018-03-15 12:26:39 +1000
commit4b15b5e803eb4705f8532e6cc41cfdc8bd065de9 (patch)
treea01ae21b9629003b9711da0c73790bbac7c90932 /src/gallium/winsys
parentc1e47a3c1fb380b36b7e403c248fbb5ce9e74ffe (diff)
virgl: resize resource bo allocation if we need to.
This fixes an illegal command buffer on the host seen with piglit arb_internalformat_query2-max-dimensions Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.c8
-rw-r--r--src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index 77854680e59..cf3c3bac4b4 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -620,8 +620,12 @@ static void virgl_drm_add_res(struct virgl_drm_winsys *qdws,
unsigned hash = res->res_handle & (sizeof(cbuf->is_handle_added)-1);
if (cbuf->cres > cbuf->nres) {
- fprintf(stderr,"failure to add relocation\n");
- return;
+ cbuf->nres += 256;
+ cbuf->res_bo = realloc(cbuf->res_bo, cbuf->nres * sizeof(struct virgl_hw_buf*));
+ if (!cbuf->res_bo) {
+ fprintf(stderr,"failure to add relocation %d, %d\n", cbuf->cres, cbuf->nres);
+ return;
+ }
}
cbuf->res_bo[cbuf->cres] = NULL;
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
index f62d0d0981d..9a96c6eb83f 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -460,8 +460,12 @@ static void virgl_vtest_add_res(struct virgl_vtest_winsys *vtws,
unsigned hash = res->res_handle & (sizeof(cbuf->is_handle_added)-1);
if (cbuf->cres > cbuf->nres) {
- fprintf(stderr,"failure to add relocation\n");
- return;
+ cbuf->nres += 256;
+ cbuf->res_bo = realloc(cbuf->res_bo, cbuf->nres * sizeof(struct virgl_hw_buf*));
+ if (!cbuf->res_bo) {
+ fprintf(stderr,"failure to add relocation %d, %d\n", cbuf->cres, cbuf->nres);
+ return;
+ }
}
cbuf->res_bo[cbuf->cres] = NULL;