2 * Mesa 3-D graphics library
4 * Copyright (C) 2012-2013 LunarG, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #ifndef ILO_GPE_GEN6_H
29 #define ILO_GPE_GEN6_H
31 #include "genhw/genhw.h"
32 #include "intel_winsys.h"
34 #include "ilo_common.h"
38 * Translate winsys tiling to hardware tiling.
41 ilo_gpe_gen6_translate_winsys_tiling(enum intel_tiling_mode tiling
)
44 case INTEL_TILING_NONE
:
45 return GEN6_TILING_NONE
;
51 assert(!"unknown tiling");
52 return GEN6_TILING_NONE
;
57 * Translate a pipe texture target to the matching hardware surface type.
60 ilo_gpe_gen6_translate_texture(enum pipe_texture_target target
)
64 return GEN6_SURFTYPE_BUFFER
;
66 case PIPE_TEXTURE_1D_ARRAY
:
67 return GEN6_SURFTYPE_1D
;
69 case PIPE_TEXTURE_RECT
:
70 case PIPE_TEXTURE_2D_ARRAY
:
71 return GEN6_SURFTYPE_2D
;
73 return GEN6_SURFTYPE_3D
;
74 case PIPE_TEXTURE_CUBE
:
75 case PIPE_TEXTURE_CUBE_ARRAY
:
76 return GEN6_SURFTYPE_CUBE
;
78 assert(!"unknown texture target");
79 return GEN6_SURFTYPE_BUFFER
;
84 zs_align_surface(const struct ilo_dev_info
*dev
,
85 unsigned align_w
, unsigned align_h
,
86 struct ilo_zs_surface
*zs
)
88 unsigned mask
, shift_w
, shift_h
;
89 unsigned width
, height
;
92 ILO_DEV_ASSERT(dev
, 6, 7.5);
94 if (ilo_dev_gen(dev
) >= ILO_GEN(7)) {
105 dw3
= zs
->payload
[2];
107 /* aligned width and height */
108 width
= align(((dw3
>> shift_w
) & mask
) + 1, align_w
);
109 height
= align(((dw3
>> shift_h
) & mask
) + 1, align_h
);
111 dw3
= (dw3
& ~((mask
<< shift_w
) | (mask
<< shift_h
))) |
112 (width
- 1) << shift_w
|
113 (height
- 1) << shift_h
;
115 zs
->payload
[2] = dw3
;
118 #endif /* ILO_GPE_GEN6_H */