aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff McGee2015-03-09 18:13:03 -0500
committerDamien Lespiau2015-03-18 13:15:37 -0500
commitd556e068a7e4e9dfb57514244ae5f3e0eb9d0b39 (patch)
tree0013e8fe47f86c010434ff4ec099545487590f7d
parentd20413a7ce5816abe1127ffffc5bcab82f268c16 (diff)
downloadexternal-libgbm-d556e068a7e4e9dfb57514244ae5f3e0eb9d0b39.tar.gz
external-libgbm-d556e068a7e4e9dfb57514244ae5f3e0eb9d0b39.tar.xz
external-libgbm-d556e068a7e4e9dfb57514244ae5f3e0eb9d0b39.zip
intel: Export total subslice and EU counts
Update kernel interface with new I915_GETPARAM ioctl entries for subslice total and EU total. Add a wrapping function for each parameter. Userspace drivers need these values when constructing GPGPU commands. This kernel query method is intended to replace the PCI ID-based tables that userspace drivers currently maintain. The kernel driver can employ fuse register reads as needed to ensure the most accurate determination of GT config attributes. This first became important with Cherryview in which the config could differ between devices with the same PCI ID. The kernel detection of these values is device-specific. Userspace drivers should continue to maintain ID-based tables for older devices which return ENODEV when using this query. v2: remove unnecessary include of <stdbool.h> and increment the I915_GETPARAM indices to match updated kernel patch. For: VIZ-4636 Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeff McGee <jeff.mcgee@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
-rw-r--r--include/drm/i915_drm.h2
-rw-r--r--intel/intel_bufmgr.h3
-rw-r--r--intel/intel_bufmgr_gem.c31
3 files changed, 36 insertions, 0 deletions
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 15dd01d4..b037e569 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -340,6 +340,8 @@ typedef struct drm_i915_irq_wait {
340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
341#define I915_PARAM_HAS_WT 27 341#define I915_PARAM_HAS_WT 27
342#define I915_PARAM_CMD_PARSER_VERSION 28 342#define I915_PARAM_CMD_PARSER_VERSION 28
343#define I915_PARAM_SUBSLICE_TOTAL 33
344#define I915_PARAM_EU_TOTAL 34
343 345
344typedef struct drm_i915_getparam { 346typedef struct drm_i915_getparam {
345 int param; 347 int param;
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index be83a56a..285919e4 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -264,6 +264,9 @@ int drm_intel_get_reset_stats(drm_intel_context *ctx,
264 uint32_t *active, 264 uint32_t *active,
265 uint32_t *pending); 265 uint32_t *pending);
266 266
267int drm_intel_get_subslice_total(int fd, unsigned int *subslice_total);
268int drm_intel_get_eu_total(int fd, unsigned int *eu_total);
269
267/** @{ Compatibility defines to keep old code building despite the symbol rename 270/** @{ Compatibility defines to keep old code building despite the symbol rename
268 * from dri_* to drm_intel_* 271 * from dri_* to drm_intel_*
269 */ 272 */
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index acbfd4ad..5a67f53a 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -3295,6 +3295,37 @@ drm_intel_reg_read(drm_intel_bufmgr *bufmgr,
3295 return ret; 3295 return ret;
3296} 3296}
3297 3297
3298drm_public int
3299drm_intel_get_subslice_total(int fd, unsigned int *subslice_total)
3300{
3301 drm_i915_getparam_t gp;
3302 int ret;
3303
3304 memclear(gp);
3305 gp.value = (int*)subslice_total;
3306 gp.param = I915_PARAM_SUBSLICE_TOTAL;
3307 ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
3308 if (ret)
3309 return -errno;
3310
3311 return 0;
3312}
3313
3314drm_public int
3315drm_intel_get_eu_total(int fd, unsigned int *eu_total)
3316{
3317 drm_i915_getparam_t gp;
3318 int ret;
3319
3320 memclear(gp);
3321 gp.value = (int*)eu_total;
3322 gp.param = I915_PARAM_EU_TOTAL;
3323 ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
3324 if (ret)
3325 return -errno;
3326
3327 return 0;
3328}
3298 3329
3299/** 3330/**
3300 * Annotate the given bo for use in aub dumping. 3331 * Annotate the given bo for use in aub dumping.