fork
Configure Feed
Select the types of activity you want to include in your feed.
The open source OpenXR runtime
fork
Configure Feed
Select the types of activity you want to include in your feed.
1// Copyright 2022-2023, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Small helper functions to manage frames.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup comp_main
8 */
9
10#pragma once
11
12#include "main/comp_compositor.h"
13
14
15/*!
16 * Is this frame invalid.
17 */
18static inline bool
19comp_frame_is_invalid_locked(struct comp_frame *f)
20{
21 return f->id == -1;
22}
23
24/*!
25 * Clear a slot, need to be externally synchronized.
26 */
27static inline void
28comp_frame_clear_locked(struct comp_frame *slot)
29{
30 U_ZERO(slot);
31 slot->id = -1;
32}
33
34/*!
35 * Move a frame into a cleared frame, need to be externally synchronized.
36 */
37static inline void
38comp_frame_move_into_cleared(struct comp_frame *dst, struct comp_frame *src)
39{
40 assert(comp_frame_is_invalid_locked(dst));
41
42 // Copy data.
43 *dst = *src;
44
45 U_ZERO(src);
46 src->id = -1;
47}
48
49/*!
50 * Move a frame, clear src, need to be externally synchronized.
51 */
52static inline void
53comp_frame_move_and_clear_locked(struct comp_frame *dst, struct comp_frame *src)
54{
55 comp_frame_clear_locked(dst);
56 comp_frame_move_into_cleared(dst, src);
57}