DRI2: report swap events correctly in direct rendered case
[mesa.git] / src / gallium / state_trackers / python / st_llvmpipe_winsys.c
1 /**************************************************************************
2 *
3 * Copyright 2010 VMware, Inc.
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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 *
27 **************************************************************************/
28
29 /**
30 * @file
31 * Llvmpipe support.
32 *
33 * @author Jose Fonseca
34 */
35
36
37 #include "pipe/p_format.h"
38 #include "pipe/p_context.h"
39 #include "util/u_inlines.h"
40 #include "util/u_math.h"
41 #include "util/u_memory.h"
42 #include "llvmpipe/lp_winsys.h"
43 #include "st_winsys.h"
44
45
46 static boolean
47 llvmpipe_ws_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
48 enum pipe_format format )
49 {
50 return FALSE;
51 }
52
53
54 static void *
55 llvmpipe_ws_displaytarget_map(struct llvmpipe_winsys *ws,
56 struct llvmpipe_displaytarget *dt,
57 unsigned flags )
58 {
59 assert(0);
60 return NULL;
61 }
62
63
64 static void
65 llvmpipe_ws_displaytarget_unmap(struct llvmpipe_winsys *ws,
66 struct llvmpipe_displaytarget *dt )
67 {
68 assert(0);
69 }
70
71
72 static void
73 llvmpipe_ws_displaytarget_destroy(struct llvmpipe_winsys *winsys,
74 struct llvmpipe_displaytarget *dt)
75 {
76 assert(0);
77 }
78
79
80 static struct llvmpipe_displaytarget *
81 llvmpipe_ws_displaytarget_create(struct llvmpipe_winsys *winsys,
82 enum pipe_format format,
83 unsigned width, unsigned height,
84 unsigned alignment,
85 unsigned *stride)
86 {
87 return NULL;
88 }
89
90
91 static void
92 llvmpipe_ws_displaytarget_display(struct llvmpipe_winsys *winsys,
93 struct llvmpipe_displaytarget *dt,
94 void *context_private)
95 {
96 assert(0);
97 }
98
99
100 static void
101 llvmpipe_ws_destroy(struct llvmpipe_winsys *winsys)
102 {
103 FREE(winsys);
104 }
105
106
107 static struct pipe_screen *
108 st_llvmpipe_screen_create(void)
109 {
110 static struct llvmpipe_winsys *winsys;
111 struct pipe_screen *screen;
112
113 winsys = CALLOC_STRUCT(llvmpipe_winsys);
114 if (!winsys)
115 goto no_winsys;
116
117 winsys->destroy = llvmpipe_ws_destroy;
118 winsys->is_displaytarget_format_supported = llvmpipe_ws_is_displaytarget_format_supported;
119 winsys->displaytarget_create = llvmpipe_ws_displaytarget_create;
120 winsys->displaytarget_map = llvmpipe_ws_displaytarget_map;
121 winsys->displaytarget_unmap = llvmpipe_ws_displaytarget_unmap;
122 winsys->displaytarget_display = llvmpipe_ws_displaytarget_display;
123 winsys->displaytarget_destroy = llvmpipe_ws_displaytarget_destroy;
124
125 screen = llvmpipe_create_screen(winsys);
126 if (!screen)
127 goto no_screen;
128
129 return screen;
130
131 no_screen:
132 FREE(winsys);
133 no_winsys:
134 return NULL;
135 }
136
137
138
139 const struct st_winsys st_softpipe_winsys = {
140 &st_llvmpipe_screen_create
141 };