summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_fb.c7
-rw-r--r--lib/ioctl_wrappers.c24
-rw-r--r--lib/ioctl_wrappers.h1
3 files changed, 21 insertions, 11 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 1bb6d324..5dca1cfa 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -913,6 +913,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
/* FIXME allow the caller to pass these in */
enum igt_color_encoding color_encoding = IGT_COLOR_YCBCR_BT709;
enum igt_color_range color_range = IGT_COLOR_YCBCR_LIMITED_RANGE;
+ uint32_t flags = 0;
fb_init(fb, fd, width, height, format, tiling,
color_encoding, color_range);
@@ -931,11 +932,13 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
igt_debug("%s(handle=%d, pitch=%d)\n",
__func__, fb->gem_handle, fb->strides[0]);
+ if (fb->tiling || igt_has_fb_modifiers(fd))
+ flags = LOCAL_DRM_MODE_FB_MODIFIERS;
+
do_or_die(__kms_addfb(fb->fd, fb->gem_handle,
fb->width, fb->height,
fb->drm_format, fb->tiling,
- fb->strides, fb->offsets, fb->num_planes,
- LOCAL_DRM_MODE_FB_MODIFIERS,
+ fb->strides, fb->offsets, fb->num_planes, flags,
&fb->fb_id));
return fb->fb_id;
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index bda9a764..9f255508 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1646,13 +1646,7 @@ void prime_sync_end(int dma_buf_fd, bool write)
do_ioctl(dma_buf_fd, LOCAL_DMA_BUF_IOCTL_SYNC, &sync_end);
}
-/**
- * igt_require_fb_modifiers:
- * @fd: Open DRM file descriptor.
- *
- * Requires presence of DRM_CAP_ADDFB2_MODIFIERS.
- */
-void igt_require_fb_modifiers(int fd)
+bool igt_has_fb_modifiers(int fd)
{
static bool has_modifiers, cap_modifiers_tested;
@@ -1666,7 +1660,18 @@ void igt_require_fb_modifiers(int fd)
cap_modifiers_tested = true;
}
- igt_require(has_modifiers);
+ return has_modifiers;
+}
+
+/**
+ * igt_require_fb_modifiers:
+ * @fd: Open DRM file descriptor.
+ *
+ * Requires presence of DRM_CAP_ADDFB2_MODIFIERS.
+ */
+void igt_require_fb_modifiers(int fd)
+{
+ igt_require(igt_has_fb_modifiers(fd));
}
int __kms_addfb(int fd, uint32_t handle,
@@ -1678,7 +1683,8 @@ int __kms_addfb(int fd, uint32_t handle,
struct drm_mode_fb_cmd2 f;
int ret, i;
- igt_require_fb_modifiers(fd);
+ if (flags & DRM_MODE_FB_MODIFIERS)
+ igt_require_fb_modifiers(fd);
memset(&f, 0, sizeof(f));
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index c4e1956c..b22b36b0 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -227,6 +227,7 @@ struct local_drm_mode_fb_cmd2 {
#define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10
+bool igt_has_fb_modifiers(int fd);
void igt_require_fb_modifiers(int fd);
/**