1 /**************************************************************************
3 * Copyright 2010 VMware, Inc.
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:
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.
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
27 **************************************************************************/
33 * @author Jose Fonseca
37 #include "pipe/p_format.h"
38 #include "pipe/p_context.h"
39 #include "pipe/p_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"
47 llvmpipe_ws_is_displaytarget_format_supported( struct llvmpipe_winsys
*ws
,
48 enum pipe_format format
)
55 llvmpipe_ws_displaytarget_map(struct llvmpipe_winsys
*ws
,
56 struct llvmpipe_displaytarget
*dt
,
65 llvmpipe_ws_displaytarget_unmap(struct llvmpipe_winsys
*ws
,
66 struct llvmpipe_displaytarget
*dt
)
73 llvmpipe_ws_displaytarget_destroy(struct llvmpipe_winsys
*winsys
,
74 struct llvmpipe_displaytarget
*dt
)
80 static struct llvmpipe_displaytarget
*
81 llvmpipe_ws_displaytarget_create(struct llvmpipe_winsys
*winsys
,
82 enum pipe_format format
,
83 unsigned width
, unsigned height
,
92 llvmpipe_ws_displaytarget_display(struct llvmpipe_winsys
*winsys
,
93 struct llvmpipe_displaytarget
*dt
,
94 void *context_private
)
101 llvmpipe_ws_destroy(struct llvmpipe_winsys
*winsys
)
107 static struct pipe_screen
*
108 st_llvmpipe_screen_create(void)
110 static struct llvmpipe_winsys
*winsys
;
111 struct pipe_screen
*screen
;
113 winsys
= CALLOC_STRUCT(llvmpipe_winsys
);
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
;
125 screen
= llvmpipe_create_screen(winsys
);
138 static struct pipe_context
*
139 st_llvmpipe_context_create(struct pipe_screen
*screen
)
141 return llvmpipe_create(screen
);
145 const struct st_winsys st_softpipe_winsys
= {
146 &st_llvmpipe_screen_create
,
147 &st_llvmpipe_context_create
,