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