[igt-dev] [PATCH i-g-t] lib/igt_fb: Require FB modifiers only when needed

sunpeng.li at amd.com sunpeng.li at amd.com
Thu Oct 11 22:17:36 UTC 2018


From: Leo Li <sunpeng.li at amd.com>

AMDGPU doesn't have modifier support. However, __kms_addfb requests
modifier support on all calls to igt_create_fb_with_bo_size.

Therefore, don't request modifier support if not needed.

Signed-off-by: Leo Li <sunpeng.li at amd.com>
---
 lib/igt_fb.c         | 8 +++++++-
 lib/ioctl_wrappers.c | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 35be2e8..3253236 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -913,6 +913,12 @@ 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;
+
+	if (tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	    tiling != LOCAL_I915_FORMAT_MOD_X_TILED)
+		flags = LOCAL_DRM_MODE_FB_MODIFIERS;
+
 
 	fb_init(fb, fd, width, height, format, tiling,
 		color_encoding, color_range);
@@ -935,7 +941,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 			      fb->width, fb->height,
 			      fb->drm_format, fb->tiling,
 			      fb->strides, fb->offsets, fb->num_planes,
-			      LOCAL_DRM_MODE_FB_MODIFIERS,
+			      flags,
 			      &fb->fb_id));
 
 	return fb->fb_id;
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 0929c43..017314a 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1678,7 +1678,8 @@ int __kms_addfb(int fd, uint32_t handle,
 	struct drm_mode_fb_cmd2 f;
 	int ret, i;
 
-	igt_require_fb_modifiers(fd);
+	if (modifier)
+		igt_require_fb_modifiers(fd);
 
 	memset(&f, 0, sizeof(f));
 
-- 
2.7.4



More information about the igt-dev mailing list