1/*
2 * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 *    Binglin Chen <binglin.chen@intel.com>
26 *
27 */
28
29#ifndef _VSP_VPP_H_
30#define _VSP_VPP_H_
31
32#include "psb_drv_video.h"
33#include "vsp_fw.h"
34
35#define CONTEXT_VPP_ID 0
36#define CONTEXT_VP8_ID 1
37#define CONTEXT_COMPOSE_ID 5
38
39struct context_VPP_s {
40	object_context_p obj_context; /* back reference */
41
42	uint32_t profile; // ENTDEC BE_PROFILE & FE_PROFILE
43	uint32_t profile_idc; // BE_PROFILEIDC
44
45	struct psb_buffer_s *context_buf;
46	struct psb_buffer_s *intermediate_buf;
47
48	VABufferID *filters;
49	unsigned int num_filters;
50
51	enum vsp_format format;
52
53	object_buffer_p filter_buf[VssProcPipelineMaxNumFilters];
54	object_buffer_p frc_buf;
55
56	unsigned int param_sz;
57	unsigned int pic_param_sz;
58	unsigned int pic_param_offset;
59	unsigned int end_param_sz;
60	unsigned int end_param_offset;
61	unsigned int pipeline_param_sz;
62	unsigned int pipeline_param_offset;
63	unsigned int denoise_param_sz;
64	unsigned int denoise_param_offset;
65	unsigned int enhancer_param_sz;
66	unsigned int enhancer_param_offset;
67	unsigned int sharpen_param_sz;
68	unsigned int sharpen_param_offset;
69	unsigned int frc_param_sz;
70	unsigned int frc_param_offset;
71	unsigned int seq_param_sz;
72	unsigned int seq_param_offset;
73	unsigned int ref_param_sz;
74	unsigned int ref_param_offset;
75	unsigned int compose_param_sz;
76	unsigned int compose_param_offset;
77	struct VssProcDenoiseParameterBuffer denoise_deblock_param;
78	struct VssProcColorEnhancementParameterBuffer enhancer_param;
79	struct VssProcSharpenParameterBuffer sharpen_param;
80	//used for vp8 only
81       unsigned int max_frame_size;
82       unsigned int vp8_seq_cmd_send;
83       unsigned int re_send_seq_params;
84       unsigned int temporal_layer_number;
85       unsigned int frame_rate[3];
86        struct VssVp8encSequenceParameterBuffer vp8_seq_param;
87};
88
89typedef struct context_VPP_s *context_VPP_p;
90
91extern struct format_vtable_s vsp_VPP_vtable;
92
93/**
94 * Queries video processing filters.
95 *
96 * This function returns the list of video processing filters supported
97 * by the driver. The filters array is allocated by the user and
98 * num_filters shall be initialized to the number of allocated
99 * elements in that array. Upon successful return, the actual number
100 * of filters will be overwritten into num_filters. Otherwise,
101 * VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and num_filters
102 * is adjusted to the number of elements that would be returned if enough
103 * space was available.
104 *
105 * The list of video processing filters supported by the driver shall
106 * be ordered in the way they can be iteratively applied. This is needed
107 * for both correctness, i.e. some filters would not mean anything if
108 * applied at the beginning of the pipeline; but also for performance
109 * since some filters can be applied in a single pass (e.g. noise
110 * reduction + deinterlacing).
111 *
112 */
113VAStatus vsp_QueryVideoProcFilters(
114        VADriverContextP    ctx,
115        VAContextID         context,
116        VAProcFilterType   *filters,
117        unsigned int       *num_filters
118	);
119
120/**
121 * Queries video filter capabilities.
122 *
123 * This function returns the list of capabilities supported by the driver
124 * for a specific video filter. The filter_caps array is allocated by
125 * the user and num_filter_caps shall be initialized to the number
126 * of allocated elements in that array. Upon successful return, the
127 * actual number of filters will be overwritten into num_filter_caps.
128 * Otherwise, VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
129 * num_filter_caps is adjusted to the number of elements that would be
130 * returned if enough space was available.
131 *
132 */
133VAStatus vsp_QueryVideoProcFilterCaps(
134        VADriverContextP    ctx,
135        VAContextID         context,
136        VAProcFilterType    type,
137        void               *filter_caps,
138        unsigned int       *num_filter_caps
139	);
140
141/**
142 * Queries video processing pipeline capabilities.
143 *
144 * This function returns the video processing pipeline capabilities. The
145 * filters array defines the video processing pipeline and is an array
146 * of buffers holding filter parameters.
147 *
148 * Note: the VAProcPipelineCaps structure contains user-provided arrays.
149 * If non-NULL, the corresponding num_* fields shall be filled in on
150 * input with the number of elements allocated. Upon successful return,
151 * the actual number of elements will be overwritten into the num_*
152 * fields. Otherwise, VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned
153 * and num_* fields are adjusted to the number of elements that would
154 * be returned if enough space was available.
155 *
156 */
157VAStatus vsp_QueryVideoProcPipelineCaps(
158	VADriverContextP    ctx,
159        VAContextID         context,
160        VABufferID         *filters,
161        unsigned int        num_filters,
162        VAProcPipelineCaps *pipeline_caps
163    );
164
165#endif /* _VSS_VPP_H_ */
166