xref: /linux/drivers/gpu/drm/i915/gvt/display_helpers.h (revision c17ee635fd3a482b2ad2bf5e269755c2eae5f25e)
1 /* SPDX-License-Identifier: MIT
2  *
3  * Copyright © 2025 Intel Corporation
4  */
5 
6 #ifndef __DISPLAY_HELPERS_H__
7 #define __DISPLAY_HELPERS_H__
8 
9 #include "display/intel_gvt_api.h"
10 
11 #define DISPLAY_MMIO_BASE(display) \
12 	intel_display_device_mmio_base((display))
13 
14 /*
15  * #FIXME:
16  * TRANSCONF() uses pipe-based addressing via _MMIO_PIPE2().
17  * Some GVT call sites pass enum transcoder instead of enum pipe.
18  * Cast the argument to enum pipe for now since TRANSCODER_A..D map
19  * 1:1 to PIPE_A..D.
20  * TRANSCODER_EDP is an exception, the cast preserves the existing
21  * behaviour but this needs to be handled later either by using the
22  * correct pipe or by switching TRANSCONF() to use _MMIO_TRANS2().
23  */
24 #define INTEL_DISPLAY_DEVICE_PIPE_OFFSET(display, idx) \
25 	intel_display_device_pipe_offset((display), (enum pipe)(idx))
26 
27 #define INTEL_DISPLAY_DEVICE_TRANS_OFFSET(display, trans) \
28 	intel_display_device_trans_offset((display), (trans))
29 
30 #define INTEL_DISPLAY_DEVICE_CURSOR_OFFSET(display, pipe) \
31 	intel_display_device_cursor_offset((display), (pipe))
32 
33 #define gvt_for_each_pipe(display, __p) \
34 	for ((__p) = PIPE_A; (__p) < I915_MAX_PIPES; (__p)++) \
35 		for_each_if(intel_display_device_pipe_valid((display), (__p)))
36 
37 #endif /* __DISPLAY_HELPERS_H__ */
38