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 **************************************************************************/
39 #include "xorg-server.h"
42 #include "xf86_OSproc.h"
44 #include "X11/Xatom.h"
45 #include "tbm_bufmgr.h"
46 #include "sec_display.h"
47 #include "sec_accel.h"
48 #include "sec_video.h"
57 /* drm bo data type */
63 /* framebuffer infomation */
72 struct xorg_list list_bo;
73 void* tbl_bo; /* bo hash table: key=(x,y)position */
76 } SECFbRec, *SECFbPtr;
78 /* framebuffer bo data */
89 } SECFbBoDataRec, *SECFbBoDataPtr;
91 /* sec screen private information */
95 Bool fake_root; /* screen rotation status */
98 OptionInfoPtr Options;
106 Bool is_tfb; /* triple flip buffer */
107 Bool cachable; /* if use cachable buffer */
108 Bool scanout; /* if use scanout buffer */
109 int flip_bufs; /* number of the flip buffers */
111 Bool use_partial_update;
112 Bool is_fb_touched; /* whether framebuffer is touched or not */
116 char *drm_device_name;
117 tbm_bufmgr tbm_bufmgr;
119 /* main fb information */
122 /* mode setting info private */
126 SECExaPrivPtr pExaPriv;
129 SECVideoPrivPtr pVideoPriv;
131 Bool isLcdOff; /* lvds connector on/off status */
133 Bool isCrtcOn; /* Global crtc status */
135 /* screen wrapper functions */
136 CloseScreenProcPtr CloseScreen;
137 CreateScreenResourcesProcPtr CreateScreenResources;
140 struct udev_monitor *uevent_monitor;
141 InputHandlerProc uevent_handler;
147 DrawablePtr flipDrawable;
149 /* pending flip handler cause of lcd off */
150 Bool pending_flip_handler;
153 unsigned int tv_usec;
156 /* overlay drawable */
157 DamagePtr ovl_damage;
158 DrawablePtr ovl_drawable;
160 SECDisplaySetMode set_mode;
161 OsTimerPtr resume_timer;
185 CREATE_PIXMAP_USAGE_BACKING_PIXMAP
186 CREATE_PIXMAP_USAGE_OVERLAY
187 CREATE_PIXMAP_USAGE_XVIDEO
188 CREATE_PIXMAP_USAGE_DRI2_FILP_BACK
189 CREATE_PIXMAP_USAGE_FB
190 CREATE_PIXMAP_USAGE_SUB_FB
191 CREATE_PIXMAP_USAGE_DRI2_BACK
194 int pix_backing_pixmap;
196 int pix_dri2_flip_back;
202 /* get a private screen of ScrnInfo */
203 #define SECPTR(p) ((SECPtr)((p)->driverPrivate))
205 /* the version of the driver */
206 #define SEC_VERSION 1000
208 /* the name used to prefix messages */
209 #define SEC_NAME "exynos"
211 /* the driver name used in display.conf file. exynos_drv.so */
212 #define SEC_DRIVER_NAME "exynos"
214 #define ROOT_FB_ADDR (~0UL)
216 #define SEC_CURSOR_W 128
217 #define SEC_CURSOR_H 128
219 /* sec framebuffer */
220 SECFbPtr secFbAllocate (ScrnInfoPtr pScrn, int width, int height);
221 void secFbFree (SECFbPtr pFb);
222 void secFbResize (SECFbPtr pFb, int width, int height);
223 tbm_bo secFbGetBo (SECFbPtr pFb, int x, int y, int width, int height, Bool onlyIfExists);
224 int secFbFindBo (SECFbPtr pFb, int x, int y, int width, int height, int *num_bo, tbm_bo** bos);
225 tbm_bo secFbFindBoByPoint (SECFbPtr pFb, int x, int y);
226 tbm_bo secFbSwapBo (SECFbPtr pFb, tbm_bo back_bo);
228 tbm_bo secRenderBoCreate (ScrnInfoPtr pScrn, int width, int height);
229 int secSwapToRenderBo (ScrnInfoPtr pScrn, int width, int height, tbm_bo carr_bo);
230 tbm_bo secRenderBoRef (tbm_bo bo);
231 void secRenderBoUnref (tbm_bo bo);
232 void secRenderBoSetPos (tbm_bo bo, int x, int y);
233 PixmapPtr secRenderBoGetPixmap (SECFbPtr pFb, tbm_bo bo);