1 /*
2   Simple DirectMedia Layer
3   Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4 
5   This software is provided 'as-is', without any express or implied
6   warranty.  In no event will the authors be held liable for any damages
7   arising from the use of this software.
8 
9   Permission is granted to anyone to use this software for any purpose,
10   including commercial applications, and to alter it and redistribute it
11   freely, subject to the following restrictions:
12 
13   1. The origin of this software must not be misrepresented; you must not
14      claim that you wrote the original software. If you use this software
15      in a product, an acknowledgment in the product documentation would be
16      appreciated but is not required.
17   2. Altered source versions must be plainly marked as such, and must not be
18      misrepresented as being the original software.
19   3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef SDL_vivantevideo_h_
23 #define SDL_vivantevideo_h_
24 
25 #include "../../SDL_internal.h"
26 #include "../SDL_sysvideo.h"
27 
28 #include "SDL_egl.h"
29 
30 #if SDL_VIDEO_DRIVER_VIVANTE_VDK
31 #include <gc_vdk.h>
32 #else
33 #include <EGL/egl.h>
34 #endif
35 
36 typedef struct SDL_VideoData
37 {
38 #if SDL_VIDEO_DRIVER_VIVANTE_VDK
39     vdkPrivate vdk_private;
40 #else
41     void *egl_handle; /* EGL shared library handle */
42     EGLNativeDisplayType (EGLAPIENTRY *fbGetDisplay)(void *context);
43     EGLNativeDisplayType (EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex);
44     void (EGLAPIENTRY *fbGetDisplayGeometry)(EGLNativeDisplayType Display, int *Width, int *Height);
45     void (EGLAPIENTRY *fbGetDisplayInfo)(EGLNativeDisplayType Display, int *Width, int *Height, unsigned long *Physical, int *Stride, int *BitsPerPixel);
46     void (EGLAPIENTRY *fbDestroyDisplay)(EGLNativeDisplayType Display);
47     EGLNativeWindowType (EGLAPIENTRY *fbCreateWindow)(EGLNativeDisplayType Display, int X, int Y, int Width, int Height);
48     void (EGLAPIENTRY *fbGetWindowGeometry)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height);
49     void (EGLAPIENTRY *fbGetWindowInfo)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height, int *BitsPerPixel, unsigned int *Offset);
50     void (EGLAPIENTRY *fbDestroyWindow)(EGLNativeWindowType Window);
51 #endif
52 } SDL_VideoData;
53 
54 typedef struct SDL_DisplayData
55 {
56     EGLNativeDisplayType native_display;
57 } SDL_DisplayData;
58 
59 typedef struct SDL_WindowData
60 {
61     EGLNativeWindowType native_window;
62     EGLSurface egl_surface;
63 } SDL_WindowData;
64 
65 /****************************************************************************/
66 /* SDL_VideoDevice functions declaration                                    */
67 /****************************************************************************/
68 
69 /* Display and window functions */
70 int VIVANTE_VideoInit(_THIS);
71 void VIVANTE_VideoQuit(_THIS);
72 void VIVANTE_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
73 int VIVANTE_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
74 int VIVANTE_CreateWindow(_THIS, SDL_Window * window);
75 void VIVANTE_SetWindowTitle(_THIS, SDL_Window * window);
76 void VIVANTE_SetWindowPosition(_THIS, SDL_Window * window);
77 void VIVANTE_SetWindowSize(_THIS, SDL_Window * window);
78 void VIVANTE_ShowWindow(_THIS, SDL_Window * window);
79 void VIVANTE_HideWindow(_THIS, SDL_Window * window);
80 void VIVANTE_DestroyWindow(_THIS, SDL_Window * window);
81 
82 /* Window manager function */
83 SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window,
84                              struct SDL_SysWMinfo *info);
85 
86 /* Event functions */
87 void VIVANTE_PumpEvents(_THIS);
88 
89 #endif /* SDL_vivantevideo_h_ */
90 
91 /* vi: set ts=4 sw=4 expandtab: */
92