1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
31 #include "pipe/p_state.h"
32 #include "pipe/p_screen.h"
35 #include "brw_structs.h"
37 struct brw_winsys_screen
;
41 * Subclass of pipe_screen
45 struct pipe_screen base
;
46 struct brw_chipset chipset
;
47 struct brw_winsys_screen
*sws
;
51 * Subclass of pipe_transfer
55 struct pipe_transfer base
;
62 struct pipe_buffer base
;
64 /* One of either bo or user_buffer will be non-null, depending on
65 * whether this is a hardware or user buffer.
67 struct brw_winsys_buffer
*bo
;
75 #define BRW_TILING_NONE 0
76 #define BRW_TILING_Y 1
77 #define BRW_TILING_X 2
79 union brw_surface_id
{
91 struct pipe_surface base
;
92 union brw_surface_id id
;
93 struct brw_surface_state ss
;
94 struct brw_winsys_buffer
*bo
;
95 struct brw_surface
*next
, *prev
;
102 struct pipe_texture base
;
103 struct brw_winsys_buffer
*bo
;
104 struct brw_surface_state ss
;
106 unsigned *image_offset
[PIPE_MAX_TEXTURE_LEVELS
];
107 unsigned nr_images
[PIPE_MAX_TEXTURE_LEVELS
];
108 unsigned level_offset
[PIPE_MAX_TEXTURE_LEVELS
];
115 unsigned total_height
;
117 struct brw_surface views
[2];
125 static INLINE
struct brw_screen
*
126 brw_screen(struct pipe_screen
*pscreen
)
128 return (struct brw_screen
*) pscreen
;
131 static INLINE
struct brw_transfer
*
132 brw_transfer(struct pipe_transfer
*transfer
)
134 return (struct brw_transfer
*)transfer
;
137 static INLINE
struct brw_surface
*
138 brw_surface(struct pipe_surface
*surface
)
140 return (struct brw_surface
*)surface
;
143 static INLINE
struct brw_buffer
*
144 brw_buffer(struct pipe_buffer
*buffer
)
146 return (struct brw_buffer
*)buffer
;
149 static INLINE
struct brw_texture
*
150 brw_texture(struct pipe_texture
*texture
)
152 return (struct brw_texture
*)texture
;
156 /* Pipe buffer helpers
158 static INLINE boolean
159 brw_buffer_is_user_buffer( const struct pipe_buffer
*buf
)
161 return ((const struct brw_buffer
*)buf
)->user_buffer
!= NULL
;
164 struct brw_winsys_buffer
*
165 brw_surface_bo( struct pipe_surface
*surface
);
168 brw_surface_pitch( const struct pipe_surface
*surface
);
170 /***********************************************************************
173 GLboolean
brw_texture_layout(struct brw_screen
*brw_screen
,
174 struct brw_texture
*tex
);
176 void brw_update_texture( struct brw_screen
*brw_screen
,
177 struct brw_texture
*tex
);
180 void brw_screen_tex_init( struct brw_screen
*brw_screen
);
181 void brw_screen_tex_surface_init( struct brw_screen
*brw_screen
);
183 void brw_screen_buffer_init(struct brw_screen
*brw_screen
);
186 #endif /* BRW_SCREEN_H */