Merge branch 'mesa_7_5_branch' into mesa_7_6_branch
[mesa.git] / src / gallium / drivers / r300 / r300_winsys.h
1 /*
2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
3 *
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:
10 *
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
13 * Software.
14 *
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. */
22
23 #ifndef R300_WINSYS_H
24 #define R300_WINSYS_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /* The public interface header for the r300 pipe driver.
31 * Any winsys hosting this pipe needs to implement r300_winsys and then
32 * call r300_create_context to start things. */
33
34 #include "pipe/p_defines.h"
35 #include "pipe/p_state.h"
36 #include "pipe/internal/p_winsys_screen.h"
37
38 struct r300_winsys {
39 /* Parent class */
40 struct pipe_winsys base;
41
42 /* Opaque Radeon-specific winsys object. */
43 void* radeon_winsys;
44
45 /* PCI ID */
46 uint32_t pci_id;
47
48 /* GB pipe count */
49 uint32_t gb_pipes;
50
51 /* GART size. */
52 uint32_t gart_size;
53
54 /* VRAM size. */
55 uint32_t vram_size;
56
57 /* Add a pipe_buffer to the list of buffer objects to validate. */
58 boolean (*add_buffer)(struct r300_winsys* winsys,
59 struct pipe_buffer* pbuffer,
60 uint32_t rd,
61 uint32_t wd);
62
63 /* Revalidate all currently setup pipe_buffers.
64 * Returns TRUE if a flush is required. */
65 boolean (*validate)(struct r300_winsys* winsys);
66
67 /* Check to see if there's room for commands. */
68 boolean (*check_cs)(struct r300_winsys* winsys, int size);
69
70 /* Start a command emit. */
71 void (*begin_cs)(struct r300_winsys* winsys,
72 int size,
73 const char* file,
74 const char* function,
75 int line);
76
77 /* Write a dword to the command buffer. */
78 void (*write_cs_dword)(struct r300_winsys* winsys, uint32_t dword);
79
80 /* Write a relocated dword to the command buffer. */
81 void (*write_cs_reloc)(struct r300_winsys* winsys,
82 struct pipe_buffer* bo,
83 uint32_t rd,
84 uint32_t wd,
85 uint32_t flags);
86
87 /* Finish a command emit. */
88 void (*end_cs)(struct r300_winsys* winsys,
89 const char* file,
90 const char* function,
91 int line);
92
93 /* Flush the CS. */
94 void (*flush_cs)(struct r300_winsys* winsys);
95 };
96
97 struct pipe_context* r300_create_context(struct pipe_screen* screen,
98 struct r300_winsys* r300_winsys);
99
100 boolean r300_get_texture_buffer(struct pipe_texture* texture,
101 struct pipe_buffer** buffer,
102 unsigned* stride);
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif /* R300_WINSYS_H */