Files
linux/drivers/gpu/drm/i915/display/intel_gvt_api.c
Ankit Nautiyal d805e879e1 drm/i915/gvt: Change for_each_pipe to use pipe_valid API
Add a new API to check if a given pipe is valid using
DISPLAY_RUNTIME_INFO() for GVT.

Update GVT to use this API instead of accessing
`DISPLAY_RUNTIME_INFO->pipe_mask` directly in the `for_each_pipe` macro.

Since `for_each_pipe` is defined in i915/display/intel_display.h, which
also contains other macros used by gvt/display.c, we cannot drop the
intel_display.h header yet. This causes a build error because
`for_each_pipe` is included from both i915/display/intel_display.h and
gvt/display_helpers.h.

To resolve this, rename the GVT macro to `gvt_for_each_pipe` and make it
call the new API. This avoids exposing display internals and prepares for
display modularization.

v2:
 - Expose API to check if pipe is valid rather than the runtime info
   pipe mask. (Jani)
 - Rename the macro to `gvt_for_each_pipe` to resolve build error.
v3:
 - Use EXPORT_SYMBOL_NS_GPL(..., "I915_GVT"); (Jani)
 - Use enum pipe at call sites instead of casting in the macro. (Jani)

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patch.msgid.link/20251219060302.2365123-5-ankit.k.nautiyal@intel.com
2025-12-29 17:43:38 +05:30

44 lines
1.3 KiB
C

// SPDX-License-Identifier: MIT
/*
* Copyright © 2025 Intel Corporation
*/
#include <linux/types.h>
#include "intel_display_core.h"
#include "intel_display_regs.h"
#include "intel_gvt_api.h"
u32 intel_display_device_pipe_offset(struct intel_display *display, enum pipe pipe)
{
return INTEL_DISPLAY_DEVICE_PIPE_OFFSET(display, pipe);
}
EXPORT_SYMBOL_NS_GPL(intel_display_device_pipe_offset, "I915_GVT");
u32 intel_display_device_trans_offset(struct intel_display *display, enum transcoder trans)
{
return INTEL_DISPLAY_DEVICE_TRANS_OFFSET(display, trans);
}
EXPORT_SYMBOL_NS_GPL(intel_display_device_trans_offset, "I915_GVT");
u32 intel_display_device_cursor_offset(struct intel_display *display, enum pipe pipe)
{
return INTEL_DISPLAY_DEVICE_CURSOR_OFFSET(display, pipe);
}
EXPORT_SYMBOL_NS_GPL(intel_display_device_cursor_offset, "I915_GVT");
u32 intel_display_device_mmio_base(struct intel_display *display)
{
return DISPLAY_MMIO_BASE(display);
}
EXPORT_SYMBOL_NS_GPL(intel_display_device_mmio_base, "I915_GVT");
bool intel_display_device_pipe_valid(struct intel_display *display, enum pipe pipe)
{
if (pipe < PIPE_A || pipe >= I915_MAX_PIPES)
return false;
return DISPLAY_RUNTIME_INFO(display)->pipe_mask & BIT(pipe);
}
EXPORT_SYMBOL_NS_GPL(intel_display_device_pipe_valid, "I915_GVT");