aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/drm/i915_drm.h5
-rw-r--r--intel/intel_bufmgr.c13
-rw-r--r--intel/intel_bufmgr.h3
-rw-r--r--intel/intel_bufmgr_gem.c34
-rw-r--r--intel/intel_bufmgr_priv.h7
5 files changed, 54 insertions, 8 deletions
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index c8cb3a67..c040afac 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -275,6 +275,7 @@ typedef struct drm_i915_irq_wait {
275#define I915_PARAM_HAS_OVERLAY 7 275#define I915_PARAM_HAS_OVERLAY 7
276#define I915_PARAM_HAS_PAGEFLIPPING 8 276#define I915_PARAM_HAS_PAGEFLIPPING 8
277#define I915_PARAM_HAS_EXECBUF2 9 277#define I915_PARAM_HAS_EXECBUF2 9
278#define I915_PARAM_HAS_BSD 10
278 279
279typedef struct drm_i915_getparam { 280typedef struct drm_i915_getparam {
280 int param; 281 int param;
@@ -616,7 +617,9 @@ struct drm_i915_gem_execbuffer2 {
616 __u32 num_cliprects; 617 __u32 num_cliprects;
617 /** This is a struct drm_clip_rect *cliprects */ 618 /** This is a struct drm_clip_rect *cliprects */
618 __u64 cliprects_ptr; 619 __u64 cliprects_ptr;
619 __u64 flags; /* currently unused */ 620#define I915_EXEC_RENDER (1 << 0)
621#define I915_EXEC_BSD (1 << 1)
622 __u64 flags;
620 __u64 rsvd1; 623 __u64 rsvd1;
621 __u64 rsvd2; 624 __u64 rsvd2;
622}; 625};
diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index 9144fdd4..2b4e8883 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -145,6 +145,19 @@ drm_intel_bo_exec(drm_intel_bo *bo, int used,
145 return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4); 145 return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4);
146} 146}
147 147
148int
149drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
150 drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
151 int ring_flag)
152{
153 if (bo->bufmgr->bo_mrb_exec)
154 return bo->bufmgr->bo_mrb_exec(bo, used,
155 cliprects, num_cliprects, DR4,
156 ring_flag);
157
158 return -ENODEV;
159}
160
148void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug) 161void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
149{ 162{
150 bufmgr->debug = enable_debug; 163 bufmgr->debug = enable_debug;
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index cbcddb65..65fd603a 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -106,6 +106,9 @@ void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug);
106void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr); 106void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr);
107int drm_intel_bo_exec(drm_intel_bo *bo, int used, 107int drm_intel_bo_exec(drm_intel_bo *bo, int used,
108 drm_clip_rect_t * cliprects, int num_cliprects, int DR4); 108 drm_clip_rect_t * cliprects, int num_cliprects, int DR4);
109int drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
110 drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
111 int ring_flag);
109int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count); 112int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);
110 113
111int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, 114int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index b76fd7ed..398c7d07 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1530,14 +1530,17 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
1530} 1530}
1531 1531
1532static int 1532static int
1533drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used, 1533drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
1534 drm_clip_rect_t *cliprects, int num_cliprects, 1534 drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
1535 int DR4) 1535 int ring_flag)
1536{ 1536{
1537 drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; 1537 drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
1538 struct drm_i915_gem_execbuffer2 execbuf; 1538 struct drm_i915_gem_execbuffer2 execbuf;
1539 int ret, i; 1539 int ret, i;
1540 1540
1541 if ((ring_flag != I915_EXEC_RENDER) && (ring_flag != I915_EXEC_BSD))
1542 return -EINVAL;
1543
1541 pthread_mutex_lock(&bufmgr_gem->lock); 1544 pthread_mutex_lock(&bufmgr_gem->lock);
1542 /* Update indices and set up the validate list. */ 1545 /* Update indices and set up the validate list. */
1543 drm_intel_gem_bo_process_reloc2(bo); 1546 drm_intel_gem_bo_process_reloc2(bo);
@@ -1555,7 +1558,7 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
1555 execbuf.num_cliprects = num_cliprects; 1558 execbuf.num_cliprects = num_cliprects;
1556 execbuf.DR1 = 0; 1559 execbuf.DR1 = 0;
1557 execbuf.DR4 = DR4; 1560 execbuf.DR4 = DR4;
1558 execbuf.flags = 0; 1561 execbuf.flags = ring_flag;
1559 execbuf.rsvd1 = 0; 1562 execbuf.rsvd1 = 0;
1560 execbuf.rsvd2 = 0; 1563 execbuf.rsvd2 = 0;
1561 1564
@@ -1597,6 +1600,16 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
1597} 1600}
1598 1601
1599static int 1602static int
1603drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
1604 drm_clip_rect_t *cliprects, int num_cliprects,
1605 int DR4)
1606{
1607 return drm_intel_gem_bo_mrb_exec2(bo, used,
1608 cliprects, num_cliprects, DR4,
1609 I915_EXEC_RENDER);
1610}
1611
1612static int
1600drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment) 1613drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment)
1601{ 1614{
1602 drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; 1615 drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
@@ -1974,7 +1987,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
1974 drm_i915_getparam_t gp; 1987 drm_i915_getparam_t gp;
1975 int ret, i; 1988 int ret, i;
1976 unsigned long size; 1989 unsigned long size;
1977 int exec2 = 0; 1990 int exec2 = 0, has_bsd = 0;
1978 1991
1979 bufmgr_gem = calloc(1, sizeof(*bufmgr_gem)); 1992 bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
1980 if (bufmgr_gem == NULL) 1993 if (bufmgr_gem == NULL)
@@ -2023,6 +2036,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
2023 if (!ret) 2036 if (!ret)
2024 exec2 = 1; 2037 exec2 = 1;
2025 2038
2039 gp.param = I915_PARAM_HAS_BSD;
2040 ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
2041 if (!ret)
2042 has_bsd = 1;
2043
2026 if (bufmgr_gem->gen < 4) { 2044 if (bufmgr_gem->gen < 4) {
2027 gp.param = I915_PARAM_NUM_FENCES_AVAIL; 2045 gp.param = I915_PARAM_NUM_FENCES_AVAIL;
2028 gp.value = &bufmgr_gem->available_fences; 2046 gp.value = &bufmgr_gem->available_fences;
@@ -2076,9 +2094,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
2076 bufmgr_gem->bufmgr.bo_set_tiling = drm_intel_gem_bo_set_tiling; 2094 bufmgr_gem->bufmgr.bo_set_tiling = drm_intel_gem_bo_set_tiling;
2077 bufmgr_gem->bufmgr.bo_flink = drm_intel_gem_bo_flink; 2095 bufmgr_gem->bufmgr.bo_flink = drm_intel_gem_bo_flink;
2078 /* Use the new one if available */ 2096 /* Use the new one if available */
2079 if (exec2) 2097 if (exec2) {
2080 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2; 2098 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
2081 else 2099 if (has_bsd)
2100 bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
2101 } else
2082 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec; 2102 bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;
2083 bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy; 2103 bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy;
2084 bufmgr_gem->bufmgr.bo_madvise = drm_intel_gem_bo_madvise; 2104 bufmgr_gem->bufmgr.bo_madvise = drm_intel_gem_bo_madvise;
diff --git a/intel/intel_bufmgr_priv.h b/intel/intel_bufmgr_priv.h
index f987d97a..87e91e7f 100644
--- a/intel/intel_bufmgr_priv.h
+++ b/intel/intel_bufmgr_priv.h
@@ -173,6 +173,13 @@ struct _drm_intel_bufmgr {
173 drm_clip_rect_t *cliprects, int num_cliprects, 173 drm_clip_rect_t *cliprects, int num_cliprects,
174 int DR4); 174 int DR4);
175 175
176 /** Executes the command buffer pointed to by bo on the selected
177 * ring buffer
178 */
179 int (*bo_mrb_exec) (drm_intel_bo *bo, int used,
180 drm_clip_rect_t *cliprects, int num_cliprects,
181 int DR4, int ring_flag);
182
176 /** 183 /**
177 * Pin a buffer to the aperture and fix the offset until unpinned 184 * Pin a buffer to the aperture and fix the offset until unpinned
178 * 185 *