sync with OpenBSD -current
This commit is contained in:
parent
ee68147dcd
commit
1cefe29c7e
1651 changed files with 283292 additions and 68089 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <drm/drm_fourcc.h>
|
||||
|
||||
#include "display/intel_display.h"
|
||||
#include "gem/i915_gem_ioctls.h"
|
||||
#include "gem/i915_gem_lmem.h"
|
||||
#include "gem/i915_gem_region.h"
|
||||
|
@ -143,7 +144,8 @@ object_free:
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new object using the same path as DRM_I915_GEM_CREATE_EXT
|
||||
* __i915_gem_object_create_user - Creates a new object using the same path as
|
||||
* DRM_I915_GEM_CREATE_EXT
|
||||
* @i915: i915 private
|
||||
* @size: size of the buffer, in bytes
|
||||
* @placements: possible placement regions, in priority order
|
||||
|
@ -188,12 +190,12 @@ i915_gem_dumb_create(struct drm_file *file,
|
|||
}
|
||||
|
||||
/* have to work out size/pitch and return them */
|
||||
args->pitch = roundup2(args->width * cpp, 64);
|
||||
args->pitch = ALIGN(args->width * cpp, 64);
|
||||
|
||||
/* align stride to page size so that we can remap */
|
||||
if (args->pitch > intel_plane_fb_max_stride(to_i915(dev), format,
|
||||
DRM_FORMAT_MOD_LINEAR))
|
||||
args->pitch = roundup2(args->pitch, 4096);
|
||||
args->pitch = ALIGN(args->pitch, 4096);
|
||||
|
||||
if (args->pitch < args->width)
|
||||
return -EINVAL;
|
||||
|
@ -214,7 +216,7 @@ i915_gem_dumb_create(struct drm_file *file,
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new mm object and returns a handle to it.
|
||||
* i915_gem_create_ioctl - Creates a new mm object and returns a handle to it.
|
||||
* @dev: drm device pointer
|
||||
* @data: ioctl data blob
|
||||
* @file: drm file pointer
|
||||
|
@ -243,6 +245,7 @@ struct create_ext {
|
|||
unsigned int n_placements;
|
||||
unsigned int placement_mask;
|
||||
unsigned long flags;
|
||||
unsigned int pat_index;
|
||||
};
|
||||
|
||||
static void repr_placements(char *buf, size_t size,
|
||||
|
@ -384,7 +387,7 @@ static int ext_set_protected(struct i915_user_extension __user *base, void *data
|
|||
if (ext.flags)
|
||||
return -EINVAL;
|
||||
|
||||
if (!intel_pxp_is_enabled(&to_gt(ext_data->i915)->pxp))
|
||||
if (!intel_pxp_is_enabled(ext_data->i915->pxp))
|
||||
return -ENODEV;
|
||||
|
||||
ext_data->flags |= I915_BO_PROTECTED;
|
||||
|
@ -392,13 +395,45 @@ static int ext_set_protected(struct i915_user_extension __user *base, void *data
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ext_set_pat(struct i915_user_extension __user *base, void *data)
|
||||
{
|
||||
struct create_ext *ext_data = data;
|
||||
struct drm_i915_private *i915 = ext_data->i915;
|
||||
struct drm_i915_gem_create_ext_set_pat ext;
|
||||
unsigned int max_pat_index;
|
||||
|
||||
BUILD_BUG_ON(sizeof(struct drm_i915_gem_create_ext_set_pat) !=
|
||||
offsetofend(struct drm_i915_gem_create_ext_set_pat, rsvd));
|
||||
|
||||
/* Limiting the extension only to Meteor Lake */
|
||||
if (!IS_METEORLAKE(i915))
|
||||
return -ENODEV;
|
||||
|
||||
if (copy_from_user(&ext, base, sizeof(ext)))
|
||||
return -EFAULT;
|
||||
|
||||
max_pat_index = INTEL_INFO(i915)->max_pat_index;
|
||||
|
||||
if (ext.pat_index > max_pat_index) {
|
||||
drm_dbg(&i915->drm, "PAT index is invalid: %u\n",
|
||||
ext.pat_index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ext_data->pat_index = ext.pat_index;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const i915_user_extension_fn create_extensions[] = {
|
||||
[I915_GEM_CREATE_EXT_MEMORY_REGIONS] = ext_set_placements,
|
||||
[I915_GEM_CREATE_EXT_PROTECTED_CONTENT] = ext_set_protected,
|
||||
[I915_GEM_CREATE_EXT_SET_PAT] = ext_set_pat,
|
||||
};
|
||||
|
||||
#define PAT_INDEX_NOT_SET 0xffff
|
||||
/**
|
||||
* Creates a new mm object and returns a handle to it.
|
||||
* i915_gem_create_ext_ioctl - Creates a new mm object and returns a handle to it.
|
||||
* @dev: drm device pointer
|
||||
* @data: ioctl data blob
|
||||
* @file: drm file pointer
|
||||
|
@ -416,6 +451,7 @@ i915_gem_create_ext_ioctl(struct drm_device *dev, void *data,
|
|||
if (args->flags & ~I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS)
|
||||
return -EINVAL;
|
||||
|
||||
ext_data.pat_index = PAT_INDEX_NOT_SET;
|
||||
ret = i915_user_extensions(u64_to_user_ptr(args->extensions),
|
||||
create_extensions,
|
||||
ARRAY_SIZE(create_extensions),
|
||||
|
@ -452,5 +488,11 @@ i915_gem_create_ext_ioctl(struct drm_device *dev, void *data,
|
|||
if (IS_ERR(obj))
|
||||
return PTR_ERR(obj);
|
||||
|
||||
if (ext_data.pat_index != PAT_INDEX_NOT_SET) {
|
||||
i915_gem_object_set_pat_index(obj, ext_data.pat_index);
|
||||
/* Mark pat_index is set by UMD */
|
||||
obj->pat_set_by_user = true;
|
||||
}
|
||||
|
||||
return i915_gem_publish(obj, file, &args->size, &args->handle);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue