1/*
2 * Copyright (c) 2011-2013 Luc Verhaegen <libv@skynet.be>
3 * Copyright (c) 2018 Alyssa Rosenzweig <alyssa@rosenzweig.io>
4 * Copyright (c) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
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
34extern "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 */
50void panfrost_load_tiled_image(void *dst, const void *src,
51                               unsigned x, unsigned y,
52                               unsigned w, unsigned h,
53                               uint32_t dst_stride,
54                               uint32_t src_stride,
55                               enum pipe_format format);
56
57/**
58 * Store a linear staging image to a rectangular region of a tiled image.
59 *
60 * @dst Tiled destination
61 * @src Linear source
62 * @x Region of interest of destination in pixels, aligned to block size
63 * @y Region of interest of destination in pixels, aligned to block size
64 * @z Region of interest of destination in pixels, aligned to block size
65 * @w Region of interest of destination in pixels, aligned to block size
66 * @dst_stride Number of bytes between adjacent rows of tiles in destination.
67 * @src_stride Stride in bytes of linear source
68 * @format Format of the source and destination image
69 */
70void panfrost_store_tiled_image(void *dst, const void *src,
71                                unsigned x, unsigned y,
72                                unsigned w, unsigned h,
73                                uint32_t dst_stride,
74                                uint32_t src_stride,
75                                enum pipe_format format);
76
77
78#ifdef __cplusplus
79} /* extern C */
80#endif
81
82#endif
83