On 12/15/2025 5:30 PM, Jani Nikula wrote:
On Mon, 15 Dec 2025, Ankit Nautiyal <[email protected]> wrote:
Add a new API to get pipe_mask from DISPLAY_RUNTIME_INFO() for GVT.
Update the for_each_pipe() macro in GVT to call this API, instead of
accessing DISPLAY_RUNTIME_INFO()->pipe_mask directly.

This keeps the macro usable in GVT without exposing display internals
and prepares for display modularization.

Signed-off-by: Ankit Nautiyal <[email protected]>
---
  drivers/gpu/drm/i915/display/intel_gvt_api.c | 6 ++++++
  drivers/gpu/drm/i915/display/intel_gvt_api.h | 1 +
  drivers/gpu/drm/i915/gvt/display_helpers.h   | 7 +++++++
  3 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_gvt_api.c 
b/drivers/gpu/drm/i915/display/intel_gvt_api.c
index 8abea318fbc2..0b09bbf2c29a 100644
--- a/drivers/gpu/drm/i915/display/intel_gvt_api.c
+++ b/drivers/gpu/drm/i915/display/intel_gvt_api.c
@@ -32,3 +32,9 @@ u32 intel_display_device_mmio_base(struct intel_display 
*display)
        return DISPLAY_MMIO_BASE(display);
  }
  EXPORT_SYMBOL_GPL(intel_display_device_mmio_base);
+
+u8 intel_display_runtime_info_pipe_mask(struct intel_display *display)
+{
+       return DISPLAY_RUNTIME_INFO(display)->pipe_mask;
+}
I don't think gvt needs to know it's about "runtime info". Maybe make it
just intel_display_device_pipe_mask()?

Makes sense.



Though I'm also wondering about making it even more abstracted with
something like intel_display_device_pipe_valid(), and using that for the
various other cases that check pipes in GVT. But maybe the patch at hand
is a good start.


I agree this can be further abstracted. I can try that stuff and see how much change it might require.

Thanks Jani, for the suggestions and for the reviews.


Regards,

Ankit


+EXPORT_SYMBOL_GPL(intel_display_runtime_info_pipe_mask);
diff --git a/drivers/gpu/drm/i915/display/intel_gvt_api.h 
b/drivers/gpu/drm/i915/display/intel_gvt_api.h
index e9a1122a988d..8ceda30a969b 100644
--- a/drivers/gpu/drm/i915/display/intel_gvt_api.h
+++ b/drivers/gpu/drm/i915/display/intel_gvt_api.h
@@ -16,5 +16,6 @@ u32 intel_display_device_pipe_offset(struct intel_display 
*display, enum pipe pi
  u32 intel_display_device_trans_offset(struct intel_display *display, enum 
transcoder trans);
  u32 intel_display_device_cursor_offset(struct intel_display *display, enum 
pipe pipe);
  u32 intel_display_device_mmio_base(struct intel_display *display);
+u8 intel_display_runtime_info_pipe_mask(struct intel_display *display);
#endif /* __INTEL_GVT_API_H__ */
diff --git a/drivers/gpu/drm/i915/gvt/display_helpers.h 
b/drivers/gpu/drm/i915/gvt/display_helpers.h
index 6f68a1e8751a..d11ebb03b946 100644
--- a/drivers/gpu/drm/i915/gvt/display_helpers.h
+++ b/drivers/gpu/drm/i915/gvt/display_helpers.h
@@ -36,4 +36,11 @@ struct display;
  #define INTEL_DISPLAY_DEVICE_CURSOR_OFFSET(display, pipe) \
        intel_display_device_cursor_offset((display), (pipe))
+#ifdef for_each_pipe
Ditto about ifdefs here as with previous patch.

+#undef for_each_pipe
+#endif
+#define for_each_pipe(display, __p) \
+       for ((__p) = 0; (__p) < I915_MAX_PIPES; (__p)++) \
+               for_each_if(intel_display_runtime_info_pipe_mask((display)) & 
BIT(__p))
+
  #endif /* __DISPLAY_HELPERS_H__ */

Reply via email to