1 /**************************************************************************
3 xserver-xorg-video-exynos
5 Copyright 2011 Samsung Electronics co., Ltd. All Rights Reserved.
7 Contact: SooChan Lim <sc1.lim@samsung.com>
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sub license, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial portions
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 **************************************************************************/
31 #ifndef __SEC_DISPLAY_H__
32 #define __SEC_DISPLAY_H__
34 #include <xf86drmMode.h>
36 #include <tbm_bufmgr.h>
39 #define DBG_DRM_EVENT 1
44 DISPLAY_SET_MODE_CLONE,
50 DISPLAY_CONN_MODE_NONE,
51 DISPLAY_CONN_MODE_LVDS,
52 DISPLAY_CONN_MODE_HDMI,
53 DISPLAY_CONN_MODE_VIRTUAL,
54 DISPLAY_CONN_MODE_DUMMY,
55 DISPLAY_CONN_MODE_MAX,
67 typedef struct _secDrmEventContext {
68 void (*vblank_handler) (int fd,
69 unsigned int sequence,
74 void (*page_flip_handler) (int fd,
75 unsigned int sequence,
80 void (*g2d_handler) (int fd,
81 unsigned int cmdlist_no,
86 void (*ipp_handler) (int fd,
88 unsigned int *buf_idx,
92 } secDrmEventContext, *secDrmEventContextPtr;
94 typedef struct _secDrmMode
98 drmModeResPtr mode_res;
99 drmModePlaneResPtr plane_res;
101 drmModeModeInfo main_lcd_mode;
102 drmModeModeInfo ext_connector_mode;
104 secDrmEventContext event_context;
106 struct xorg_list outputs;
107 struct xorg_list crtcs;
108 struct xorg_list planes;
110 int num_dummy_output;
115 SECDisplaySetMode set_mode;
116 SECDisplayConnMode conn_mode;
119 int unset_connector_type;
120 } SECModeRec, *SECModePtr;
122 typedef void (*SECFlipEventHandler) (unsigned int frame, unsigned int tv_exynos,
123 unsigned int tv_uexynos, void *event_data, Bool flip_failed);
125 typedef struct _secPageFlip
133 tbm_bo accessibility_back_bo;
138 SECFlipEventHandler handler;
141 void *xdbg_log_pageflip;
143 } SECPageFlipRec, *SECPageFlipPtr;
145 typedef struct _secVBlankInfo
147 SECVBlankInfoType type;
148 void *data; /* request data pointer */
152 void *xdbg_log_vblank;
154 } SECVBlankInfoRec, *SECVBlankInfoPtr;
156 typedef struct _secProperty
158 drmModePropertyPtr mode_prop;
160 int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
162 } SECPropertyRec, *SECPropertyPtr;
164 Bool secModePreInit (ScrnInfoPtr pScrn, int drm_fd);
165 void secModeInit (ScrnInfoPtr pScrn);
166 void secModeDeinit (ScrnInfoPtr pScrn);
167 xf86CrtcPtr secModeCoveringCrtc (ScrnInfoPtr pScrn, BoxPtr pBox, xf86CrtcPtr pDesiredCrtc, BoxPtr pBoxCrtc);
168 int secModeGetCrtcPipe (xf86CrtcPtr pCrtc);
169 Bool secModePageFlip (ScrnInfoPtr pScrn, xf86CrtcPtr pCrtc, void* flip_info, int pipe, tbm_bo back_bo, RegionPtr pFlipRegion, unsigned int client_idx, XID drawable_id, SECFlipEventHandler handler);
170 void secModeLoadPalette (ScrnInfoPtr pScrn, int numColors, int* indices, LOCO* colors, VisualPtr pVisual);
172 void secDisplaySwapModeFromKmode(ScrnInfoPtr pScrn, drmModeModeInfoPtr kmode, DisplayModePtr pMode);
173 void secDisplayModeFromKmode(ScrnInfoPtr pScrn, drmModeModeInfoPtr kmode, DisplayModePtr pMode);
174 void secDisplaySwapModeToKmode(ScrnInfoPtr pScrn, drmModeModeInfoPtr kmode, DisplayModePtr pMode);
175 void secDisplayModeToKmode(ScrnInfoPtr pScrn, drmModeModeInfoPtr kmode, DisplayModePtr pMode);
177 Bool secDisplaySetDispSetMode (ScrnInfoPtr pScrn, SECDisplaySetMode disp_mode);
178 SECDisplaySetMode secDisplayGetDispSetMode (ScrnInfoPtr pScrn);
179 Bool secDisplaySetDispRotate (ScrnInfoPtr pScrn, int disp_rotate);
180 int secDisplayGetDispRotate (ScrnInfoPtr pScrn);
181 Bool secDisplaySetDispConnMode (ScrnInfoPtr pScrn, SECDisplayConnMode disp_conn);
182 SECDisplayConnMode secDisplayGetDispConnMode (ScrnInfoPtr pScrn);
184 Bool secDisplayInitDispMode (ScrnInfoPtr pScrn, SECDisplayConnMode conn_mode);
185 void secDisplayDeinitDispMode (ScrnInfoPtr pScrn);
187 Bool secDisplayGetCurMSC (ScrnInfoPtr pScrn, int pipe, CARD64 *ust, CARD64 *msc);
188 Bool secDisplayVBlank (ScrnInfoPtr pScrn, int pipe, CARD64 *target_msc, int flip, SECVBlankInfoType type, void *vblank_info);
189 int secDisplayDrawablePipe (DrawablePtr pDraw);
191 int secDisplayCrtcPipe (ScrnInfoPtr pScrn, int crtc_id);
193 Bool secDisplayUpdateRequest(ScrnInfoPtr pScrn);
195 Bool secDisplayChangeMode (ScrnInfoPtr pScrn);
197 #endif /* __SEC_DISPLAY_H__ */