mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
intel/drm-shim: update shim to support DG2
We were missing : * GEM_CREATE_EXT (for local memory allocations) * MMAP_OFFSET (new version of mmap required on DG2) * GEOMETRY_SUBSLICE query (also required on DG2) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18005>
This commit is contained in:
parent
4393be8291
commit
00d8fcee10
1 changed files with 40 additions and 2 deletions
|
|
@ -109,6 +109,22 @@ i915_ioctl_gem_create(int fd, unsigned long request, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
i915_ioctl_gem_create_ext(int fd, unsigned long request, void *arg)
|
||||
{
|
||||
struct shim_fd *shim_fd = drm_shim_fd_lookup(fd);
|
||||
struct drm_i915_gem_create_ext *create = arg;
|
||||
struct i915_bo *bo = calloc(1, sizeof(*bo));
|
||||
|
||||
drm_shim_bo_init(&bo->base, create->size);
|
||||
|
||||
create->handle = drm_shim_bo_get_handle(shim_fd, &bo->base);
|
||||
|
||||
drm_shim_bo_put(&bo->base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
i915_ioctl_gem_mmap(int fd, unsigned long request, void *arg)
|
||||
{
|
||||
|
|
@ -128,6 +144,25 @@ i915_ioctl_gem_mmap(int fd, unsigned long request, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
i915_ioctl_gem_mmap_offset(int fd, unsigned long request, void *arg)
|
||||
{
|
||||
struct shim_fd *shim_fd = drm_shim_fd_lookup(fd);
|
||||
struct drm_i915_gem_mmap_offset *mmap_arg = arg;
|
||||
struct shim_bo *bo = drm_shim_bo_lookup(shim_fd, mmap_arg->handle);
|
||||
|
||||
if (!bo)
|
||||
return -1;
|
||||
|
||||
if (!bo->map)
|
||||
bo->map = drm_shim_mmap(shim_fd, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, -1,
|
||||
drm_shim_bo_get_mmap_offset(shim_fd, bo));
|
||||
|
||||
mmap_arg->offset = drm_shim_bo_get_mmap_offset(shim_fd, bo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
i915_ioctl_gem_userptr(int fd, unsigned long request, void *arg)
|
||||
{
|
||||
|
|
@ -233,7 +268,7 @@ i915_ioctl_get_param(int fd, unsigned long request, void *arg)
|
|||
return 0;
|
||||
case I915_PARAM_MMAP_VERSION:
|
||||
case I915_PARAM_MMAP_GTT_VERSION:
|
||||
*gp->value = 1;
|
||||
*gp->value = 4 /* MMAP_OFFSET support */;
|
||||
return 0;
|
||||
case I915_PARAM_SUBSLICE_TOTAL:
|
||||
*gp->value = 0;
|
||||
|
|
@ -336,7 +371,8 @@ i915_ioctl_query(int fd, unsigned long request, void *arg)
|
|||
struct drm_i915_query_item *item = &items[i];
|
||||
|
||||
switch (item->query_id) {
|
||||
case DRM_I915_QUERY_TOPOLOGY_INFO: {
|
||||
case DRM_I915_QUERY_TOPOLOGY_INFO:
|
||||
case DRM_I915_QUERY_GEOMETRY_SUBSLICES: {
|
||||
int ret = query_write_topology(item);
|
||||
if (ret)
|
||||
item->length = ret;
|
||||
|
|
@ -460,7 +496,9 @@ static ioctl_fn_t driver_ioctls[] = {
|
|||
[DRM_I915_GET_RESET_STATS] = i915_ioctl_noop,
|
||||
|
||||
[DRM_I915_GEM_CREATE] = i915_ioctl_gem_create,
|
||||
[DRM_I915_GEM_CREATE_EXT] = i915_ioctl_gem_create_ext,
|
||||
[DRM_I915_GEM_MMAP] = i915_ioctl_gem_mmap,
|
||||
[DRM_I915_GEM_MMAP_GTT] = i915_ioctl_gem_mmap_offset,
|
||||
[DRM_I915_GEM_SET_TILING] = i915_ioctl_gem_set_tiling,
|
||||
[DRM_I915_GEM_CONTEXT_CREATE] = i915_ioctl_gem_context_create,
|
||||
[DRM_I915_GEM_CONTEXT_DESTROY] = i915_ioctl_noop,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue