diff options
author | Julien Isorce <[email protected]> | 2017-03-23 13:34:07 +0000 |
---|---|---|
committer | Julien Isorce <[email protected]> | 2017-03-28 17:54:15 +0100 |
commit | c5fe99eec2d728ddd07115f43f274c07fa2d69b5 (patch) | |
tree | a6445fd04fd550455cc7404d40c70f5a2a9abcc9 /src/gallium/drivers/r600 | |
parent | 749cf3be6e18d2595123c9ae7f8fd262f15a02db (diff) |
r600g: check NULL return from u_upload_alloc
Like done in si_state_draw.c::si_draw_vbo
u_upload_alloc can fail, i.e. set output param *ptr to NULL, for 2 reasons:
alloc fails or map fails. For both there is already a fprintf/stderr in
radeon_create_bo and radeon_bo_do_map.
In src/gallium/drivers/ it is a common usage to just avoid to crash by doing
a silent check. But defer fprintf where the error comes from, libdrm calls.
Signed-off-by: Julien Isorce <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 6f8279fb5e6..cedeb74e2d7 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1746,6 +1746,10 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info u_upload_alloc(ctx->stream_uploader, start, count * 2, 256, &out_offset, &out_buffer, &ptr); + if (unlikely(!ptr)) { + pipe_resource_reference(&ib.buffer, NULL); + return; + } util_shorten_ubyte_elts_to_userptr( &rctx->b.b, &ib, 0, 0, ib.offset + start, count, ptr); |