Merge tag 'mac80211-for-davem-2016-06-09' of git://git.kernel.org/pub/scm/linux/kerne...
[cascardo/linux.git] / drivers / gpu / drm / mediatek / mtk_drm_plane.h
1 /*
2  * Copyright (c) 2015 MediaTek Inc.
3  * Author: CK Hu <ck.hu@mediatek.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #ifndef _MTK_DRM_PLANE_H_
16 #define _MTK_DRM_PLANE_H_
17
18 #include <drm/drm_crtc.h>
19 #include <linux/types.h>
20
21 struct mtk_drm_plane {
22         struct drm_plane                base;
23         unsigned int                    idx;
24 };
25
26 struct mtk_plane_pending_state {
27         bool                            config;
28         bool                            enable;
29         dma_addr_t                      addr;
30         unsigned int                    pitch;
31         unsigned int                    format;
32         unsigned int                    x;
33         unsigned int                    y;
34         unsigned int                    width;
35         unsigned int                    height;
36         bool                            dirty;
37 };
38
39 struct mtk_plane_state {
40         struct drm_plane_state          base;
41         struct mtk_plane_pending_state  pending;
42 };
43
44 static inline struct mtk_drm_plane *to_mtk_plane(struct drm_plane *plane)
45 {
46         return container_of(plane, struct mtk_drm_plane, base);
47 }
48
49 static inline struct mtk_plane_state *
50 to_mtk_plane_state(struct drm_plane_state *state)
51 {
52         return container_of(state, struct mtk_plane_state, base);
53 }
54
55 int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane,
56                    unsigned long possible_crtcs, enum drm_plane_type type,
57                    unsigned int zpos);
58
59 #endif