2413f0de33c16e8a2988ae185f0bbdcf064ab6b3
1 /**************************************************************************
3 * Copyright 2006 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 **************************************************************************/
28 #ifndef INTEL_REGIONS_H
29 #define INTEL_REGIONS_H
32 #include "bufmgr.h" /* for DBG! */
35 /* A layer on top of the bufmgr buffers that adds a few useful things:
37 * - Refcounting for local buffer references.
38 * - Refcounting for buffer maps
39 * - Buffer dimensions - pitch and height.
40 * - Blitter commands for copying 2D regions between buffers.
43 struct buffer
*buffer
;
53 /* Allocate a refcounted region. Pointers to regions should only be
54 * copied by calling intel_reference_region().
56 * No support for dynamically allocating tiled regions at this point.
58 struct intel_region
*intel_region_alloc( struct intel_context
*intel
,
63 void intel_region_reference( struct intel_region
**dst
,
64 struct intel_region
*src
);
66 void intel_region_release(struct intel_context
*intel
,
67 struct intel_region
**ib
);
69 /* Static regions may be tiled. The assumption is that the X server
70 * has set up fence registers to define tiled zones in agp and these
71 * buffers are within those zones. Tiling regions without fence
72 * registers is more work.
74 struct intel_region
*intel_region_create_static( struct intel_context
*intel
,
83 /* Map/unmap regions. This is refcounted also:
85 GLubyte
*intel_region_map(struct intel_context
*intel
,
86 struct intel_region
*ib
);
88 void intel_region_unmap(struct intel_context
*intel
,
89 struct intel_region
*ib
);
92 /* Upload data to a rectangular sub-region
94 GLboolean
intel_region_data(struct intel_context
*intel
,
95 struct intel_region
*dest
,
97 GLuint destx
, GLuint desty
,
98 const void *src
, GLuint src_stride
,
99 GLuint srcx
, GLuint srcy
,
100 GLuint width
, GLuint height
);
102 /* Copy rectangular sub-regions
104 void intel_region_copy( struct intel_context
*intel
,
105 struct intel_region
*dest
,
107 GLuint destx
, GLuint desty
,
108 struct intel_region
*src
,
110 GLuint srcx
, GLuint srcy
,
111 GLuint width
, GLuint height
);
113 /* Fill a rectangular sub-region
115 void intel_region_fill( struct intel_context
*intel
,
116 struct intel_region
*dest
,
118 GLuint destx
, GLuint desty
,
119 GLuint width
, GLuint height
,
123 /***********************************************************************
124 * Misc utilities: move to somewhere generic
126 void _mesa_copy_rect( GLubyte
*dst
,