• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2009 Younes Manton.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 
28 /*
29  * Target makefiles directly refer to vl_winsys_dri.c to avoid DRI dependency
30  */
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #ifndef vl_winsys_h
37 #define vl_winsys_h
38 
39 #ifdef HAVE_X11_PLATFORM
40 #include <X11/Xlib.h>
41 #include <xcb/xcb.h>
42 #endif
43 #ifdef _WIN32
44 #include <windows.h>
45 #include <unknwn.h>
46 #endif
47 #include "pipe/p_defines.h"
48 #include "util/format/u_formats.h"
49 #include "frontend/sw_winsys.h"
50 
51 struct pipe_screen;
52 struct pipe_surface;
53 struct pipe_loader_device;
54 
55 struct vl_screen
56 {
57    void (*destroy)(struct vl_screen *vscreen);
58 
59    struct pipe_resource *
60    (*texture_from_drawable)(struct vl_screen *vscreen, void *drawable);
61 
62    struct u_rect *
63    (*get_dirty_area)(struct vl_screen *vscreen);
64 
65    uint64_t
66    (*get_timestamp)(struct vl_screen *vscreen, void *drawable);
67 
68    void
69    (*set_next_timestamp)(struct vl_screen *vscreen, uint64_t stamp);
70 
71    void *
72    (*get_private)(struct vl_screen *vscreen);
73 
74    void
75    (*set_back_texture_from_output)(struct vl_screen *vscreen,
76                                    struct pipe_resource *buffer,
77                                    uint32_t width, uint32_t height);
78 
79    struct pipe_screen *pscreen;
80    struct pipe_loader_device *dev;
81 
82    void *xcb_screen;
83    uint32_t color_depth;
84 };
85 
86 #ifdef HAVE_X11_PLATFORM
87 xcb_screen_t *
88 vl_dri_get_screen_for_root(xcb_connection_t *conn, xcb_window_t root);
89 uint32_t
90 vl_dri2_format_for_depth(struct vl_screen *vscreen, int depth);
91 
92 struct vl_screen *
93 vl_dri2_screen_create(Display *display, int screen);
94 #else
95 static inline struct vl_screen *
vl_dri2_screen_create(void * display,int screen)96 vl_dri2_screen_create(void *display, int screen) { return NULL; };
97 #endif
98 
99 #if defined(HAVE_X11_PLATFORM) && defined(HAVE_LIBDRM)
100 struct vl_screen *
101 vl_dri3_screen_create(Display *display, int screen);
102 struct vl_screen *
103 vl_kopper_screen_create_x11(Display *display, int screen);
104 #else
105 static inline struct vl_screen *
vl_dri3_screen_create(void * display,int screen)106 vl_dri3_screen_create(void *display, int screen) { return NULL; };
107 static inline struct vl_screen *
vl_kopper_screen_create_x11(void * display,int screen)108 vl_kopper_screen_create_x11(void *display, int screen) { return NULL; };
109 #endif
110 
111 #ifdef _WIN32
112 struct vl_screen *vl_win32_screen_create(LUID *adapter);
113 struct vl_screen *vl_win32_screen_create_from_d3d12_device(IUnknown* d3d12_device, struct sw_winsys* winsys);
114 struct vl_screen *vl_kopper_screen_create_win32(LUID *adapter);
115 #else
116 /* Always enable the DRM vl winsys */
117 struct vl_screen *
118 vl_drm_screen_create(int fd, bool honor_dri_prime);
119 
120 #ifdef USE_XSHM
121 struct vl_screen *
122 vl_xlib_swrast_screen_create(Display *display, int screen);
123 static inline struct vl_screen *
vl_vgem_drm_screen_create(int fd)124 vl_vgem_drm_screen_create(int fd) { return NULL; }
125 #else
126 struct vl_screen *
127 vl_vgem_drm_screen_create(int fd);
128 static inline struct vl_screen *
vl_xlib_swrast_screen_create(void * display,int screen)129 vl_xlib_swrast_screen_create(void *display, int screen) { return NULL; }
130 #endif
131 #endif
132 
133 #endif
134 #ifdef __cplusplus
135 }
136 #endif
137