diff options
author | Marek Olšák <[email protected]> | 2017-06-27 19:24:20 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-07-04 15:40:37 +0200 |
commit | e6dbe975eff8e23992c9d9a72ce302896b5fecfc (patch) | |
tree | b53dee5864af64ea55ec09945964506d465eb30f /src/gallium/drivers | |
parent | fee2883bd78106a0d8dc3c081d53c8983ab6f07f (diff) |
gallium/radeon: fix a possible crash for buffer exports
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index d68587b4a27..139ab137599 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -589,16 +589,22 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, res->external_usage = usage; } - if (rscreen->chip_class >= GFX9) { - offset = rtex->surface.u.gfx9.surf_offset; - stride = rtex->surface.u.gfx9.surf_pitch * - rtex->surface.bpe; - slice_size = rtex->surface.u.gfx9.surf_slice_size; + if (res->b.b.target == PIPE_BUFFER) { + offset = 0; + stride = 0; + slice_size = 0; } else { - offset = rtex->surface.u.legacy.level[0].offset; - stride = rtex->surface.u.legacy.level[0].nblk_x * - rtex->surface.bpe; - slice_size = rtex->surface.u.legacy.level[0].slice_size; + if (rscreen->chip_class >= GFX9) { + offset = rtex->surface.u.gfx9.surf_offset; + stride = rtex->surface.u.gfx9.surf_pitch * + rtex->surface.bpe; + slice_size = rtex->surface.u.gfx9.surf_slice_size; + } else { + offset = rtex->surface.u.legacy.level[0].offset; + stride = rtex->surface.u.legacy.level[0].nblk_x * + rtex->surface.bpe; + slice_size = rtex->surface.u.legacy.level[0].slice_size; + } } return rscreen->ws->buffer_get_handle(res->buf, stride, offset, slice_size, whandle); |