[Intel-gfx] [PATCH 2/3] drm/i915: Allow userspace to specify ringsize on construction

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 25 10:05:05 UTC 2019


Quoting Chris Wilson (2019-11-15 16:05:45)
> No good reason why we must always use a static ringsize, so let
> userspace select one during construction.

Do we have any news on whether userspace has materialised for this yet?

It's literally just

--- a/runtime/os_interface/linux/drm_neo.cpp
+++ b/runtime/os_interface/linux/drm_neo.cpp
@@ -182,6 +182,15 @@ void setNonPersistent(uint32_t drmContextId) {
     ioctl(DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &gcp);
 }

+void setMaxRingSize(uint32_t drmContextId) {
+    drm_i915_gem_context_param gcp = {};
+    gcp.ctx_id = drmContextId;
+    gcp.param = 0xc; /* I915_CONTEXT_PARAM_RINGSIZE; */
+    gcp.value = 128 << 12; /* maximum ring size is 512KiB, or 128 pages */
+
+    ioctl(DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &gcp);
+}
+
 uint32_t Drm::createDrmContext() {
     drm_i915_gem_context_create gcc = {};
     auto retVal = ioctl(DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &gcc);
@@ -190,6 +199,9 @@ uint32_t Drm::createDrmContext() {
     /* enable cleanup of resources on process termination */
     setNonPersistent(gcc.ctx_id);

+    /* Big rings for silly amounts of non-blocking work! */
+    setMaxRingSize(gcc.ctx_id);

with some justification.
-Chris


More information about the Intel-gfx mailing list