• 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 #endif
42 #ifdef _WIN32
43 #include <windows.h>
44 #include <unknwn.h>
45 #endif
46 #include "pipe/p_defines.h"
47 #include "util/format/u_formats.h"
48 
49 struct pipe_screen;
50 struct pipe_surface;
51 struct pipe_loader_device;
52 
53 struct vl_screen
54 {
55    void (*destroy)(struct vl_screen *vscreen);
56 
57    struct pipe_resource *
58    (*texture_from_drawable)(struct vl_screen *vscreen, void *drawable);
59 
60    struct u_rect *
61    (*get_dirty_area)(struct vl_screen *vscreen);
62 
63    uint64_t
64    (*get_timestamp)(struct vl_screen *vscreen, void *drawable);
65 
66    void
67    (*set_next_timestamp)(struct vl_screen *vscreen, uint64_t stamp);
68 
69    void *
70    (*get_private)(struct vl_screen *vscreen);
71 
72    void
73    (*set_back_texture_from_output)(struct vl_screen *vscreen,
74                                    struct pipe_resource *buffer,
75                                    uint32_t width, uint32_t height);
76 
77    struct pipe_screen *pscreen;
78    struct pipe_loader_device *dev;
79 
80    void *xcb_screen;
81    uint32_t color_depth;
82 };
83 
84 #ifdef HAVE_X11_PLATFORM
85 uint32_t
86 vl_dri2_format_for_depth(struct vl_screen *vscreen, int depth);
87 
88 struct vl_screen *
89 vl_dri2_screen_create(Display *display, int screen);
90 #else
91 static inline struct vl_screen *
vl_dri2_screen_create(void * display,int screen)92 vl_dri2_screen_create(void *display, int screen) { return NULL; };
93 #endif
94 
95 #if defined(HAVE_X11_PLATFORM) && defined(HAVE_DRI3)
96 struct vl_screen *
97 vl_dri3_screen_create(Display *display, int screen);
98 #else
99 static inline struct vl_screen *
vl_dri3_screen_create(void * display,int screen)100 vl_dri3_screen_create(void *display, int screen) { return NULL; };
101 #endif
102 
103 #ifdef _WIN32
104 struct vl_screen *vl_win32_screen_create(LUID *adapter);
105 struct vl_screen *vl_win32_screen_create_from_d3d12_device(IUnknown* d3d12_device);
106 #else
107 /* Always enable the DRM vl winsys */
108 struct vl_screen *
109 vl_drm_screen_create(int fd);
110 
111 #ifdef USE_XSHM
112 struct vl_screen *
113 vl_xlib_swrast_screen_create(Display *display, int screen);
114 static inline struct vl_screen *
vl_vgem_drm_screen_create(int fd)115 vl_vgem_drm_screen_create(int fd) { return NULL; }
116 #else
117 struct vl_screen *
118 vl_vgem_drm_screen_create(int fd);
119 static inline struct vl_screen *
vl_xlib_swrast_screen_create(void * display,int screen)120 vl_xlib_swrast_screen_create(void *display, int screen) { return NULL; }
121 #endif
122 #endif
123 
124 #endif
125 #ifdef __cplusplus
126 }
127 #endif