[igt-dev] [PATCH i-g-t] lib/igt_fb: Require FB modifiers only when needed
Ville Syrjälä
ville.syrjala at linux.intel.com
Fri Oct 12 12:17:23 UTC 2018
On Thu, Oct 11, 2018 at 06:17:36PM -0400, sunpeng.li at amd.com wrote:
> 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;
> +
Check out the discussion at
https://lists.freedesktop.org/archives/igt-dev/2018-October/006282.html
At least I like Daniel's suggestion there.
>
> 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
>
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Ville Syrjälä
Intel
More information about the igt-dev
mailing list