2 * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
4 * This file is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "xf86drmMode.h"
26 #include "pipe/p_compiler.h"
27 #include "util/u_inlines.h"
28 #include "pipe/p_defines.h"
37 typedef int (*radeon_state_pm4_t
)(struct radeon_state
*state
);
38 struct radeon_register
{
46 struct pipe_reference reference
;
54 struct radeon_sub_type
{
56 const struct radeon_register
*regs
;
60 struct radeon_stype_info
{
64 radeon_state_pm4_t pm4
;
65 struct radeon_sub_type reginfo
[R600_SHADER_MAX
];
71 struct radeon
*radeon
;
76 struct radeon_cs_reloc
*reloc
;
78 struct radeon_bo
**bo
;
86 enum chip_class chip_class
;
88 struct radeon_stype_info
*stype
;
90 boolean use_mem_constant
; /* true for evergreen */
91 struct pb_manager
*mman
; /* malloc manager */
92 struct pb_manager
*kman
; /* kernel bo manager */
93 struct pb_manager
*cman
; /* cached bo manager */
97 struct pipe_reference reference
;
101 extern struct radeon
*radeon_new(int fd
, unsigned device
);
102 extern struct radeon
*radeon_incref(struct radeon
*radeon
);
103 extern struct radeon
*radeon_decref(struct radeon
*radeon
);
104 extern unsigned radeon_family_from_device(unsigned device
);
105 extern int radeon_is_family_compatible(unsigned family1
, unsigned family2
);
108 * r600/r700 context functions
110 extern int r600_init(struct radeon
*radeon
);
111 extern int r600_ctx_draw(struct radeon_ctx
*ctx
);
112 extern int r600_ctx_next_reloc(struct radeon_ctx
*ctx
, unsigned *reloc
);
115 * radeon state functions
117 extern u32
radeon_state_register_get(struct radeon_state
*state
, unsigned offset
);
118 extern int radeon_state_register_set(struct radeon_state
*state
, unsigned offset
, u32 value
);
119 extern struct radeon_state
*radeon_state_duplicate(struct radeon_state
*state
);
120 extern int radeon_state_replace_always(struct radeon_state
*ostate
, struct radeon_state
*nstate
);
121 extern int radeon_state_pm4_generic(struct radeon_state
*state
);
122 extern int radeon_state_reloc(struct radeon_state
*state
, unsigned id
, unsigned bo_id
);
125 * radeon draw functions
127 extern int radeon_draw_pm4(struct radeon_draw
*draw
);
129 /* ws bo winsys only */
130 unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo
*bo
);
131 unsigned radeon_ws_bo_get_size(struct radeon_ws_bo
*bo
);
134 struct radeon_bo
*radeon_bo(struct radeon
*radeon
, unsigned handle
,
135 unsigned size
, unsigned alignment
, void *ptr
);
136 int radeon_bo_map(struct radeon
*radeon
, struct radeon_bo
*bo
);
137 void radeon_bo_unmap(struct radeon
*radeon
, struct radeon_bo
*bo
);
138 void radeon_bo_reference(struct radeon
*radeon
, struct radeon_bo
**dst
,
139 struct radeon_bo
*src
);
140 int radeon_bo_wait(struct radeon
*radeon
, struct radeon_bo
*bo
);
141 int radeon_bo_busy(struct radeon
*radeon
, struct radeon_bo
*bo
, uint32_t *domain
);
143 /* pipebuffer kernel bo manager */
144 struct pb_manager
*radeon_bo_pbmgr_create(struct radeon
*radeon
);
145 struct radeon_bo
*radeon_bo_pb_get_bo(struct pb_buffer
*_buf
);
146 void radeon_bo_pbmgr_flush_maps(struct pb_manager
*_mgr
);
147 struct pb_buffer
*radeon_bo_pb_create_buffer_from_handle(struct pb_manager
*_mgr
,