5027e57b30355da15ddb17edda056ea04191e0fd
[profile/ivi/mesa.git] / src / gallium / winsys / sw / null / null_sw_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  * @file
30  * Null software rasterizer winsys.
31  * 
32  * There is no present support. Framebuffer data needs to be obtained via
33  * transfers.
34  *
35  * @author Jose Fonseca
36  */
37
38
39 #include "pipe/p_format.h"
40 #include "util/u_memory.h"
41 #include "state_tracker/sw_winsys.h"
42 #include "null_sw_winsys.h"
43
44
45 static boolean
46 null_sw_is_displaytarget_format_supported(struct sw_winsys *ws,
47                                           unsigned tex_usage,
48                                           enum pipe_format format )
49 {
50    return FALSE;
51 }
52
53
54 static void *
55 null_sw_displaytarget_map(struct sw_winsys *ws,
56                           struct sw_displaytarget *dt,
57                           unsigned flags )
58 {
59    assert(0);
60    return NULL;
61 }
62
63
64 static void
65 null_sw_displaytarget_unmap(struct sw_winsys *ws,
66                             struct sw_displaytarget *dt )
67 {
68    assert(0);
69 }
70
71
72 static void
73 null_sw_displaytarget_destroy(struct sw_winsys *winsys,
74                               struct sw_displaytarget *dt)
75 {
76    assert(0);
77 }
78
79
80 static struct sw_displaytarget *
81 null_sw_displaytarget_create(struct sw_winsys *winsys,
82                              unsigned tex_usage,
83                              enum pipe_format format,
84                              unsigned width, unsigned height,
85                              unsigned alignment,
86                              unsigned *stride)
87 {
88    return NULL;
89 }
90
91
92 static struct sw_displaytarget *
93 null_sw_displaytarget_from_handle(struct sw_winsys *winsys,
94                                   const struct pipe_texture *templet,
95                                   struct winsys_handle *whandle,
96                                   unsigned *stride)
97 {
98    return NULL;
99 }
100
101
102 static boolean
103 null_sw_displaytarget_get_handle(struct sw_winsys *winsys,
104                                  struct sw_displaytarget *dt,
105                                  struct winsys_handle *whandle)
106 {
107    assert(0);
108    return FALSE;
109 }
110
111
112 static void
113 null_sw_displaytarget_display(struct sw_winsys *winsys,
114                               struct sw_displaytarget *dt,
115                               void *context_private)
116 {
117    assert(0);
118 }
119
120
121 static void
122 null_sw_destroy(struct sw_winsys *winsys)
123 {
124    FREE(winsys);
125 }
126
127
128 struct sw_winsys *
129 null_sw_create(void)
130 {
131    static struct sw_winsys *winsys;
132
133    winsys = CALLOC_STRUCT(sw_winsys);
134    if (!winsys)
135       return NULL;
136
137    winsys->destroy = null_sw_destroy;
138    winsys->is_displaytarget_format_supported = null_sw_is_displaytarget_format_supported;
139    winsys->displaytarget_create = null_sw_displaytarget_create;
140    winsys->displaytarget_from_handle = null_sw_displaytarget_from_handle;
141    winsys->displaytarget_get_handle = null_sw_displaytarget_get_handle;
142    winsys->displaytarget_map = null_sw_displaytarget_map;
143    winsys->displaytarget_unmap = null_sw_displaytarget_unmap;
144    winsys->displaytarget_display = null_sw_displaytarget_display;
145    winsys->displaytarget_destroy = null_sw_displaytarget_destroy;
146
147    return winsys;
148 }