Merge branch 'kvm-hv-xmm-hypercall-fixes' into HEAD
[linux-block.git] / drivers / gpu / drm / sti / sti_plane.h
CommitLineData
e2842570 1/* SPDX-License-Identifier: GPL-2.0 */
9bbf86fe
BG
2/*
3 * Copyright (C) STMicroelectronics SA 2014
4 * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
9bbf86fe
BG
5 */
6
9e1f05b2
VA
7#ifndef _STI_PLANE_H_
8#define _STI_PLANE_H_
9bbf86fe 9
29d1dc62
VA
10#include <drm/drm_atomic_helper.h>
11#include <drm/drm_plane_helper.h>
12
871bcdfe
VA
13#define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
14
15#define STI_PLANE_TYPE_SHIFT 8
16#define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1))
17
18enum sti_plane_type {
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
23};
24
25enum sti_plane_id_of_type {
26 STI_ID_0 = 0,
27 STI_ID_1 = 1,
28 STI_ID_2 = 2,
29 STI_ID_3 = 3
30};
31
32enum sti_plane_desc {
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,
38 STI_CURSOR = STI_CUR,
39 STI_BACK = STI_BCK
40};
41
29d1dc62
VA
42enum sti_plane_status {
43 STI_PLANE_READY,
44 STI_PLANE_UPDATED,
45 STI_PLANE_DISABLING,
46 STI_PLANE_FLUSHING,
47 STI_PLANE_DISABLED,
48};
49
a69e466b 50#define FPS_LENGTH 128
bf8f9e4a
VA
51struct sti_fps_info {
52 bool output;
53 unsigned int curr_frame_counter;
54 unsigned int last_frame_counter;
55 unsigned int curr_field_counter;
56 unsigned int last_field_counter;
2c83f581 57 ktime_t last_timestamp;
bf8f9e4a
VA
58 char fps_str[FPS_LENGTH];
59 char fips_str[FPS_LENGTH];
60};
61
871bcdfe
VA
62/**
63 * STI plane structure
64 *
65 * @plane: drm plane it is bound to (if any)
871bcdfe 66 * @desc: plane type & id
29d1dc62 67 * @status: to know the status of the plane
bf8f9e4a 68 * @fps_info: frame per second info
871bcdfe
VA
69 */
70struct sti_plane {
71 struct drm_plane drm_plane;
871bcdfe 72 enum sti_plane_desc desc;
29d1dc62 73 enum sti_plane_status status;
bf8f9e4a 74 struct sti_fps_info fps_info;
871bcdfe
VA
75};
76
871bcdfe 77const char *sti_plane_to_str(struct sti_plane *plane);
bf8f9e4a
VA
78void sti_plane_update_fps(struct sti_plane *plane,
79 bool new_frame,
80 bool new_field);
83af0a48 81
29d1dc62
VA
82void sti_plane_init_property(struct sti_plane *plane,
83 enum drm_plane_type type);
bbd1e3a5 84void sti_plane_reset(struct drm_plane *plane);
9bbf86fe 85#endif