summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_draw.c6
-rw-r--r--lib/igt_fb.c14
-rw-r--r--lib/intel_chipset.h1
-rw-r--r--lib/intel_device_info.c14
4 files changed, 25 insertions, 10 deletions
diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index a3144b50..da1d39fc 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -339,7 +339,7 @@ static void draw_rect_mmap_cpu(int fd, struct buf_data *buf, struct rect *rect,
/* We didn't implement suport for the older tiling methods yet. */
if (tiling != I915_TILING_NONE)
- igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
+ igt_require(intel_display_ver(intel_get_drm_devid(fd)) >= 5);
ptr = gem_mmap__cpu(fd, buf->handle, 0, PAGE_ALIGN(buf->size),
PROT_READ | PROT_WRITE);
@@ -389,7 +389,7 @@ static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
/* We didn't implement suport for the older tiling methods yet. */
if (tiling != I915_TILING_NONE)
- igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
+ igt_require(intel_display_ver(intel_get_drm_devid(fd)) >= 5);
ptr = gem_mmap__wc(fd, buf->handle, 0, PAGE_ALIGN(buf->size),
PROT_READ | PROT_WRITE);
@@ -440,7 +440,7 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf,
int pixels_written = 0;
/* We didn't implement suport for the older tiling methods yet. */
- igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
+ igt_require(intel_display_ver(intel_get_drm_devid(fd)) >= 5);
pixel_size = buf->bpp / 8;
tmp_size = sizeof(tmp) / pixel_size;
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 3e6841fd..585ede38 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -408,7 +408,7 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
break;
case LOCAL_I915_FORMAT_MOD_X_TILED:
igt_require_intel(fd);
- if (intel_gen(intel_get_drm_devid(fd)) == 2) {
+ if (intel_display_ver(intel_get_drm_devid(fd)) == 2) {
*width_ret = 128;
*height_ret = 16;
} else {
@@ -422,7 +422,7 @@ void igt_get_fb_tile_size(int fd, uint64_t modifier, int fb_bpp,
case LOCAL_I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
case LOCAL_I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
igt_require_intel(fd);
- if (intel_gen(intel_get_drm_devid(fd)) == 2) {
+ if (intel_display_ver(intel_get_drm_devid(fd)) == 2) {
*width_ret = 128;
*height_ret = 16;
} else if (IS_915(intel_get_drm_devid(fd))) {
@@ -693,7 +693,7 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
if (fb->modifier != LOCAL_DRM_FORMAT_MOD_NONE &&
is_i915_device(fb->fd) &&
- intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
+ intel_display_ver(intel_get_drm_devid(fb->fd)) <= 3) {
uint32_t stride;
/* Round the tiling up to the next power-of-two and the region
@@ -758,7 +758,7 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
{
if (fb->modifier != LOCAL_DRM_FORMAT_MOD_NONE &&
is_i915_device(fb->fd) &&
- intel_gen(intel_get_drm_devid(fb->fd)) <= 3) {
+ intel_display_ver(intel_get_drm_devid(fb->fd)) <= 3) {
uint64_t min_size = (uint64_t) fb->strides[plane] *
fb->plane_height[plane];
uint64_t size;
@@ -2118,12 +2118,12 @@ struct fb_blit_upload {
static bool fast_blit_ok(const struct igt_fb *fb)
{
- int gen = intel_gen(intel_get_drm_devid(fb->fd));
+ int ver = intel_display_ver(intel_get_drm_devid(fb->fd));
- if (gen < 9)
+ if (ver < 9)
return false;
- if (gen < 12)
+ if (ver < 12)
return true;
return fb->modifier != I915_FORMAT_MOD_X_TILED;
diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index 8e81ffa9..87b3bbc4 100644
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -84,6 +84,7 @@ struct intel_device_info {
const struct intel_device_info *intel_get_device_info(uint16_t devid) __attribute__((pure));
unsigned intel_gen(uint16_t devid) __attribute__((pure));
+unsigned intel_display_ver(uint16_t devid) __attribute__((pure));
extern enum pch_type intel_pch;
diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
index 4ab236e4..0c09f5cd 100644
--- a/lib/intel_device_info.c
+++ b/lib/intel_device_info.c
@@ -535,3 +535,17 @@ unsigned intel_gen(uint16_t devid)
{
return intel_get_device_info(devid)->graphics_ver ?: -1u;
}
+
+/**
+ * intel_display_ver:
+ * @devid: pci device id
+ *
+ * Computes the Intel GFX display version for the given device id.
+ *
+ * Returns:
+ * The display version on successful lookup, -1u on failure.
+ */
+unsigned intel_display_ver(uint16_t devid)
+{
+ return intel_get_device_info(devid)->display_ver ?: -1u;
+}