2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
26 /* The public interface header for the r300 pipe driver.
27 * Any winsys hosting this pipe needs to implement r300_winsys and then
28 * call r300_create_screen to start things. */
30 #include "pipe/p_defines.h"
31 #include "pipe/p_state.h"
33 #include "r300_defines.h"
35 struct r300_winsys_screen
;
37 /* Creates a new r300 screen. */
38 struct pipe_screen
* r300_create_screen(struct r300_winsys_screen
*rws
);
40 struct r300_winsys_buffer
;
42 /* XXX: this is just a bandaid on larger problems in
43 * r300_screen_buffer.h which doesn't seem to be fully ported to
46 #define R300_BIND_OQBO (1<<21)
53 R300_VID_SQUARE_TILING_SUPPORT
56 struct r300_winsys_screen
{
57 void (*destroy
)(struct r300_winsys_screen
*ws
);
60 * Buffer management. Buffer attributes are mostly fixed over its lifetime.
62 * Remember that gallium gets to choose the interface it needs, and the
63 * window systems must then implement that interface (rather than the
64 * other way around...).
66 * usage is a bitmask of R300_WINSYS_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
67 * usage argument is only an optimization hint, not a guarantee, therefore
68 * proper behavior must be observed in all circumstances.
70 * alignment indicates the client's alignment requirements, eg for
73 struct r300_winsys_buffer
*(*buffer_create
)(struct r300_winsys_screen
*ws
,
79 * Map the entire data store of a buffer object into the client's address.
80 * flags is bitmask of R300_WINSYS_BUFFER_USAGE_CPU_READ/WRITE flags.
82 void *(*buffer_map
)( struct r300_winsys_screen
*ws
,
83 struct r300_winsys_buffer
*buf
,
86 void (*buffer_unmap
)( struct r300_winsys_screen
*ws
,
87 struct r300_winsys_buffer
*buf
);
89 void (*buffer_destroy
)( struct r300_winsys_buffer
*buf
);
92 void (*buffer_reference
)(struct r300_winsys_screen
*rws
,
93 struct r300_winsys_buffer
**pdst
,
94 struct r300_winsys_buffer
*src
);
96 boolean (*buffer_references
)(struct r300_winsys_buffer
*a
,
97 struct r300_winsys_buffer
*b
);
99 void (*buffer_flush_range
)(struct r300_winsys_screen
*rws
,
100 struct r300_winsys_buffer
*buf
,
104 /* Add a pipe_resource to the list of buffer objects to validate. */
105 boolean (*add_buffer
)(struct r300_winsys_screen
*winsys
,
106 struct r300_winsys_buffer
*buf
,
111 /* Revalidate all currently setup pipe_buffers.
112 * Returns TRUE if a flush is required. */
113 boolean (*validate
)(struct r300_winsys_screen
* winsys
);
115 /* Check to see if there's room for commands. */
116 boolean (*check_cs
)(struct r300_winsys_screen
* winsys
, int size
);
118 /* Start a command emit. */
119 void (*begin_cs
)(struct r300_winsys_screen
* winsys
,
122 const char* function
,
125 /* Write a dword to the command buffer. */
126 void (*write_cs_dword
)(struct r300_winsys_screen
* winsys
, uint32_t dword
);
128 /* Write a relocated dword to the command buffer. */
129 void (*write_cs_reloc
)(struct r300_winsys_screen
*winsys
,
130 struct r300_winsys_buffer
*buf
,
135 /* Finish a command emit. */
136 void (*end_cs
)(struct r300_winsys_screen
* winsys
,
138 const char* function
,
142 void (*flush_cs
)(struct r300_winsys_screen
* winsys
);
144 /* winsys flush - callback from winsys when flush required */
145 void (*set_flush_cb
)(struct r300_winsys_screen
*winsys
,
146 void (*flush_cb
)(void *), void *data
);
148 void (*reset_bos
)(struct r300_winsys_screen
*winsys
);
150 void (*buffer_get_tiling
)(struct r300_winsys_screen
*winsys
,
151 struct r300_winsys_buffer
*buffer
,
152 enum r300_buffer_tiling
*microtiled
,
153 enum r300_buffer_tiling
*macrotiled
);
155 void (*buffer_set_tiling
)(struct r300_winsys_screen
*winsys
,
156 struct r300_winsys_buffer
*buffer
,
158 enum r300_buffer_tiling microtiled
,
159 enum r300_buffer_tiling macrotiled
);
161 uint32_t (*get_value
)(struct r300_winsys_screen
*winsys
,
162 enum r300_value_id vid
);
164 struct r300_winsys_buffer
*(*buffer_from_handle
)(struct r300_winsys_screen
*winsys
,
165 struct pipe_screen
*screen
,
166 struct winsys_handle
*whandle
,
168 boolean (*buffer_get_handle
)(struct r300_winsys_screen
*winsys
,
169 struct r300_winsys_buffer
*buffer
,
171 struct winsys_handle
*whandle
);
173 boolean (*is_buffer_referenced
)(struct r300_winsys_screen
*winsys
,
174 struct r300_winsys_buffer
*buffer
);
179 struct r300_winsys_screen
*
180 r300_winsys_screen(struct pipe_screen
*screen
);
182 #endif /* R300_WINSYS_H */