2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
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 #include <pipe/p_state.h>
27 #include <pipe/p_screen.h>
28 #include <pipebuffer/pb_buffer.h>
30 #include <radeon_drm.h>
32 #include "util/u_transfer.h"
34 /* Texture transfer. */
35 struct r600_transfer
{
37 struct pipe_transfer transfer
;
38 /* Buffer transfer. */
39 struct pipe_transfer
*buffer_transfer
;
52 struct pipe_screen screen
;
56 static INLINE
struct r600_screen
*r600_screen(struct pipe_screen
*screen
)
58 return (struct r600_screen
*)screen
;
61 /* Buffer functions. */
62 struct pipe_resource
*r600_buffer_create(struct pipe_screen
*screen
,
63 const struct pipe_resource
*templ
);
64 struct pipe_resource
*r600_user_buffer_create(struct pipe_screen
*screen
,
65 void *ptr
, unsigned bytes
,
67 unsigned r600_buffer_is_referenced_by_cs(struct pipe_context
*context
,
68 struct pipe_resource
*buf
,
69 unsigned face
, unsigned level
);
70 struct pipe_resource
*r600_buffer_from_handle(struct pipe_screen
*screen
,
71 struct winsys_handle
*whandle
);
73 /* Texture transfer functions. */
74 struct pipe_transfer
* r600_texture_get_transfer(struct pipe_context
*ctx
,
75 struct pipe_resource
*texture
,
76 struct pipe_subresource sr
,
78 const struct pipe_box
*box
);
79 void r600_texture_transfer_destroy(struct pipe_context
*ctx
,
80 struct pipe_transfer
*trans
);
81 void* r600_texture_transfer_map(struct pipe_context
*ctx
,
82 struct pipe_transfer
* transfer
);
83 void r600_texture_transfer_unmap(struct pipe_context
*ctx
,
84 struct pipe_transfer
* transfer
);
88 int r600_conv_pipe_format(unsigned pformat
, unsigned *format
);
89 int r600_conv_pipe_prim(unsigned pprim
, unsigned *prim
);
91 union r600_float_to_u32_u
{
96 static inline u32
r600_float_to_u32(float f
)
98 union r600_float_to_u32_u c
;