summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gvt/display_helpers.h
blob: 0418397c09c462d4e3ebb86abfe59226e772dc85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-License-Identifier: MIT
 *
 * Copyright © 2025 Intel Corporation
 */

#ifndef __DISPLAY_HELPERS_H__
#define __DISPLAY_HELPERS_H__

#include "display/intel_gvt_api.h"

#define DISPLAY_MMIO_BASE(display) \
	intel_display_device_mmio_base((display))

/*
 * #FIXME:
 * TRANSCONF() uses pipe-based addressing via _MMIO_PIPE2().
 * Some GVT call sites pass enum transcoder instead of enum pipe.
 * Cast the argument to enum pipe for now since TRANSCODER_A..D map
 * 1:1 to PIPE_A..D.
 * TRANSCODER_EDP is an exception, the cast preserves the existing
 * behaviour but this needs to be handled later either by using the
 * correct pipe or by switching TRANSCONF() to use _MMIO_TRANS2().
 */
#define INTEL_DISPLAY_DEVICE_PIPE_OFFSET(display, idx) \
	intel_display_device_pipe_offset((display), (enum pipe)(idx))

#define INTEL_DISPLAY_DEVICE_TRANS_OFFSET(display, trans) \
	intel_display_device_trans_offset((display), (trans))

#define INTEL_DISPLAY_DEVICE_CURSOR_OFFSET(display, pipe) \
	intel_display_device_cursor_offset((display), (pipe))

#define gvt_for_each_pipe(display, __p) \
	for ((__p) = PIPE_A; (__p) < I915_MAX_PIPES; (__p)++) \
		for_each_if(intel_display_device_pipe_valid((display), (__p)))

#endif /* __DISPLAY_HELPERS_H__ */