drm/i915/hsw/bdw: Enable resource streamer
Subsystems (3)
This is a re-spin of my resource streamer patchset from a year ago. The resource streamer is a hw-feature that helps in reducing commands submitted by the CPU.
We have finally have the Mesa optimization that requires the use of this interface.
Abdiel Janulgue (2):
drm/i915/hsw/bdw: Expose I915_EXEC_RESOURCE_STREAMER flag drm/i915/hsw/bdw: Enable resource streamer bits on MI_BATCH_BUFFER_START
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 ++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ringbuffer.c | 6 ++++-- drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + include/uapi/drm/i915_drm.h | 7 ++++++- 5 files changed, 26 insertions(+), 3 deletions(-)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/2 drm/i915/hsw/bdw: Expose I915_EXEC_RESOURCE_STREAMER flag
Ensures that the batch buffer is executed by the resource streamer
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 +++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + include/uapi/drm/i915_drm.h | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +15 -0
@@ -1474,6 +1474,21 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, }else ring = &dev_priv->ring[(args->flags &I915_EXEC_RING_MASK ) -1 ]; +if (args->flags &I915_EXEC_RESOURCE_STREAMER ) { +if (!IS_HASWELL (dev) &&INTEL_INFO (dev)->gen <8 ) { +DRM_DEBUG ("RS is only allowed for Haswell, Gen8 " +"and above\n" ); +return -EINVAL ; + } +if (ring->id !=RCS ) { +DRM_DEBUG ("RS is not available on %s)\n" , + ring->name); +return -EINVAL ; + } + + dispatch_flags |=I915_DISPATCH_RS ; + } +if (!intel_ring_initialized (ring)) {DRM_DEBUG ("execbuf with invalid ring: %d\n" , (int )(args->flags &I915_EXEC_RING_MASK ));
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -0
@@ -167,6 +167,7 @@ struct intel_engine_cs { unsigned dispatch_flags);#define I915_DISPATCH_SECURE 0x1#define I915_DISPATCH_PINNED 0x2 +#define I915_DISPATCH_RS 0x4void (*cleanup)(struct intel_engine_cs *ring);/* GEN8 signal/wait table - never trust comments!
include/uapi/drm/i915_drm.h +6 -1
@@ -760,7 +760,12 @@ struct drm_i915_gem_execbuffer2 {#define I915_EXEC_BSD_RING1 (1<<13)#define I915_EXEC_BSD_RING2 (2<<13) -#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15) +/** Tell the kernel that the batchbuffer is processed by +* the resource streamer. +*/ +#define I915_EXEC_RESOURCE_STREAMER (1<<16) + +#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_RESOURCE_STREAMER <<1)#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)#define i915_execbuffer2_set_context_id (eb2, context) \
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/2] drm/i915/hsw/bdw: Expose I915_EXEC_RESOURCE_STREAMER flag
Quoted 23 lines · Abdiel Janulgue
Ensures that the batch buffer is executed by the resource streamer
Signed-off-by Abdiel Janulgue <[email protected]>--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 +++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + include/uapi/drm/i915_drm.h | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_execbuffer.c +6
-0@@ -1474,6 +1474,21 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, }else ring = &dev_priv->ring[(args->flags &I915_EXEC_RING_MASK ) -1 ]; +if (args->flags &I915_EXEC_RESOURCE_STREAMER ) { +if (!IS_HASWELL (dev) &&INTEL_INFO (dev)->gen <8 ) { +DRM_DEBUG ("RS is only allowed for Haswell, Gen8 " +"and above\n" ); +return -EINVAL ; + }
drivers/gpu/drm/i915/i915_gem_execbuffer.c i915_gem_do_execbuffer(struct drm_device *dev, void *data, · line 1492
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +9
-0+if (ring->id !=RCS ) { +DRM_DEBUG ("RS is not available on %s)\n" , + ring->name); +return -EINVAL ; + } + + dispatch_flags |=I915_DISPATCH_RS ; + } +if (!intel_ring_initialized (ring)) {
Please don't split the conversion from args->flags to ring from its subsequent EINVAL check.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/2] drm/i915/hsw/bdw: Expose I915_EXEC_RESOURCE_STREAMER flag
Quoted 30 lines · Chris Wilson
Quoted 29 lines · Abdiel Janulgue
Ensures that the batch buffer is executed by the resource streamer
Signed-off-by Abdiel Janulgue <[email protected]>--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 +++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + include/uapi/drm/i915_drm.h | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_execbuffer.c +12
-0@@ -1474,6 +1474,21 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, }else ring = &dev_priv->ring[(args->flags &I915_EXEC_RING_MASK ) -1 ]; +if (args->flags &I915_EXEC_RESOURCE_STREAMER ) { +if (!IS_HASWELL (dev) &&INTEL_INFO (dev)->gen <8 ) { +DRM_DEBUG ("RS is only allowed for Haswell, Gen8 " +"and above\n" ); +return -EINVAL ; + } +if (ring->id !=RCS ) { +DRM_DEBUG ("RS is not available on %s)\n" , + ring->name); +return -EINVAL ; + } +
Quoted 9 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c i915_gem_do_execbuffer(struct drm_device *dev, void *data, · line 1492
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3
-0+ dispatch_flags |=I915_DISPATCH_RS ; + } +if (!intel_ring_initialized (ring)) {Please don't split the conversion from
args->flagsto ring from its subsequent EINVAL check.
-Chris
I'll include this change in the next version.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915/hsw/bdw: Enable resource streamer bits on MI_BATCH_BUFFER_START
In reply to Abdiel JanulgueAdds support for executing the resource streamer on BDW
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ringbuffer.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -356,6 +356,7 @@#define MI_BATCH_BUFFER_START MI_INSTR(0x31, 0)#define MI_BATCH_GTT (2<<6)/* aliased with (1<<7) on gen4 */ #define MI_BATCH_BUFFER_START_GEN8 MI_INSTR(0x31, 1) +#define MI_BATCH_RESOURCE_STREAMER (1<<10)#define MI_PREDICATE_SRC0 (0x2400)#define MI_PREDICATE_SRC1 (0x2408)
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -2
@@ -2385,7 +2385,8 @@ gen8_ring_dispatch_execbuffer(struct intel_engine_cs *ring,return ret;/* FIXME(BDW): Address space and security selectors. */ -intel_ring_emit (ring,MI_BATCH_BUFFER_START_GEN8 | (ppgtt<<8 )); +intel_ring_emit (ring,MI_BATCH_BUFFER_START_GEN8 | (ppgtt<<8 ) | + (dispatch_flags &I915_DISPATCH_RS ?MI_BATCH_RESOURCE_STREAMER :0 ));intel_ring_emit (ring,lower_32_bits (offset));intel_ring_emit (ring,upper_32_bits (offset));intel_ring_emit (ring,MI_NOOP );
@@ -2408,7 +2409,8 @@ hsw_ring_dispatch_execbuffer(struct intel_engine_cs *ring,intel_ring_emit (ring,MI_BATCH_BUFFER_START | (dispatch_flags &I915_DISPATCH_SECURE ? -0 :MI_BATCH_PPGTT_HSW |MI_BATCH_NON_SECURE_HSW )); +0 :MI_BATCH_PPGTT_HSW |MI_BATCH_NON_SECURE_HSW ) | + (dispatch_flags &I915_DISPATCH_RS ?MI_BATCH_RESOURCE_STREAMER :0 ));/* bit0-7 is the length on GEN6+ */ intel_ring_emit (ring, offset);intel_ring_advance (ring);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Abdiel Janulgue
This is a re-spin of my resource streamer patchset from a year ago. The resource streamer is a hw-feature that helps in reducing commands submitted by the CPU.
Did you check that the contexts we allocate are large enough to hold the extra RS state? I can't remember if the size we settled on was sufficient or not...
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · Chris Wilson
Quoted 3 lines · Abdiel Janulgue
This is a re-spin of my resource streamer patchset from a year ago. The resource streamer is a hw-feature that helps in reducing commands submitted by the CPU.
Did you check that the contexts we allocate are large enough to hold the extra RS state? I can't remember if the size we settled on was sufficient or not...
-Chris
I checked HSW_CXT_TOTAL_SIZE and GEN8_CXT_TOTAL_SIZE to the values in Bspec, the sizes does indeed contain the resource streamer dwords. So I guess the answer is it's sufficient.
-Abdiel
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx