2 * Copyright 2010 Marek Olšák <maraeo@gmail.com
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.
23 #ifndef R600_RESOURCE_H
24 #define R600_RESOURCE_H
26 #include "../../winsys/radeon/drm/radeon_winsys.h"
27 #include "../radeon/r600_pipe_common.h"
30 struct compute_memory_item
;
32 struct r600_resource_global
{
33 struct r600_resource base
;
34 struct compute_memory_item
*chunk
;
38 struct pipe_surface base
;
40 bool color_initialized
;
41 bool depth_initialized
;
43 /* Misc. color flags. */
44 bool alphatest_bypass
;
47 /* Color registers. */
48 unsigned cb_color_info
;
49 unsigned cb_color_base
;
50 unsigned cb_color_view
;
51 unsigned cb_color_size
; /* R600 only */
52 unsigned cb_color_dim
; /* EG only */
53 unsigned cb_color_pitch
; /* EG only */
54 unsigned cb_color_slice
; /* EG only */
55 unsigned cb_color_attrib
; /* EG only */
56 unsigned cb_color_fmask
; /* CB_COLORn_FMASK (EG) or CB_COLORn_FRAG (r600) */
57 unsigned cb_color_fmask_slice
; /* EG only */
58 unsigned cb_color_cmask
; /* CB_COLORn_CMASK (EG) or CB_COLORn_TILE (r600) */
59 unsigned cb_color_cmask_slice
; /* EG only */
60 unsigned cb_color_mask
; /* R600 only */
61 struct r600_resource
*cb_buffer_fmask
; /* Used for FMASK relocations. R600 only */
62 struct r600_resource
*cb_buffer_cmask
; /* Used for CMASK relocations. R600 only */
65 unsigned db_depth_info
; /* DB_Z_INFO (EG) or DB_DEPTH_INFO (r600) */
66 unsigned db_depth_base
; /* DB_Z_READ/WRITE_BASE (EG) or DB_DEPTH_BASE (r600) */
67 unsigned db_depth_view
;
68 unsigned db_depth_size
;
69 unsigned db_depth_slice
; /* EG only */
70 unsigned db_stencil_base
; /* EG only */
71 unsigned db_stencil_info
; /* EG only */
72 unsigned db_prefetch_limit
; /* R600 only */
73 unsigned pa_su_poly_offset_db_fmt_cntl
;
75 unsigned htile_enabled
;
76 unsigned db_htile_surface
;
77 unsigned db_htile_data_base
;
78 unsigned db_preload_control
;
81 /* Return if the depth format can be read without the DB->CB copy on r6xx-r7xx. */
82 static INLINE
bool r600_can_read_depth(struct r600_texture
*rtex
)
84 return rtex
->resource
.b
.b
.nr_samples
<= 1 &&
85 (rtex
->resource
.b
.b
.format
== PIPE_FORMAT_Z16_UNORM
||
86 rtex
->resource
.b
.b
.format
== PIPE_FORMAT_Z32_FLOAT
);