iris: Get VM id from iris_bufmgr's fd

iris_bufmgr_init_global_vm() was getting the VM id from the callers
fd not the iris_bufmgr's duplicated fd.

If i915 driver decides to always return unique vm ids, like a counter
that is initialized per device. So fd0 would have vm id = 0 by
default, fd1(dup of fd0) would have vm id = 1... in this scenario it
would cause a mismatch. But it is not the current i915 implementation.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19467>
This commit is contained in:
José Roberto de Souza 2022-11-02 06:33:43 -07:00 committed by Marge Bot
parent ac51c0c93c
commit 23adf60f96

View file

@ -2356,10 +2356,10 @@ iris_bufmgr_get_meminfo(struct iris_bufmgr *bufmgr,
}
static void
iris_bufmgr_init_global_vm(int fd, struct iris_bufmgr *bufmgr)
iris_bufmgr_init_global_vm(struct iris_bufmgr *bufmgr)
{
uint64_t value;
if (!intel_gem_get_context_param(fd, 0, I915_CONTEXT_PARAM_VM, &value)) {
if (!intel_gem_get_context_param(bufmgr->fd, 0, I915_CONTEXT_PARAM_VM, &value)) {
bufmgr->use_global_vm = false;
bufmgr->global_vm_id = 0;
} else {
@ -2400,7 +2400,7 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse)
simple_mtx_init(&bufmgr->lock, mtx_plain);
simple_mtx_init(&bufmgr->bo_deps_lock, mtx_plain);
iris_bufmgr_init_global_vm(fd, bufmgr);
iris_bufmgr_init_global_vm(bufmgr);
list_inithead(&bufmgr->zombie_list);