blob: fd49a59187f5320040d04eabd27825ad14d4b36b [file] [log] [blame]
/*
* Copyright (C) 2018 Synaptics Incorporated. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED "AS-IS," AND
* SYNAPTICS EXPRESSLY DISCLAIMS ALL EXPRESS AND IMPLIED WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE, AND ANY WARRANTIES OF NON-INFRINGEMENT OF ANY
* INTELLECTUAL PROPERTY RIGHTS. IN NO EVENT SHALL SYNAPTICS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, OR
* CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN CONNECTION WITH THE USE
* OF THE INFORMATION CONTAINED IN THIS DOCUMENT, HOWEVER CAUSED AND
* BASED ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, AND EVEN IF SYNAPTICS WAS
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IF A TRIBUNAL OF
* COMPETENT JURISDICTION DOES NOT PERMIT THE DISCLAIMER OF DIRECT
* DAMAGES OR ANY OTHER DAMAGES, SYNAPTICS' TOTAL CUMULATIVE LIABILITY
* TO ANY PARTY SHALL NOT EXCEED ONE HUNDRED U.S. DOLLARS.
*/
#ifndef _FRAMEQUEUE_H_
#define _FRAMEQUEUE_H_
#include "vpp_com.h"
#ifdef __cplusplus
extern "C" {
#endif
/* structure for frame descriptor queue */
typedef struct FRAMEQUEUE_T {
void *frame_descrs[MAX_NUM_FRAMES];
int shadow_head;
int head;
int tail;
} FRAMEQUEUE;
/* frame queue APIs */
/******************************************************************************
* FUNCTION: reset frame queue to be empty state
* PARAMS: *frmq - pionter to a frame queue
*
******************************************************************************/
void frmq_reset(FRAMEQUEUE *frmq);
/******************************************************************************
* FUNCTION: push a frame descriptor into frame queue
* PARAMS: *frmq - pointer to frame queue
* *frm_descr - pointer to a frame descriptor
* RETURN: 1 - succeed
* 0 - fail: frame queue is full
******************************************************************************/
int frmq_push(FRAMEQUEUE *frmq, void *frm_descr);
/******************************************************************************
* FUNCTION: pop a frame descriptor out of a frame queue
* but actually without update head pointer.
* PARAMS: *frmq - pointer to a frame queue
* **frm_descr - pointer to the frame descriptor
* RETURN: 1 - succeed
* 0 - command queue is empty, no command is available
* NOTE: use pop_commit to actually update head pointer.
******************************************************************************/
int frmq_pop(FRAMEQUEUE *frmq, void **frm_descr);
/******************************************************************************
* FUNCTION: commit previous pop operation
* by actually update head pointer.
* PARAMS: *frmq - pointer to a frame queue
* RETURN: 1 - succeed
* 0 - command queue is empty, no command is available
******************************************************************************/
int frmq_pop_commit(FRAMEQUEUE *frmq);
#ifdef __cplusplus
}
#endif
#endif