1 /* $NetBSD: intel_sprite.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
2
3 /* SPDX-License-Identifier: MIT */
4 /*
5 * Copyright © 2019 Intel Corporation
6 */
7
8 #ifndef __INTEL_SPRITE_H__
9 #define __INTEL_SPRITE_H__
10
11 #include <linux/types.h>
12
13 #include "intel_display.h"
14
15 struct drm_device;
16 struct drm_display_mode;
17 struct drm_file;
18 struct drm_i915_private;
19 struct intel_crtc_state;
20 struct intel_plane_state;
21
22 int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
23 int usecs);
24 struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
25 enum pipe pipe, int plane);
26 int intel_sprite_set_colorkey_ioctl(struct drm_device *dev, void *data,
27 struct drm_file *file_priv);
28 void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state);
29 void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state);
30 int intel_plane_check_stride(const struct intel_plane_state *plane_state);
31 int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state);
32 int chv_plane_check_rotation(const struct intel_plane_state *plane_state);
33 struct intel_plane *
34 skl_universal_plane_create(struct drm_i915_private *dev_priv,
35 enum pipe pipe, enum plane_id plane_id);
36
icl_is_nv12_y_plane(enum plane_id id)37 static inline bool icl_is_nv12_y_plane(enum plane_id id)
38 {
39 /* Don't need to do a gen check, these planes are only available on gen11 */
40 if (id == PLANE_SPRITE4 || id == PLANE_SPRITE5)
41 return true;
42
43 return false;
44 }
45
icl_hdr_plane_mask(void)46 static inline u8 icl_hdr_plane_mask(void)
47 {
48 return BIT(PLANE_PRIMARY) |
49 BIT(PLANE_SPRITE0) | BIT(PLANE_SPRITE1);
50 }
51
52 bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id);
53
54 int ivb_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
55 const struct intel_plane_state *plane_state);
56 int hsw_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
57 const struct intel_plane_state *plane_state);
58 int vlv_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
59 const struct intel_plane_state *plane_state);
60
61 #endif /* __INTEL_SPRITE_H__ */
62