Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / egl / main / eglscreen.h
1 /**************************************************************************
2  *
3  * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4  * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
5  * Copyright 2010 LunarG, Inc.
6  * All Rights Reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sub license, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice (including the
17  * next paragraph) shall be included in all copies or substantial portions
18  * of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  * DEALINGS IN THE SOFTWARE.
27  *
28  **************************************************************************/
29
30
31 #ifndef EGLSCREEN_INCLUDED
32 #define EGLSCREEN_INCLUDED
33
34
35 #include "egltypedefs.h"
36
37
38 #ifdef EGL_MESA_screen_surface
39
40
41 #define _EGL_SCREEN_MAX_MODES 16
42
43
44 /**
45  * Per-screen information.
46  * Note that an EGL screen doesn't have a size.  A screen may be set to
47  * one of several display modes (width/height/scanrate).  The screen
48  * then displays a drawing surface.  The drawing surface must be at least
49  * as large as the display mode's resolution.  If it's larger, the
50  * OriginX and OriginY fields control what part of the surface is visible
51  * on the screen.
52  */
53 struct _egl_screen
54 {
55    _EGLDisplay *Display;
56
57    EGLScreenMESA Handle; /* The public/opaque handle which names this object */
58
59    _EGLMode *CurrentMode;
60    _EGLSurface *CurrentSurface;
61
62    EGLint OriginX, OriginY; /**< Origin of scan-out region w.r.t. surface */
63    EGLint StepX, StepY;     /**< Screen position/origin granularity */
64
65    EGLint NumModes;
66    _EGLMode *Modes;  /**< array [NumModes] */
67 };
68
69
70 PUBLIC void
71 _eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes);
72
73
74 PUBLIC EGLScreenMESA
75 _eglLinkScreen(_EGLScreen *screen);
76
77
78 extern _EGLScreen *
79 _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *dpy);
80
81
82 /**
83  * Return the handle of a linked screen.
84  */
85 static INLINE EGLScreenMESA
86 _eglGetScreenHandle(_EGLScreen *screen)
87 {
88    return (screen) ? screen->Handle : (EGLScreenMESA) 0;
89 }
90
91
92 extern EGLBoolean
93 _eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
94
95
96 extern EGLBoolean
97 _eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint x, EGLint y);
98
99
100 extern EGLBoolean
101 _eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy,
102                            _EGLScreen *scrn, _EGLSurface **surface);
103
104
105 extern EGLBoolean
106 _eglQueryScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, _EGLMode **m);
107
108
109 extern EGLBoolean
110 _eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint attribute, EGLint *value);
111
112
113 #endif /* EGL_MESA_screen_surface */
114
115
116 #endif /* EGLSCREEN_INCLUDED */