mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 10:40:11 +01:00
anv: remove some wrapping around mmap
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ivan Briano <ivan.briano@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27963>
This commit is contained in:
parent
0df9571bfb
commit
6ad2a03ffd
5 changed files with 16 additions and 52 deletions
|
|
@ -1590,11 +1590,12 @@ anv_device_map_bo(struct anv_device *device,
|
|||
assert(!bo->from_host_ptr);
|
||||
assert(size > 0);
|
||||
|
||||
void *map = anv_gem_mmap(device, bo, offset, size);
|
||||
void *map = device->kmd_backend->gem_mmap(device, bo, offset, size);
|
||||
if (unlikely(map == MAP_FAILED))
|
||||
return vk_errorf(device, VK_ERROR_MEMORY_MAP_FAILED, "mmap failed: %m");
|
||||
|
||||
assert(map != NULL);
|
||||
VG(VALGRIND_MALLOCLIKE_BLOCK(map, size, 0, 1));
|
||||
|
||||
if (map_out)
|
||||
*map_out = map;
|
||||
|
|
@ -1609,7 +1610,8 @@ anv_device_unmap_bo(struct anv_device *device,
|
|||
{
|
||||
assert(!bo->from_host_ptr);
|
||||
|
||||
anv_gem_munmap(device, map, map_size);
|
||||
VG(VALGRIND_FREELIKE_BLOCK(map, 0));
|
||||
munmap(map, map_size);
|
||||
}
|
||||
|
||||
VkResult
|
||||
|
|
|
|||
|
|
@ -34,28 +34,6 @@
|
|||
|
||||
#include "i915/anv_gem.h"
|
||||
|
||||
void *
|
||||
anv_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset,
|
||||
uint64_t size)
|
||||
{
|
||||
void *map = device->kmd_backend->gem_mmap(device, bo, offset, size);
|
||||
|
||||
if (map != MAP_FAILED)
|
||||
VG(VALGRIND_MALLOCLIKE_BLOCK(map, size, 0, 1));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/* This is just a wrapper around munmap, but it also notifies valgrind that
|
||||
* this map is no longer valid. Pair this with gem_mmap().
|
||||
*/
|
||||
void
|
||||
anv_gem_munmap(struct anv_device *device, void *p, uint64_t size)
|
||||
{
|
||||
VG(VALGRIND_FREELIKE_BLOCK(p, 0));
|
||||
munmap(p, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* On error, \a timeout_ns holds the remaining time.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -100,27 +100,6 @@ stub_bo_alloc_flags_to_bo_flags(struct anv_device *device,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
anv_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset,
|
||||
uint64_t size)
|
||||
{
|
||||
void *map = device->kmd_backend->gem_mmap(device, bo, offset, size);
|
||||
|
||||
if (map != MAP_FAILED)
|
||||
VG(VALGRIND_MALLOCLIKE_BLOCK(map, size, 0, 1));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/* This is just a wrapper around munmap, but it also notifies valgrind that
|
||||
* this map is no longer valid. Pair this with gem_mmap().
|
||||
*/
|
||||
void
|
||||
anv_gem_munmap(struct anv_device *device, void *p, uint64_t size)
|
||||
{
|
||||
munmap(p, size);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
stub_gem_create_userptr(struct anv_device *device, void *mem, uint64_t size)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2097,10 +2097,6 @@ anv_queue_post_submit(struct anv_queue *queue, VkResult submit_result)
|
|||
return result;
|
||||
}
|
||||
|
||||
void *
|
||||
anv_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset,
|
||||
uint64_t size);
|
||||
void anv_gem_munmap(struct anv_device *device, void *p, uint64_t size);
|
||||
int anv_gem_wait(struct anv_device *device, uint32_t gem_handle, int64_t *timeout_ns);
|
||||
int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
|
||||
uint32_t stride, uint32_t tiling);
|
||||
|
|
|
|||
|
|
@ -597,8 +597,17 @@ anv_h265_decode_video(struct anv_cmd_buffer *cmd_buffer,
|
|||
|
||||
/* Slice parsing */
|
||||
uint32_t last_slice = h265_pic_info->sliceSegmentCount - 1;
|
||||
void *slice_map = anv_gem_mmap(cmd_buffer->device, src_buffer->address.bo,
|
||||
src_buffer->address.offset, frame_info->srcBufferRange);
|
||||
void *slice_map;
|
||||
VkResult result =
|
||||
anv_device_map_bo(cmd_buffer->device,
|
||||
src_buffer->address.bo,
|
||||
src_buffer->address.offset,
|
||||
frame_info->srcBufferRange,
|
||||
&slice_map);
|
||||
if (result != VK_SUCCESS) {
|
||||
anv_batch_set_error(&cmd_buffer->batch, result);
|
||||
return;
|
||||
}
|
||||
|
||||
struct vk_video_h265_slice_params slice_params[h265_pic_info->sliceSegmentCount];
|
||||
|
||||
|
|
@ -617,7 +626,7 @@ anv_h265_decode_video(struct anv_cmd_buffer *cmd_buffer,
|
|||
vk_fill_video_h265_reference_info(frame_info, h265_pic_info, &slice_params[s], ref_slots);
|
||||
}
|
||||
|
||||
anv_gem_munmap(cmd_buffer->device, slice_map, frame_info->srcBufferRange);
|
||||
anv_device_unmap_bo(cmd_buffer->device, src_buffer->address.bo, slice_map, frame_info->srcBufferRange);
|
||||
|
||||
for (unsigned s = 0; s < h265_pic_info->sliceSegmentCount; s++) {
|
||||
uint32_t ctb_size = 1 << (sps->log2_diff_max_min_luma_coding_block_size +
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue