aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson2010-10-26 05:35:11 -0500
committerChris Wilson2010-10-26 05:41:40 -0500
commit057fab3382c02af54126ce395c43d4e6dce9439a (patch)
tree8800cfcffacf278067e00fe6715c7e9c348d310a
parentc5286f4a871e054b63dee8a60a6f06574c4ca1b8 (diff)
downloadexternal-libgbm-057fab3382c02af54126ce395c43d4e6dce9439a.tar.gz
external-libgbm-057fab3382c02af54126ce395c43d4e6dce9439a.tar.xz
external-libgbm-057fab3382c02af54126ce395c43d4e6dce9439a.zip
intel: Prepare for BLT ring split.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--include/drm/i915_drm.h7
-rw-r--r--intel/intel_bufmgr_gem.c28
2 files changed, 29 insertions, 6 deletions
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 75944134..bd930614 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -206,6 +206,7 @@ typedef struct _drm_i915_sarea {
206#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 206#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
207#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 207#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
208#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 208#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
209#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
209#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 210#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
210#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 211#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
211#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) 212#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
@@ -276,6 +277,7 @@ typedef struct drm_i915_irq_wait {
276#define I915_PARAM_HAS_PAGEFLIPPING 8 277#define I915_PARAM_HAS_PAGEFLIPPING 8
277#define I915_PARAM_HAS_EXECBUF2 9 278#define I915_PARAM_HAS_EXECBUF2 9
278#define I915_PARAM_HAS_BSD 10 279#define I915_PARAM_HAS_BSD 10
280#define I915_PARAM_HAS_BLT 11
279 281
280typedef struct drm_i915_getparam { 282typedef struct drm_i915_getparam {
281 int param; 283 int param;
@@ -617,8 +619,11 @@ struct drm_i915_gem_execbuffer2 {
617 __u32 num_cliprects; 619 __u32 num_cliprects;
618 /** This is a struct drm_clip_rect *cliprects */ 620 /** This is a struct drm_clip_rect *cliprects */
619 __u64 cliprects_ptr; 621 __u64 cliprects_ptr;
622#define I915_EXEC_RING_MASK (7<<0)
623#define I915_EXEC_DEFAULT (0<<0)
620#define I915_EXEC_RENDER (1<<0) 624#define I915_EXEC_RENDER (1<<0)
621#define I915_EXEC_BSD (1<<1) 625#define I915_EXEC_BSD (2<<0)
626#define I915_EXEC_BLT (3<<0)
622 __u64 flags; 627 __u64 flags;
623 __u64 rsvd1; 628 __u64 rsvd1;
624 __u64 rsvd2; 629 __u64 rsvd2;
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 60174e19..c5847a8a 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -99,6 +99,8 @@ typedef struct _drm_intel_bufmgr_gem {
99 int available_fences; 99 int available_fences;
100 int pci_device; 100 int pci_device;
101 int gen; 101 int gen;
102 char has_bsd;
103 char has_blt;
102 char bo_reuse; 104 char bo_reuse;
103 char fenced_relocs; 105 char fenced_relocs;
104} drm_intel_bufmgr_gem; 106} drm_intel_bufmgr_gem;
@@ -1545,8 +1547,21 @@ drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
1545 struct drm_i915_gem_execbuffer2 execbuf; 1547 struct drm_i915_gem_execbuffer2 execbuf;
1546 int ret, i; 1548 int ret, i;
1547 1549
1548 if ((ring_flag != I915_EXEC_RENDER) && (ring_flag != I915_EXEC_BSD)) 1550 switch (ring_flag) {
1551 default:
1549 return -EINVAL; 1552 return -EINVAL;
1553 case I915_EXEC_BLT:
1554 if (!bufmgr_gem->has_blt)
1555 return -EINVAL;
1556 break;
1557 case I915_EXEC_BSD:
1558 if (!bufmgr_gem->has_bsd)
1559 return -EINVAL;
1560 break;
1561 case I915_EXEC_RENDER:
1562 case I915_EXEC_DEFAULT:
1563 break;
1564 }
1550 1565
1551 pthread_mutex_lock(&bufmgr_gem->lock); 1566 pthread_mutex_lock(&bufmgr_gem->lock);
1552 /* Update indices and set up the validate list. */ 1567 /* Update indices and set up the validate list. */
@@ -2054,7 +2069,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
2054 struct drm_i915_gem_get_aperture aperture; 2069 struct drm_i915_gem_get_aperture aperture;
2055 drm_i915_getparam_t gp; 2070 drm_i915_getparam_t gp;
2056 int ret; 2071 int ret;
2057 int exec2 = 0, has_bsd = 0; 2072 int exec2 = 0;
2058 2073
2059 bufmgr_gem = calloc(1, sizeof(*bufmgr_gem)); 2074 bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
2060 if (bufmgr_gem == NULL) 2075 if (bufmgr_gem == NULL)
@@ -2107,8 +2122,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
2107 2122
2108 gp.param = I915_PARAM_HAS_BSD; 2123 gp.param = I915_PARAM_HAS_BSD;
2109 ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); 2124 ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
2110 if (!ret) 2125 bufmgr_gem->has_bsd = ret == 0;
2111 has_bsd = 1; 2126
2127 gp.param = I915_PARAM_HAS_BLT;
2128 ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
2129 bufmgr_gem->has_blt = ret == 0;
2112 2130
2113 if (bufmgr_gem->gen < 4) { 2131 if (bufmgr_gem->gen < 4) {
2114 gp.param = I915_PARAM_NUM_FENCES_AVAIL; 2132 gp.param = I915_PARAM_NUM_FENCES_AVAIL;
@@ -2165,7 +2183,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
2165 /* Use the new one if available */ 2183 /* Use the new one if available */
2166 if (exec2) { 2184 if (exec2) {
2167 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2; 2185 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
2168 if (has_bsd) 2186 if (bufmgr_gem->has_bsd|bufmgr_gem->has_blt)
2169 bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2; 2187 bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
2170 } else 2188 } else
2171 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec; 2189 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;