Monado OpenXR Runtime
u_sink_queue.c File Reference

An xrt_frame_sink queue. More...

#include "util/u_misc.h"
#include "util/u_sink.h"
#include "util/u_trace_marker.h"
#include <stdio.h>
#include <pthread.h>
Include dependency graph for u_sink_queue.c:

Data Structures

struct  u_sink_queue_elem
 
struct  u_sink_queue
 An xrt_frame_sink queue, any frames received will be pushed to the downstream consumer on the queue thread. More...
 

Functions

static bool queue_is_empty (struct u_sink_queue *q)
 Call with q->mutex locked. More...
 
static bool queue_is_full (struct u_sink_queue *q)
 Call with q->mutex locked. More...
 
static struct xrt_framequeue_pop (struct u_sink_queue *q)
 Pops the oldest frame, reference counting unchanged. More...
 
static bool queue_try_refpush (struct u_sink_queue *q, struct xrt_frame *xf)
 Tries to push a frame and increases its reference count. More...
 
static void queue_refclear (struct u_sink_queue *q)
 Clears the queue and unreferences all of its frames. More...
 
static void * queue_mainloop (void *ptr)
 
static void queue_frame (struct xrt_frame_sink *xfs, struct xrt_frame *xf)
 
static void queue_break_apart (struct xrt_frame_node *node)
 
static void queue_destroy (struct xrt_frame_node *node)
 
bool u_sink_queue_create (struct xrt_frame_context *xfctx, uint64_t max_size, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 

Detailed Description

Function Documentation

◆ queue_is_empty()

static bool queue_is_empty ( struct u_sink_queue q)
static

Call with q->mutex locked.

References u_sink_queue::size.

Referenced by queue_pop(), and queue_refclear().

◆ queue_is_full()

static bool queue_is_full ( struct u_sink_queue q)
static

Call with q->mutex locked.

References u_sink_queue::max_size, and u_sink_queue::size.

Referenced by queue_try_refpush().

◆ queue_pop()

static struct xrt_frame* queue_pop ( struct u_sink_queue q)
static

Pops the oldest frame, reference counting unchanged.

Call with q->mutex locked.

References u_sink_queue::back, u_sink_queue::front, queue_is_empty(), and u_sink_queue::size.

Referenced by queue_refclear().

◆ queue_refclear()

static void queue_refclear ( struct u_sink_queue q)
static

Clears the queue and unreferences all of its frames.

Call with q->mutex locked.

References u_sink_queue::back, u_sink_queue::front, queue_is_empty(), queue_pop(), u_sink_queue::size, and xrt_frame::xrt_frame_reference().

◆ queue_try_refpush()

static bool queue_try_refpush ( struct u_sink_queue q,
struct xrt_frame xf 
)
static

Tries to push a frame and increases its reference count.

Call with q->mutex locked.

References u_sink_queue::back, u_sink_queue::front, queue_is_full(), u_sink_queue::size, U_TYPED_CALLOC, and xrt_frame::xrt_frame_reference().