History

drm/i915: Specify bsd rings through exec flag

On Skylake GT3 we have 2 Video Command Streamers (VCS), which is asymmetrical. For example, HEVC GPU commands can be only dispatched to VCS1 ring. But userspace has no control when using VCS1 or VCS2. This patch introduces a mechanism to avoid the default ping-pong mode and use one specific ring through execution flag. This mechanism is usable for all the platforms with 2 VCS rings. The open source usage is from these two commits in vaapi/intel: commit 702050f04131a44ef8ac16651708ce8a8d98e4b8 Author: Zhao, Yakui <yakui.zhao@intel.com> Date: Mon Nov 17 12:44:19 2014 +0800 Allow the batchbuffer to be submitted with override flag commit a56efcdf27d11ad9b21664b4a2cda72d7f90f5a8 Author: Zhao Yakui <yakui.zhao@intel.com> Date: Mon Nov 17 12:44:22 2014 +0800 Add the override flag to assure that HEVC video command always uses BSD ring0 for SKL GT3 machine v2: fix whitespace (Rodrigo) v3: remove incorrect chunk that came on -collector rebase. (Rodrigo) v4: change the comment (Zhipeng) v5: address Daniel's comment (Zhipeng)

Zhipeng Gong committed 11 years ago

Commit 8d360df1 parent 5724dbd2 files · +31 −3Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/i915/i915_gem_execbuffer.c +24 −2
  2. include/uapi/drm/i915_drm.h +7 −1
drivers/gpu/drm/i915/i915_gem_execbuffer.c+24−2
@@ -1380,13 +1380,35 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, · 1379 unmodified lines
1380 return -EINVAL;1380 return -EINVAL;
1381 }1381 }
1382 1382
1383 if (((args->flags & I915_EXEC_RING_MASK) != I915_EXEC_BSD) &&
1384 ((args->flags & I915_EXEC_BSD_MASK) != 0)) {
1385 DRM_DEBUG("execbuf with non bsd ring but with invalid "
1386 "bsd dispatch flags: %d\n", (int)(args->flags));
1387 return -EINVAL;
1388 }
1389
1383 if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_DEFAULT)1390 if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_DEFAULT)
1384 ring = &dev_priv->ring[RCS];1391 ring = &dev_priv->ring[RCS];
1385 else if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) {1392 else if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) {
1386 if (HAS_BSD2(dev)) {1393 if (HAS_BSD2(dev)) {
1387 int ring_id;1394 int ring_id;
1388 ring_id = gen8_dispatch_bsd_ring(dev, file);1395
1389 ring = &dev_priv->ring[ring_id];1396 switch (args->flags & I915_EXEC_BSD_MASK) {
1397 case I915_EXEC_BSD_DEFAULT:
1398 ring_id = gen8_dispatch_bsd_ring(dev, file);
1399 ring = &dev_priv->ring[ring_id];
1400 break;
1401 case I915_EXEC_BSD_RING1:
1402 ring = &dev_priv->ring[VCS];
1403 break;
1404 case I915_EXEC_BSD_RING2:
1405 ring = &dev_priv->ring[VCS2];
1406 break;
1407 default:
1408 DRM_DEBUG("execbuf with unknown bsd ring: %d\n",
1409 (int)(args->flags & I915_EXEC_BSD_MASK));
1410 return -EINVAL;
1411 }
1390 } else1412 } else
1391 ring = &dev_priv->ring[VCS];1413 ring = &dev_priv->ring[VCS];
1392 } else1414 } else
include/uapi/drm/i915_drm.h+7−1
@@ -750,7 +750,13 @@ struct drm_i915_gem_execbuffer2 { · 749 unmodified lines
750 */750 */
751#define I915_EXEC_HANDLE_LUT (1<<12)751#define I915_EXEC_HANDLE_LUT (1<<12)
752 752
753#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_HANDLE_LUT<<1)753/** Used for switching BSD rings on the platforms with two BSD rings */
754#define I915_EXEC_BSD_MASK (3<<13)
755#define I915_EXEC_BSD_DEFAULT (0<<13) /* default ping-pong mode */
756#define I915_EXEC_BSD_RING1 (1<<13)
757#define I915_EXEC_BSD_RING2 (2<<13)
758
759#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15)
754 760
755#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)761#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
756#define i915_execbuffer2_set_context_id(eb2, context) \762#define i915_execbuffer2_set_context_id(eb2, context) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t