From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 1/4] drm: Add drm_any_plane_has_format()
Date: Fri, 26 Oct 2018 13:04:21 -0700 [thread overview]
Message-ID: <e98de1d21d7e2ba550b48ab94aaa79856a44f590.camel@intel.com> (raw)
In-Reply-To: <20180309151450.20365-1-ville.syrjala@linux.intel.com>
On Fri, 2018-03-09 at 17:14 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Add a function to check whether there is at least one plane that
> supports a specific format and modifier combination. Drivers can
> use this to reject unsupported formats/modifiers in .fb_create().
>
> v2: Accept anyformat if the driver doesn't do planes (Eric)
> s/planes_have_format/any_plane_has_format/ (Eric)
> Check the modifier as well since we already have a function
> that does both
> v3: Don't do the check in the core since we may not know the
> modifier yet, instead export the function and let drivers
> call it themselves
>
> Cc: Eric Anholt <eric@anholt.net>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
I ended up writing a similar patch for i915. Having this in the core
seems better and patch still applies cleanly.
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
> drivers/gpu/drm/drm_plane.c | 23 +++++++++++++++++++++++
> include/drm/drm_mode_config.h | 6 ++++++
> include/drm/drm_plane.h | 2 ++
> 3 files changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_plane.c
> b/drivers/gpu/drm/drm_plane.c
> index a5d1fc7e8a37..3b2d6f8d889d 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -578,6 +578,29 @@ int drm_plane_check_pixel_format(struct
> drm_plane *plane,
> return 0;
> }
>
> +/**
> + * drm_any_plane_has_format - Check whether any plane supports this
> format and modifier combination
> + * @dev: DRM device
> + * @format: pixel format (DRM_FORMAT_*)
> + * @modifier: data layout modifier
> + *
> + * Returns:
> + * Whether at least one plane supports the specified format and
> modifier combination.
> + */
> +bool drm_any_plane_has_format(struct drm_device *dev,
> + u32 format, u64 modifier)
> +{
> + struct drm_plane *plane;
> +
> + drm_for_each_plane(plane, dev) {
> + if (drm_plane_check_pixel_format(plane, format,
> modifier) == 0)
> + return true;
> + }
> +
> + return false;
> +}
> +EXPORT_SYMBOL(drm_any_plane_has_format);
> +
> /*
> * __setplane_internal - setplane handler for internal callers
> *
> diff --git a/include/drm/drm_mode_config.h
> b/include/drm/drm_mode_config.h
> index 7569f22ffef6..9b894de9a75d 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -52,6 +52,12 @@ struct drm_mode_config_funcs {
> * requested metadata, but most of that is left to the driver.
> See
> * &struct drm_mode_fb_cmd2 for details.
> *
> + * To validate the pixel format and modifier drivers can use
> + * drm_any_plane_has_format() to make sure at least one plane
> supports
> + * the requested values. Note that the driver must first
> determine the
> + * actual modifier used if the request doesn't have it
> specified,
> + * ie. when (@mode_cmd->flags & DRM_MODE_FB_MODIFIERS) == 0.
> + *
> * If the parameters are deemed valid and the backing storage
> objects in
> * the underlying memory manager all exist, then the driver
> allocates
> * a new &drm_framebuffer structure, subclassed to contain
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index f7bf4a48b1c3..930e8fdd90f8 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -683,5 +683,7 @@ static inline struct drm_plane
> *drm_plane_find(struct drm_device *dev,
> #define drm_for_each_plane(plane, dev) \
> list_for_each_entry(plane, &(dev)->mode_config.plane_list,
> head)
>
> +bool drm_any_plane_has_format(struct drm_device *dev,
> + u32 format, u64 modifier);
>
> #endif
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2018-10-26 20:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 15:14 [PATCH v3 1/4] drm: Add drm_any_plane_has_format() Ville Syrjala
2018-03-09 15:14 ` [PATCH v3 2/4] drm/i915: Eliminate the horrendous format check code Ville Syrjala
2018-10-26 20:08 ` [Intel-gfx] " Dhinakaran Pandiyan
2018-03-09 15:14 ` [PATCH 3/4] drm: Fix some coding style issues Ville Syrjala
2018-03-09 15:14 ` [PATCH 4/4] drm/vc4: Validate framebuffer pixel format/modifier Ville Syrjala
2018-03-09 20:54 ` Eric Anholt
2018-03-12 15:04 ` Ville Syrjälä
2018-03-12 16:57 ` Daniel Vetter
2018-10-26 20:04 ` Dhinakaran Pandiyan [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=e98de1d21d7e2ba550b48ab94aaa79856a44f590.camel@intel.com \
--to=dhinakaran.pandiyan@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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