History

drm/i915: Create/destroy VM (ppGTT) for use with contexts

In preparation to making the ppGTT binding for a context explicit (to facilitate reusing the same ppGTT between different contexts), allow the user to create and destroy named ppGTT. v2: Replace global barrier for swapping over the ppgtt and tlbs with a local context barrier (Tvrtko) v3: serialise with struct_mutex; it's lazy but required dammit v4: Rewrite igt_ctx_shared_exec to be more different (aimed to be more similarly, turned out different!) v5: Fix up test unwind for aliasing-ppgtt (snb) v6: Tighten language for uapi struct drm_i915_gem_vm_control. v7: Patch the context image for runtime ppgtt switching!

Chris Wilson committed 7 years ago

Commit e0695db1 parent 9d1305e11 files · +580 −81Browse files

Showing the changes to include/uapi (1 of 11 files). Show all

Unified · Split

include/uapi/drm/i915_drm.h+43−0
@@ -343,6 +343,8 @@ typedef struct _drm_i915_sarea { · 342 unmodified lines
343#define DRM_I915_PERF_ADD_CONFIG 0x37343#define DRM_I915_PERF_ADD_CONFIG 0x37
344#define DRM_I915_PERF_REMOVE_CONFIG 0x38344#define DRM_I915_PERF_REMOVE_CONFIG 0x38
345#define DRM_I915_QUERY 0x39345#define DRM_I915_QUERY 0x39
346#define DRM_I915_GEM_VM_CREATE 0x3a
347#define DRM_I915_GEM_VM_DESTROY 0x3b
346/* Must be kept compact -- no holes */348/* Must be kept compact -- no holes */
347 349
348#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)350#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
@@ -402,6 +404,8 @@ typedef struct _drm_i915_sarea { · 53 unmodified lines
402#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)404#define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config)
403#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)405#define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64)
404#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)406#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)
407#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)
408#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control)
405 409
406/* Allow drivers to submit batchbuffers directly to hardware, relying410/* Allow drivers to submit batchbuffers directly to hardware, relying
407 * on the security mechanisms provided by hardware.411 * on the security mechanisms provided by hardware.
@@ -1453,6 +1457,33 @@ struct drm_i915_gem_context_destroy { · 1045 unmodified lines
1453 __u32 pad;1457 __u32 pad;
1454};1458};
1455 1459
1460/*
1461 * DRM_I915_GEM_VM_CREATE -
1462 *
1463 * Create a new virtual memory address space (ppGTT) for use within a context
1464 * on the same file. Extensions can be provided to configure exactly how the
1465 * address space is setup upon creation.
1466 *
1467 * The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is
1468 * returned in the outparam @vm_id.
1469 *
1470 * No flags are defined, with all bits reserved and must be zero.
1471 *
1472 * An extension chain maybe provided, starting with @extensions, and terminated
1473 * by the @next_extension being 0. Currently, no extensions are defined.
1474 *
1475 * DRM_I915_GEM_VM_DESTROY -
1476 *
1477 * Destroys a previously created VM id, specified in @vm_id.
1478 *
1479 * No extensions or flags are allowed currently, and so must be zero.
1480 */
1481struct drm_i915_gem_vm_control {
1482 __u64 extensions;
1483 __u32 flags;
1484 __u32 vm_id;
1485};
1486
1456struct drm_i915_reg_read {1487struct drm_i915_reg_read {
1457 /*1488 /*
1458 * Register offset.1489 * Register offset.
@@ -1542,7 +1573,19 @@ struct drm_i915_gem_context_param { · 83 unmodified lines
1542 * On creation, all new contexts are marked as recoverable.1573 * On creation, all new contexts are marked as recoverable.
1543 */1574 */
1544#define I915_CONTEXT_PARAM_RECOVERABLE 0x81575#define I915_CONTEXT_PARAM_RECOVERABLE 0x8
1576
1577 /*
1578 * The id of the associated virtual memory address space (ppGTT) of
1579 * this context. Can be retrieved and passed to another context
1580 * (on the same fd) for both to use the same ppGTT and so share
1581 * address layouts, and avoid reloading the page tables on context
1582 * switches between themselves.
1583 *
1584 * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY.
1585 */
1586#define I915_CONTEXT_PARAM_VM 0x9
1545/* Must be kept compact -- no holes and well documented */1587/* Must be kept compact -- no holes and well documented */
1588
1546 __u64 value;1589 __u64 value;
1547};1590};
1548 1591