revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mesa / src / gallium / drivers / i915 / i915_resource.h
blob14eed2c4a7989f8d033dac2b8bbbe3e88d2d4b2a
1 /**************************************************************************
2 *
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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
16 * of the Software.
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 **************************************************************************/
28 #ifndef I915_RESOURCE_H
29 #define I915_RESOURCE_H
31 struct i915_screen;
33 #include "util/u_transfer.h"
34 #include "util/u_debug.h"
35 #include "i915_winsys.h"
38 struct i915_context;
39 struct i915_screen;
42 struct i915_buffer {
43 struct u_resource b;
44 uint8_t *data;
45 boolean free_on_destroy;
49 /* Texture transfer. */
50 struct i915_transfer {
51 /* Base class. */
52 struct pipe_transfer b;
53 struct pipe_resource *staging_texture;
57 #define I915_MAX_TEXTURE_2D_LEVELS 12 /* max 2048x2048 */
58 #define I915_MAX_TEXTURE_3D_LEVELS 9 /* max 256x256x256 */
61 struct offset_pair {
62 unsigned short nblocksx;
63 unsigned short nblocksy;
66 struct i915_texture {
67 struct u_resource b;
69 /* tiling flags */
70 enum i915_winsys_buffer_tile tiling;
71 unsigned stride;
72 unsigned depth_stride; /* per-image on i945? */
73 unsigned total_nblocksy;
75 unsigned nr_images[I915_MAX_TEXTURE_2D_LEVELS];
77 /* Explicitly store the offset of each image for each cube face or
78 * depth value.
80 * Array [depth] off offsets.
82 struct offset_pair *image_offset[I915_MAX_TEXTURE_2D_LEVELS];
84 /* The data is held here:
86 struct i915_winsys_buffer *buffer;
89 unsigned i915_texture_offset(struct i915_texture *tex,
90 unsigned level, unsigned layer);
91 void i915_init_screen_resource_functions(struct i915_screen *is);
92 void i915_init_resource_functions(struct i915_context *i915);
94 extern struct u_resource_vtbl i915_buffer_vtbl;
95 extern struct u_resource_vtbl i915_texture_vtbl;
97 static INLINE struct i915_texture *i915_texture(struct pipe_resource *resource)
99 struct i915_texture *tex = (struct i915_texture *)resource;
100 assert(tex->b.vtbl == &i915_texture_vtbl);
101 return tex;
104 static INLINE struct i915_buffer *i915_buffer(struct pipe_resource *resource)
106 struct i915_buffer *tex = (struct i915_buffer *)resource;
107 assert(tex->b.vtbl == &i915_buffer_vtbl);
108 return tex;
111 struct pipe_resource *
112 i915_texture_create(struct pipe_screen *screen,
113 const struct pipe_resource *template,
114 boolean force_untiled);
116 struct pipe_resource *
117 i915_texture_from_handle(struct pipe_screen * screen,
118 const struct pipe_resource *template,
119 struct winsys_handle *whandle);
122 struct pipe_resource *
123 i915_user_buffer_create(struct pipe_screen *screen,
124 void *ptr,
125 unsigned bytes,
126 unsigned usage);
128 struct pipe_resource *
129 i915_buffer_create(struct pipe_screen *screen,
130 const struct pipe_resource *template);
132 #endif /* I915_RESOURCE_H */