mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Eric Anholt <eric@anholt.net>, dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/tinydrm: Advertise that we can do only DRM_FORMAT_MOD_LINEAR.
Date: Sat, 27 Oct 2018 18:21:46 +0200	[thread overview]
Message-ID: <ca2c2bb1-5440-860b-c713-6f3a319c12c2@tronnes.org> (raw)
In-Reply-To: <20181025162635.6689-1-eric@anholt.net>


Den 25.10.2018 18.26, skrev Eric Anholt:
> Without this, the xserver relies on what the 3D driver exposes and
> assumes that the display can handle it, and then the DRM driver
> happily tries to scan out a tiled format.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>   drivers/gpu/drm/drm_simple_kms_helper.c     | 8 ++++++++
>   drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 1 +
>   drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 6 +++++-
>   3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 51fa978f0d23..917812448d1b 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -190,6 +190,13 @@ static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
>   	pipe->funcs->cleanup_fb(pipe, state);
>   }
>   
> +static bool drm_simple_kms_format_mod_supported(struct drm_plane *plane,
> +						uint32_t format,
> +						uint64_t modifier)
> +{
> +	return modifier == DRM_FORMAT_MOD_LINEAR;
> +}
> +

I assume this also works for the other drivers that use this helper.
A quick look at the code seems to support this assumption.
Format modifiers is something I've never looked at before.

Acked-by: Noralf Trønnes <noralf@tronnes.org>

>   static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = {
>   	.prepare_fb = drm_simple_kms_plane_prepare_fb,
>   	.cleanup_fb = drm_simple_kms_plane_cleanup_fb,
> @@ -204,6 +211,7 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = {
>   	.reset			= drm_atomic_helper_plane_reset,
>   	.atomic_duplicate_state	= drm_atomic_helper_plane_duplicate_state,
>   	.atomic_destroy_state	= drm_atomic_helper_plane_destroy_state,
> +	.format_mod_supported   = drm_simple_kms_format_mod_supported,
>   };
>   
>   /**
> diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
> index 255341ee4eb9..9af51d982a33 100644
> --- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
> +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
> @@ -146,6 +146,7 @@ static int tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
>   	drm->dev_private = tdev;
>   	drm_mode_config_init(drm);
>   	drm->mode_config.funcs = &tinydrm_mode_config_funcs;
> +	drm->mode_config.allow_fb_modifiers = true;
>   
>   	return 0;
>   }
> diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> index 7e8e24d0b7a7..eacfc0ec8ff1 100644
> --- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> @@ -184,6 +184,10 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev,
>   	struct drm_display_mode mode_copy;
>   	struct drm_connector *connector;
>   	int ret;
> +	static const uint64_t modifiers[] = {
> +		DRM_FORMAT_MOD_LINEAR,
> +		DRM_FORMAT_MOD_INVALID
> +	};
>   
>   	drm_mode_copy(&mode_copy, mode);
>   	ret = tinydrm_rotate_mode(&mode_copy, rotation);
> @@ -202,6 +206,6 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev,
>   		return PTR_ERR(connector);
>   
>   	return drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats,
> -					    format_count, NULL, connector);
> +					    format_count, modifiers, connector);
>   }
>   EXPORT_SYMBOL(tinydrm_display_pipe_init);


      reply	other threads:[~2018-10-27 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25 16:26 Eric Anholt
2018-10-27 16:21 ` Noralf Trønnes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca2c2bb1-5440-860b-c713-6f3a319c12c2@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®