xref: /aosp_15_r20/external/mesa3d/src/panfrost/shared/pan_tiling.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard Worker /*
2*61046927SAndroid Build Coastguard Worker  * Copyright (c) 2011-2013 Luc Verhaegen <[email protected]>
3*61046927SAndroid Build Coastguard Worker  * Copyright (c) 2018 Alyssa Rosenzweig <[email protected]>
4*61046927SAndroid Build Coastguard Worker  * Copyright (c) 2018 Vasily Khoruzhick <[email protected]>
5*61046927SAndroid Build Coastguard Worker  *
6*61046927SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
7*61046927SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
8*61046927SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
9*61046927SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sub license,
10*61046927SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
11*61046927SAndroid Build Coastguard Worker  * Software is furnished to do so, subject to the following conditions:
12*61046927SAndroid Build Coastguard Worker  *
13*61046927SAndroid Build Coastguard Worker  * The above copyright notice and this permission notice (including the
14*61046927SAndroid Build Coastguard Worker  * next paragraph) shall be included in all copies or substantial portions
15*61046927SAndroid Build Coastguard Worker  * of the Software.
16*61046927SAndroid Build Coastguard Worker  *
17*61046927SAndroid Build Coastguard Worker  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18*61046927SAndroid Build Coastguard Worker  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*61046927SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20*61046927SAndroid Build Coastguard Worker  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21*61046927SAndroid Build Coastguard Worker  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22*61046927SAndroid Build Coastguard Worker  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23*61046927SAndroid Build Coastguard Worker  * DEALINGS IN THE SOFTWARE.
24*61046927SAndroid Build Coastguard Worker  *
25*61046927SAndroid Build Coastguard Worker  */
26*61046927SAndroid Build Coastguard Worker 
27*61046927SAndroid Build Coastguard Worker #ifndef H_PANFROST_TILING
28*61046927SAndroid Build Coastguard Worker #define H_PANFROST_TILING
29*61046927SAndroid Build Coastguard Worker 
30*61046927SAndroid Build Coastguard Worker #include <stdint.h>
31*61046927SAndroid Build Coastguard Worker #include <util/format/u_format.h>
32*61046927SAndroid Build Coastguard Worker 
33*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
34*61046927SAndroid Build Coastguard Worker extern "C" {
35*61046927SAndroid Build Coastguard Worker #endif
36*61046927SAndroid Build Coastguard Worker 
37*61046927SAndroid Build Coastguard Worker /**
38*61046927SAndroid Build Coastguard Worker  * Load a rectangular region from a tiled image to a linear staging image.
39*61046927SAndroid Build Coastguard Worker  *
40*61046927SAndroid Build Coastguard Worker  * @dst Linear destination
41*61046927SAndroid Build Coastguard Worker  * @src Tiled source
42*61046927SAndroid Build Coastguard Worker  * @x Region of interest of source in pixels, aligned to block size
43*61046927SAndroid Build Coastguard Worker  * @y Region of interest of source in pixels, aligned to block size
44*61046927SAndroid Build Coastguard Worker  * @z Region of interest of source in pixels, aligned to block size
45*61046927SAndroid Build Coastguard Worker  * @w Region of interest of source in pixels, aligned to block size
46*61046927SAndroid Build Coastguard Worker  * @dst_stride Stride in bytes of linear destination
47*61046927SAndroid Build Coastguard Worker  * @src_stride Number of bytes between adjacent rows of tiles in source.
48*61046927SAndroid Build Coastguard Worker  * @format Format of the source and destination image
49*61046927SAndroid Build Coastguard Worker  */
50*61046927SAndroid Build Coastguard Worker void panfrost_load_tiled_image(void *dst, const void *src, unsigned x,
51*61046927SAndroid Build Coastguard Worker                                unsigned y, unsigned w, unsigned h,
52*61046927SAndroid Build Coastguard Worker                                uint32_t dst_stride, uint32_t src_stride,
53*61046927SAndroid Build Coastguard Worker                                enum pipe_format format);
54*61046927SAndroid Build Coastguard Worker 
55*61046927SAndroid Build Coastguard Worker /**
56*61046927SAndroid Build Coastguard Worker  * Store a linear staging image to a rectangular region of a tiled image.
57*61046927SAndroid Build Coastguard Worker  *
58*61046927SAndroid Build Coastguard Worker  * @dst Tiled destination
59*61046927SAndroid Build Coastguard Worker  * @src Linear source
60*61046927SAndroid Build Coastguard Worker  * @x Region of interest of destination in pixels, aligned to block size
61*61046927SAndroid Build Coastguard Worker  * @y Region of interest of destination in pixels, aligned to block size
62*61046927SAndroid Build Coastguard Worker  * @z Region of interest of destination in pixels, aligned to block size
63*61046927SAndroid Build Coastguard Worker  * @w Region of interest of destination in pixels, aligned to block size
64*61046927SAndroid Build Coastguard Worker  * @dst_stride Number of bytes between adjacent rows of tiles in destination.
65*61046927SAndroid Build Coastguard Worker  * @src_stride Stride in bytes of linear source
66*61046927SAndroid Build Coastguard Worker  * @format Format of the source and destination image
67*61046927SAndroid Build Coastguard Worker  */
68*61046927SAndroid Build Coastguard Worker void panfrost_store_tiled_image(void *dst, const void *src, unsigned x,
69*61046927SAndroid Build Coastguard Worker                                 unsigned y, unsigned w, unsigned h,
70*61046927SAndroid Build Coastguard Worker                                 uint32_t dst_stride, uint32_t src_stride,
71*61046927SAndroid Build Coastguard Worker                                 enum pipe_format format);
72*61046927SAndroid Build Coastguard Worker 
73*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
74*61046927SAndroid Build Coastguard Worker } /* extern C */
75*61046927SAndroid Build Coastguard Worker #endif
76*61046927SAndroid Build Coastguard Worker 
77*61046927SAndroid Build Coastguard Worker #endif
78