intel: Add support for kernel multi-ringbuffer API.
This introduces a new API to exec on BSD ring buffer, for H.264 VLD decoding. Signed-off-by: Xiang Hai hao <haihao.xiang@intel.com> Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>main
parent
73a42a6452
commit
66375fd6e8
|
@ -275,6 +275,7 @@ typedef struct drm_i915_irq_wait {
|
||||||
#define I915_PARAM_HAS_OVERLAY 7
|
#define I915_PARAM_HAS_OVERLAY 7
|
||||||
#define I915_PARAM_HAS_PAGEFLIPPING 8
|
#define I915_PARAM_HAS_PAGEFLIPPING 8
|
||||||
#define I915_PARAM_HAS_EXECBUF2 9
|
#define I915_PARAM_HAS_EXECBUF2 9
|
||||||
|
#define I915_PARAM_HAS_BSD 10
|
||||||
|
|
||||||
typedef struct drm_i915_getparam {
|
typedef struct drm_i915_getparam {
|
||||||
int param;
|
int param;
|
||||||
|
@ -616,7 +617,9 @@ struct drm_i915_gem_execbuffer2 {
|
||||||
__u32 num_cliprects;
|
__u32 num_cliprects;
|
||||||
/** This is a struct drm_clip_rect *cliprects */
|
/** This is a struct drm_clip_rect *cliprects */
|
||||||
__u64 cliprects_ptr;
|
__u64 cliprects_ptr;
|
||||||
__u64 flags; /* currently unused */
|
#define I915_EXEC_RENDER (1 << 0)
|
||||||
|
#define I915_EXEC_BSD (1 << 1)
|
||||||
|
__u64 flags;
|
||||||
__u64 rsvd1;
|
__u64 rsvd1;
|
||||||
__u64 rsvd2;
|
__u64 rsvd2;
|
||||||
};
|
};
|
||||||
|
|
|
@ -145,6 +145,19 @@ drm_intel_bo_exec(drm_intel_bo *bo, int used,
|
||||||
return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4);
|
return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
|
||||||
|
drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
|
||||||
|
int ring_flag)
|
||||||
|
{
|
||||||
|
if (bo->bufmgr->bo_mrb_exec)
|
||||||
|
return bo->bufmgr->bo_mrb_exec(bo, used,
|
||||||
|
cliprects, num_cliprects, DR4,
|
||||||
|
ring_flag);
|
||||||
|
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
|
void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
|
||||||
{
|
{
|
||||||
bufmgr->debug = enable_debug;
|
bufmgr->debug = enable_debug;
|
||||||
|
|
|
@ -106,6 +106,9 @@ void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug);
|
||||||
void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr);
|
void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr);
|
||||||
int drm_intel_bo_exec(drm_intel_bo *bo, int used,
|
int drm_intel_bo_exec(drm_intel_bo *bo, int used,
|
||||||
drm_clip_rect_t * cliprects, int num_cliprects, int DR4);
|
drm_clip_rect_t * cliprects, int num_cliprects, int DR4);
|
||||||
|
int drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
|
||||||
|
drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
|
||||||
|
int ring_flag);
|
||||||
int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);
|
int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);
|
||||||
|
|
||||||
int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
|
int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
|
||||||
|
|
|
@ -1530,14 +1530,17 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
|
drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
|
||||||
drm_clip_rect_t *cliprects, int num_cliprects,
|
drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
|
||||||
int DR4)
|
int ring_flag)
|
||||||
{
|
{
|
||||||
drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
|
drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
|
||||||
struct drm_i915_gem_execbuffer2 execbuf;
|
struct drm_i915_gem_execbuffer2 execbuf;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
|
if ((ring_flag != I915_EXEC_RENDER) && (ring_flag != I915_EXEC_BSD))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
pthread_mutex_lock(&bufmgr_gem->lock);
|
pthread_mutex_lock(&bufmgr_gem->lock);
|
||||||
/* Update indices and set up the validate list. */
|
/* Update indices and set up the validate list. */
|
||||||
drm_intel_gem_bo_process_reloc2(bo);
|
drm_intel_gem_bo_process_reloc2(bo);
|
||||||
|
@ -1555,7 +1558,7 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
|
||||||
execbuf.num_cliprects = num_cliprects;
|
execbuf.num_cliprects = num_cliprects;
|
||||||
execbuf.DR1 = 0;
|
execbuf.DR1 = 0;
|
||||||
execbuf.DR4 = DR4;
|
execbuf.DR4 = DR4;
|
||||||
execbuf.flags = 0;
|
execbuf.flags = ring_flag;
|
||||||
execbuf.rsvd1 = 0;
|
execbuf.rsvd1 = 0;
|
||||||
execbuf.rsvd2 = 0;
|
execbuf.rsvd2 = 0;
|
||||||
|
|
||||||
|
@ -1596,6 +1599,16 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
|
||||||
|
drm_clip_rect_t *cliprects, int num_cliprects,
|
||||||
|
int DR4)
|
||||||
|
{
|
||||||
|
return drm_intel_gem_bo_mrb_exec2(bo, used,
|
||||||
|
cliprects, num_cliprects, DR4,
|
||||||
|
I915_EXEC_RENDER);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment)
|
drm_intel_gem_bo_pin(drm_intel_bo *bo, uint32_t alignment)
|
||||||
{
|
{
|
||||||
|
@ -1974,7 +1987,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
|
||||||
drm_i915_getparam_t gp;
|
drm_i915_getparam_t gp;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
int exec2 = 0;
|
int exec2 = 0, has_bsd = 0;
|
||||||
|
|
||||||
bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
|
bufmgr_gem = calloc(1, sizeof(*bufmgr_gem));
|
||||||
if (bufmgr_gem == NULL)
|
if (bufmgr_gem == NULL)
|
||||||
|
@ -2023,6 +2036,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
exec2 = 1;
|
exec2 = 1;
|
||||||
|
|
||||||
|
gp.param = I915_PARAM_HAS_BSD;
|
||||||
|
ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
|
||||||
|
if (!ret)
|
||||||
|
has_bsd = 1;
|
||||||
|
|
||||||
if (bufmgr_gem->gen < 4) {
|
if (bufmgr_gem->gen < 4) {
|
||||||
gp.param = I915_PARAM_NUM_FENCES_AVAIL;
|
gp.param = I915_PARAM_NUM_FENCES_AVAIL;
|
||||||
gp.value = &bufmgr_gem->available_fences;
|
gp.value = &bufmgr_gem->available_fences;
|
||||||
|
@ -2076,9 +2094,11 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
|
||||||
bufmgr_gem->bufmgr.bo_set_tiling = drm_intel_gem_bo_set_tiling;
|
bufmgr_gem->bufmgr.bo_set_tiling = drm_intel_gem_bo_set_tiling;
|
||||||
bufmgr_gem->bufmgr.bo_flink = drm_intel_gem_bo_flink;
|
bufmgr_gem->bufmgr.bo_flink = drm_intel_gem_bo_flink;
|
||||||
/* Use the new one if available */
|
/* Use the new one if available */
|
||||||
if (exec2)
|
if (exec2) {
|
||||||
bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
|
bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
|
||||||
else
|
if (has_bsd)
|
||||||
|
bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
|
||||||
|
} else
|
||||||
bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;
|
bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;
|
||||||
bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy;
|
bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy;
|
||||||
bufmgr_gem->bufmgr.bo_madvise = drm_intel_gem_bo_madvise;
|
bufmgr_gem->bufmgr.bo_madvise = drm_intel_gem_bo_madvise;
|
||||||
|
|
|
@ -173,6 +173,13 @@ struct _drm_intel_bufmgr {
|
||||||
drm_clip_rect_t *cliprects, int num_cliprects,
|
drm_clip_rect_t *cliprects, int num_cliprects,
|
||||||
int DR4);
|
int DR4);
|
||||||
|
|
||||||
|
/** Executes the command buffer pointed to by bo on the selected
|
||||||
|
* ring buffer
|
||||||
|
*/
|
||||||
|
int (*bo_mrb_exec) (drm_intel_bo *bo, int used,
|
||||||
|
drm_clip_rect_t *cliprects, int num_cliprects,
|
||||||
|
int DR4, int ring_flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pin a buffer to the aperture and fix the offset until unpinned
|
* Pin a buffer to the aperture and fix the offset until unpinned
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue