intel/i915: add i915_gem_execbuf_ioctl()
Unify the common code for i915.ko execbuf submission between Iris and Anv. I plan to add more code to this function in the next patches. Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37559>
This commit is contained in:
@@ -293,7 +293,8 @@ i915_batch_check_for_reset(struct iris_batch *batch)
|
||||
static int
|
||||
i915_batch_submit(struct iris_batch *batch)
|
||||
{
|
||||
struct iris_bufmgr *bufmgr = batch->screen->bufmgr;
|
||||
struct iris_screen *screen = batch->screen;
|
||||
struct iris_bufmgr *bufmgr = screen->bufmgr;
|
||||
simple_mtx_t *bo_deps_lock = iris_bufmgr_get_bo_deps_lock(bufmgr);
|
||||
|
||||
iris_bo_unmap(batch->bo);
|
||||
@@ -318,7 +319,7 @@ i915_batch_submit(struct iris_batch *batch)
|
||||
} else {
|
||||
uint32_t flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
|
||||
flags |= bo->real.capture ? EXEC_OBJECT_CAPTURE : 0;
|
||||
flags |= bo == batch->screen->workaround_bo ? EXEC_OBJECT_ASYNC : 0;
|
||||
flags |= bo == screen->workaround_bo ? EXEC_OBJECT_ASYNC : 0;
|
||||
flags |= iris_bo_is_external(bo) ? 0 : EXEC_OBJECT_ASYNC;
|
||||
flags |= written ? EXEC_OBJECT_WRITE : 0;
|
||||
|
||||
@@ -386,15 +387,9 @@ i915_batch_submit(struct iris_batch *batch)
|
||||
(uintptr_t)util_dynarray_begin(&batch->exec_fences);
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
if (likely(!batch->screen->devinfo->no_hw)) {
|
||||
do {
|
||||
ret = intel_ioctl(batch->screen->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
|
||||
} while (ret && errno == ENOMEM);
|
||||
|
||||
if (ret)
|
||||
ret = -errno;
|
||||
}
|
||||
int ret = i915_gem_execbuf_ioctl(screen->fd, screen->devinfo, &execbuf);
|
||||
if (ret)
|
||||
ret = -errno;
|
||||
|
||||
simple_mtx_unlock(bo_deps_lock);
|
||||
|
||||
|
||||
@@ -140,3 +140,21 @@ intel_i915_gem_add_ext(__u64 *ptr, uint32_t ext_name,
|
||||
|
||||
*iter = (uintptr_t) ext;
|
||||
}
|
||||
|
||||
static inline int
|
||||
i915_gem_execbuf_ioctl(int fd, const struct intel_device_info *info,
|
||||
struct drm_i915_gem_execbuffer2 *execbuf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
assert((execbuf->flags & I915_EXEC_FENCE_OUT) == 0);
|
||||
|
||||
if (unlikely(info->no_hw))
|
||||
return 0;
|
||||
|
||||
do {
|
||||
ret = intel_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
|
||||
} while (ret && errno == ENOMEM);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common/i915/intel_gem.h"
|
||||
#include "i915/anv_batch_chain.h"
|
||||
#include "anv_private.h"
|
||||
#include "anv_measure.h"
|
||||
@@ -677,17 +678,8 @@ anv_gem_execbuffer_impl(struct anv_queue *queue,
|
||||
const char *func, int line)
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
int ret;
|
||||
|
||||
assert((execbuf->flags & I915_EXEC_FENCE_OUT) == 0);
|
||||
|
||||
if (unlikely(device->info->no_hw))
|
||||
return VK_SUCCESS;
|
||||
|
||||
do {
|
||||
ret = intel_ioctl(device->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, execbuf);
|
||||
} while (ret && errno == ENOMEM);
|
||||
|
||||
int ret = i915_gem_execbuf_ioctl(device->fd, device->info, execbuf);
|
||||
if (ret)
|
||||
return vk_queue_set_lost(&queue->vk, "%s(%d) failed: %m", func, line);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user