mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 08:30:10 +01:00
iris: Use a tiny table to map mmap modes to offsets
This is a little more obvious than the if-ladder. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11888>
This commit is contained in:
parent
c49041c9d7
commit
24031700a7
1 changed files with 7 additions and 6 deletions
|
|
@ -1043,12 +1043,13 @@ iris_bo_gem_mmap_offset(struct pipe_debug_callback *dbg, struct iris_bo *bo)
|
|||
.handle = bo->gem_handle,
|
||||
};
|
||||
|
||||
if (bo->mmap_mode == IRIS_MMAP_WB)
|
||||
mmap_arg.flags = I915_MMAP_OFFSET_WB;
|
||||
else if (bo->mmap_mode == IRIS_MMAP_WC)
|
||||
mmap_arg.flags = I915_MMAP_OFFSET_WC;
|
||||
else
|
||||
mmap_arg.flags = I915_MMAP_OFFSET_UC;
|
||||
static const uint32_t mmap_offset_for_mode[] = {
|
||||
[IRIS_MMAP_UC] = I915_MMAP_OFFSET_UC,
|
||||
[IRIS_MMAP_WC] = I915_MMAP_OFFSET_WC,
|
||||
[IRIS_MMAP_WB] = I915_MMAP_OFFSET_WB,
|
||||
};
|
||||
assert(bo->mmap_mode < ARRAY_SIZE(mmap_offset_for_mode));
|
||||
mmap_arg.flags = mmap_offset_for_mode[bo->mmap_mode];
|
||||
|
||||
/* Get the fake offset back */
|
||||
int ret = intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, &mmap_arg);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue