intel: Add and use intel_gem_get_context_param()

Again sharing the same function across all Intel drivers.

There is still two additional DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM
calls, one in intel/dev and other in perf.
The first one can't call intel_gem_get_context_param() because of the
build order of libs and the second one because it sets the size
parameter.

Will revisit those calls in future but this is already an improvement.

v2:
- using intel_gem_get_context_param() for the recently added query for
I915_CONTEXT_PARAM_PROTECTED_CONTENT

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18974>
This commit is contained in:
José Roberto de Souza
2022-10-05 09:41:10 -07:00
committed by Marge Bot
parent 39486661e9
commit fd14fcb9f9
4 changed files with 33 additions and 25 deletions
+14
View File
@@ -173,6 +173,20 @@ intel_gem_set_context_param(int fd, uint32_t context, uint32_t param,
return intel_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &p) == 0;
}
bool
intel_gem_get_context_param(int fd, uint32_t context, uint32_t param,
uint64_t *value)
{
struct drm_i915_gem_context_param gp = {
.ctx_id = context,
.param = param,
};
if (intel_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &gp))
return false;
*value = gp.value;
return true;
}
bool intel_gem_read_render_timestamp(int fd, uint64_t *value)
{
struct drm_i915_reg_read reg_read = {
+3
View File
@@ -169,6 +169,9 @@ intel_gem_create_context_engines(int fd,
bool
intel_gem_set_context_param(int fd, uint32_t context, uint32_t param,
uint64_t value);
bool
intel_gem_get_context_param(int fd, uint32_t context, uint32_t param,
uint64_t *value);
bool intel_gem_read_render_timestamp(int fd, uint64_t *value);