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