[PATCH 2/5] drm/i915/overlay: add intel_overlay_available() and use it
Rodrigo Vivi
rodrigo.vivi at intel.com
Thu Nov 14 17:51:20 UTC 2024
On Mon, Nov 11, 2024 at 07:53:31PM +0200, Jani Nikula wrote:
> Avoid accessing struct intel_display members directly from
> i915_getparam_ioctl(). Add intel_overlay_available() function to provide
> the information for I915_PARAM_HAS_OVERLAY.
>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_overlay.c | 5 +++++
> drivers/gpu/drm/i915/display/intel_overlay.h | 5 +++++
> drivers/gpu/drm/i915/i915_getparam.c | 5 +++--
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
> index 57eaf81651c4..ca30fff61876 100644
> --- a/drivers/gpu/drm/i915/display/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/display/intel_overlay.c
> @@ -1438,6 +1438,11 @@ void intel_overlay_setup(struct intel_display *display)
> kfree(overlay);
> }
>
> +bool intel_overlay_available(struct intel_display *display)
> +{
> + return display->overlay;
> +}
> +
> void intel_overlay_cleanup(struct intel_display *display)
> {
> struct intel_overlay *overlay;
> diff --git a/drivers/gpu/drm/i915/display/intel_overlay.h b/drivers/gpu/drm/i915/display/intel_overlay.h
> index dc885edf39e6..45a42fce754e 100644
> --- a/drivers/gpu/drm/i915/display/intel_overlay.h
> +++ b/drivers/gpu/drm/i915/display/intel_overlay.h
> @@ -18,6 +18,7 @@ struct intel_overlay_snapshot;
>
> #ifdef I915
> void intel_overlay_setup(struct intel_display *display);
> +bool intel_overlay_available(struct intel_display *display);
> void intel_overlay_cleanup(struct intel_display *display);
> int intel_overlay_switch_off(struct intel_overlay *overlay);
> int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
> @@ -29,6 +30,10 @@ void intel_overlay_reset(struct intel_display *display);
> static inline void intel_overlay_setup(struct intel_display *display)
> {
> }
> +static inline bool intel_overlay_available(struct intel_display *display)
> +{
> + return false;
> +}
> static inline void intel_overlay_cleanup(struct intel_display *display)
> {
> }
> diff --git a/drivers/gpu/drm/i915/i915_getparam.c b/drivers/gpu/drm/i915/i915_getparam.c
> index a62405787e77..be8149e46281 100644
> --- a/drivers/gpu/drm/i915/i915_getparam.c
> +++ b/drivers/gpu/drm/i915/i915_getparam.c
> @@ -2,9 +2,9 @@
> * SPDX-License-Identifier: MIT
> */
>
> +#include "display/intel_overlay.h"
> #include "gem/i915_gem_mman.h"
> #include "gt/intel_engine_user.h"
> -
> #include "pxp/intel_pxp.h"
>
> #include "i915_cmd_parser.h"
> @@ -16,6 +16,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file_priv)
> {
> struct drm_i915_private *i915 = to_i915(dev);
> + struct intel_display *display = &i915->display;
> struct pci_dev *pdev = to_pci_dev(dev->dev);
> const struct sseu_dev_info *sseu = &to_gt(i915)->info.sseu;
> drm_i915_getparam_t *param = data;
> @@ -38,7 +39,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
> value = to_gt(i915)->ggtt->num_fences;
> break;
> case I915_PARAM_HAS_OVERLAY:
> - value = !!i915->display.overlay;
> + value = intel_overlay_available(display);
> break;
> case I915_PARAM_HAS_BSD:
> value = !!intel_engine_lookup_user(i915,
> --
> 2.39.5
>
More information about the Intel-gfx
mailing list