1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) STMicroelectronics SA 2014
10 #include <drm/drm_atomic_helper.h>
11 #include <drm/drm_plane_helper.h>
13 #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
15 #define STI_PLANE_TYPE_SHIFT 8
16 #define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1))
19 STI_GDP = 1 << STI_PLANE_TYPE_SHIFT,
20 STI_VDP = 2 << STI_PLANE_TYPE_SHIFT,
21 STI_CUR = 3 << STI_PLANE_TYPE_SHIFT,
22 STI_BCK = 4 << STI_PLANE_TYPE_SHIFT
25 enum sti_plane_id_of_type {
33 STI_GDP_0 = STI_GDP | STI_ID_0,
34 STI_GDP_1 = STI_GDP | STI_ID_1,
35 STI_GDP_2 = STI_GDP | STI_ID_2,
36 STI_GDP_3 = STI_GDP | STI_ID_3,
37 STI_HQVDP_0 = STI_VDP | STI_ID_0,
42 enum sti_plane_status {
50 #define FPS_LENGTH 128
53 unsigned int curr_frame_counter;
54 unsigned int last_frame_counter;
55 unsigned int curr_field_counter;
56 unsigned int last_field_counter;
57 ktime_t last_timestamp;
58 char fps_str[FPS_LENGTH];
59 char fips_str[FPS_LENGTH];
65 * @plane: drm plane it is bound to (if any)
66 * @desc: plane type & id
67 * @status: to know the status of the plane
68 * @fps_info: frame per second info
71 struct drm_plane drm_plane;
72 enum sti_plane_desc desc;
73 enum sti_plane_status status;
74 struct sti_fps_info fps_info;
77 const char *sti_plane_to_str(struct sti_plane *plane);
78 void sti_plane_update_fps(struct sti_plane *plane,
82 void sti_plane_init_property(struct sti_plane *plane,
83 enum drm_plane_type type);
84 void sti_plane_reset(struct drm_plane *plane);