Mesa (master): intel/mi_builder: Create a context in the tests
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 18 21:33:04 UTC 2021
Module: Mesa
Branch: master
Commit: 749ae5af93d31042feefcdab917ecf42d26b5863
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=749ae5af93d31042feefcdab917ecf42d26b5863
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Wed Feb 17 20:00:53 2021 -0600
intel/mi_builder: Create a context in the tests
This makes them work on the simulator
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>
---
src/intel/common/tests/gen_mi_builder_test.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/intel/common/tests/gen_mi_builder_test.cpp b/src/intel/common/tests/gen_mi_builder_test.cpp
index 4002619dc8e..f99e5efd46e 100644
--- a/src/intel/common/tests/gen_mi_builder_test.cpp
+++ b/src/intel/common/tests/gen_mi_builder_test.cpp
@@ -125,6 +125,7 @@ public:
}
int fd;
+ int ctx_id;
gen_device_info devinfo;
uint32_t batch_bo_handle;
@@ -196,6 +197,11 @@ gen_mi_builder_test::SetUp()
}
ASSERT_TRUE(i < max_devices) << "Failed to find a DRM device";
+ drm_i915_gem_context_create ctx_create = drm_i915_gem_context_create();
+ ASSERT_EQ(drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE,
+ (void *)&ctx_create), 0) << strerror(errno);
+ ctx_id = ctx_create.ctx_id;
+
// Create the batch buffer
drm_i915_gem_create gem_create = drm_i915_gem_create();
gem_create.size = BATCH_BO_SIZE;
@@ -295,6 +301,7 @@ gen_mi_builder_test::submit_batch()
execbuf.batch_start_offset = 0;
execbuf.batch_len = batch_offset;
execbuf.flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER;
+ execbuf.rsvd1 = ctx_id;
ASSERT_EQ(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
(void *)&execbuf), 0) << strerror(errno);
More information about the mesa-commit
mailing list