2 * © Copyright 2019 Alyssa Rosenzweig
3 * © Copyright 2019 Collabora, Ltd.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
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 FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 #include <panfrost-misc.h>
30 #include "pipe/p_state.h"
31 #include "util/list.h"
33 struct panfrost_screen
;
35 /* Flags for allocated memory */
37 /* This memory region is executable */
38 #define PAN_BO_EXECUTE (1 << 0)
40 /* This memory region should be lazily allocated and grow-on-page-fault. Must
41 * be used in conjunction with INVISIBLE */
42 #define PAN_BO_GROWABLE (1 << 1)
44 /* This memory region should not be mapped to the CPU */
45 #define PAN_BO_INVISIBLE (1 << 2)
47 /* This memory region will be used for varyings and needs to have the cache
48 * bits twiddled accordingly */
49 #define PAN_BO_COHERENT_LOCAL (1 << 3)
51 /* This region may not be used immediately and will not mmap on allocate
52 * (semantically distinct from INVISIBLE, which cannot never be mmaped) */
53 #define PAN_BO_DELAY_MMAP (1 << 4)
56 /* Must be first for casting */
57 struct list_head link
;
59 struct pipe_reference reference
;
61 struct panfrost_screen
*screen
;
63 /* Mapping for the entire object (all levels) */
66 /* GPU address for the object */
69 /* Size of all entire trees */
78 panfrost_bo_reference(struct panfrost_bo
*bo
);
80 panfrost_bo_unreference(struct panfrost_bo
*bo
);
82 panfrost_bo_create(struct panfrost_screen
*screen
, size_t size
,
85 panfrost_bo_mmap(struct panfrost_bo
*bo
);
87 panfrost_bo_release(struct panfrost_bo
*bo
, bool cacheable
);
89 panfrost_bo_import(struct panfrost_screen
*screen
, int fd
);
91 panfrost_bo_export(struct panfrost_bo
*bo
);
93 panfrost_bo_cache_evict_all(struct panfrost_screen
*screen
);
95 #endif /* __PAN_BO_H__ */