xref: /aosp_15_r20/external/mesa3d/src/egl/drivers/wgl/egl_wgl.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © Microsoft Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #pragma once
25 
26 #include <eglconfig.h>
27 #include <egldisplay.h>
28 #include <egldriver.h>
29 #include <eglimage.h>
30 #include <eglsync.h>
31 
32 #include <windows.h>
33 #include <stw_pixelformat.h>
34 
35 struct wgl_egl_display {
36    struct pipe_frontend_screen base;
37    _EGLDisplay *parent;
38    int ref_count;
39    struct pipe_screen *screen;
40 };
41 
42 struct wgl_egl_config {
43    _EGLConfig base;
44    const struct stw_pixelformat_info *stw_config[2];
45 };
46 
47 struct wgl_egl_context {
48    _EGLContext base;
49    struct stw_context *ctx;
50 };
51 
52 struct wgl_egl_surface {
53    _EGLSurface base;
54    struct stw_framebuffer *fb;
55 };
56 
57 struct wgl_egl_image {
58    _EGLImage base;
59    struct stw_image *img;
60 };
61 
62 struct wgl_egl_sync {
63    _EGLSync base;
64    int refcount;
65    struct pipe_fence_handle *fence;
66    HANDLE event;
67 };
68 
69 _EGL_DRIVER_STANDARD_TYPECASTS(wgl_egl)
70 _EGL_DRIVER_TYPECAST(wgl_egl_image, _EGLImage, obj)
71 _EGL_DRIVER_TYPECAST(wgl_egl_sync, _EGLSync, obj)
72