Debian Codegraph @

media_softlet/linux/common/vp/ddi/ddi_vp_functions.h

raw
1 /*
2 * Copyright (c) 2021-2022, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file ddi_vp_functions.h
24 //! \brief ddi vp functions head file
25 //!
26
27 #ifndef __DDI_VP_FUNCTIONS_H__
28 #define __DDI_VP_FUNCTIONS_H__
29
30 #include "ddi_media_functions.h"
31 #include "media_libva_common_next.h"
32 #include "vp_common.h"
33 #include "vp_base.h"
34
35 // Maximum primary surface number in VP
36 #define VP_MAX_PRIMARY_SURFS 1
37
38 // surface flag : 1 secure; 0 clear
39 #if (VA_MAJOR_VERSION < 1)
40 #define VPHAL_SURFACE_ENCRYPTION_FLAG 0x80000000
41 #else
42 #define VPHAL_SURFACE_ENCRYPTION_FLAG 0x00000001
43 #endif
44
45 #define DDI_VP_MAX_NUM_FILTERS VAProcFilterCount /* Some filters in va_private.h */
46
47 #if (_DEBUG || _RELEASE_INTERNAL)
48 typedef struct _DDI_VP_DUMP_PARAM
49 {
50 VAProcPipelineParameterBuffer *pPipelineParamBuffers[VPHAL_MAX_SOURCES] = {};
51 MOS_FORMAT SrcFormat[VPHAL_MAX_SOURCES] = {};
52 MOS_FORMAT TargetFormat[VPHAL_MAX_TARGETS] = {};
53 } DDI_VP_DUMP_PARAM, *PDDI_VP_DUMP_PARAM;
54 #endif //(_DEBUG || _RELEASE_INTERNAL)
55
56 typedef struct _DDI_VP_FRAMEID_TRACER
57 {
58 MOS_LINUX_BO *pLastSrcSurfBo;
59 MOS_LINUX_BO *pLastBwdSurfBo;
60
61 uint32_t uiLastSrcSurfFrameID;
62 uint32_t uiLastBwdSurfFrameID;
63
64 uint32_t uiFrameIndex;
65
66 uint32_t uiLastSampleType;
67 } DDI_VP_FRAMEID_TRACER;
68
69 class DdiCpInterface;
70 class DdiCpInterfaceNext;
71 //core structure for VP DDI
72 typedef struct DDI_VP_CONTEXT
73 {
74 // VPHAL internal structure
75 MOS_CONTEXT MosDrvCtx = {};
76 VpBase *pVpHal = nullptr;
77 VPHAL_RENDER_PARAMS *pVpHalRenderParams = nullptr;
78
79 DdiCpInterface *pCpDdiInterface = nullptr;
80 DdiCpInterfaceNext *pCpDdiInterfaceNext = nullptr;
81
82 // target surface id
83 VASurfaceID TargetSurfID = 0;
84
85 // Primary surface number
86 int32_t iPriSurfs = 0;
87
88 DDI_VP_FRAMEID_TRACER FrameIDTracer = {};
89
90 #if (_DEBUG || _RELEASE_INTERNAL)
91 DDI_VP_DUMP_PARAM *pCurVpDumpDDIParam = nullptr;
92 DDI_VP_DUMP_PARAM *pPreVpDumpDDIParam = nullptr;
93 FILE *fpDumpFile = nullptr;
94 #endif //(_DEBUG || _RELEASE_INTERNAL)
95
96 } DDI_VP_CONTEXT, *PDDI_VP_CONTEXT;
97
98 typedef struct _DDI_VP_STATE
99 {
100 bool bProcampEnable = false;
101 bool bDeinterlaceEnable = false;
102 bool bDenoiseEnable = false;
103 bool bIEFEnable = false;
104 } DDI_VP_STATE;
105
106 class DdiVpFunctions :public DdiMediaFunctions
107 {
108 public:
109
110 virtual ~DdiVpFunctions() override{};
111 //!
112 //! \brief Create context
113 //!
114 //! \param [in] ctx
115 //! Pointer to VA driver context
116 //! \param [in] configId
117 //! VA config id
118 //! \param [in] pictureWidth
119 //! Picture width
120 //! \param [in] pictureHeight
121 //! Picture height
122 //! \param [out] flag
123 //! Create flag
124 //! \param [in] renderTargets
125 //! VA render traget
126 //! \param [in] renderTargetsNum
127 //! Number of render targets
128 //! \param [out] ctxID
129 //! VA created context
130 //!
131 //! \return VAStatus
132 //! VA_STATUS_SUCCESS if success, else fail reason
133 //!
134 virtual VAStatus CreateContext (
135 VADriverContextP ctx,
136 VAConfigID configId,
137 int32_t pictureWidth,
138 int32_t pictureHeight,
139 int32_t flag,
140 VASurfaceID *renderTargets,
141 int32_t renderTargetsNum,
142 VAContextID *ctxID
143 ) override;
144
145 //!
146 //! \brief Destroy context
147 //!
148 //! \param [in] ctx
149 //! Pointer to VA driver context
150 //! \param [in] ctxID
151 //! VA context to destroy
152 //!
153 //! \return VAStatus
154 //! VA_STATUS_SUCCESS if success, else fail reason
155 //!
156 virtual VAStatus DestroyContext (
157 VADriverContextP ctx,
158 VAContextID ctxID
159 ) override;
160
161 //!
162 //! \brief Create buffer
163 //!
164 //! \param [in] ctx
165 //! Pointer to VA driver context
166 //! \param [in] context
167 //! VA context id
168 //! \param [in] type
169 //! VA buffer type
170 //! \param [in] size
171 //! Buffer size
172 //! \param [out] elementsNum
173 //! Number of elements
174 //! \param [in] data
175 //! Buffer data
176 //! \param [out] bufId
177 //! VA buffer id
178 //!
179 //! \return VAStatus
180 //! VA_STATUS_SUCCESS if success, else fail reason
181 //!
182 virtual VAStatus CreateBuffer (
183 VADriverContextP ctx,
184 VAContextID context,
185 VABufferType type,
186 uint32_t size,
187 uint32_t elementsNum,
188 void *data,
189 VABufferID *bufId
190 ) override;
191
192 //! \param [in] mediaCtx
193 //! Pointer to media context
194 //! \param [in] bufId
195 //! VA buffer ID
196 //! \param [out] buf
197 //! Pointer to buffer
198 //! \param [in] flag
199 //! Flag
200 //!
201 //! \return VAStatus
202 //! VA_STATUS_SUCCESS if success, else fail reason
203 //!
204 virtual VAStatus MapBufferInternal(
205 PDDI_MEDIA_CONTEXT mediaCtx,
206 VABufferID bufId,
207 void **buf,
208 uint32_t flag
209 ) override;
210
211 //! \brief Unmap buffer
212 //!
213 //! \param [in] mediaCtx
214 //! Pointer to media context
215 //! \param [in] bufId
216 //! VA buffer ID
217 //!
218 //! \return VAStatus
219 //! VA_STATUS_SUCCESS if success, else fail reason
220 //!
221 virtual VAStatus UnmapBuffer (
222 PDDI_MEDIA_CONTEXT mediaCtx,
223 VABufferID bufId
224 )override;
225
226 //!
227 //! \brief Destroy buffer
228 //!
229 //! \param [in] mediaCtx
230 //! Pointer to media context
231 //! \param [in] bufId
232 //! VA buffer ID
233 //!
234 //! \return VAStatus
235 //! VA_STATUS_SUCCESS if success, else fail reason
236 //!
237 virtual VAStatus DestroyBuffer(
238 DDI_MEDIA_CONTEXT *mediaCtx,
239 VABufferID bufId
240 )override;
241
242 //!
243 //! \brief Get ready to decode a picture to a target surface
244 //!
245 //! \param [in] ctx
246 //! Pointer to VA driver context
247 //! \param [in] context
248 //! VA context id
249 //! \param [in] renderTarget
250 //! VA render target surface
251 //!
252 //! \return VAStatus
253 //! VA_STATUS_SUCCESS if success, else fail reason
254 //!
255 virtual VAStatus BeginPicture (
256 VADriverContextP ctx,
257 VAContextID context,
258 VASurfaceID renderTarget
259 ) override;
260
261 //!
262 //! \brief Send decode buffers to the server
263 //! \details Buffers are automatically destroyed afterwards
264 //! \param [in] ctx
265 //! Pointer to VA driver context
266 //! \param [in] context
267 //! VA buffer id
268 //! \param [in] buffer
269 //! Pointer to VA buffer id
270 //! \param [in] buffersNum
271 //! number of buffers
272 //!
273 //! \return VAStatus
274 //! VA_STATUS_SUCCESS if success, else fail reason
275 //!
276 virtual VAStatus RenderPicture (
277 VADriverContextP ctx,
278 VAContextID context,
279 VABufferID *buffers,
280 int32_t buffersNum
281 ) override;
282
283 //!
284 //! \brief Make the end of rendering for a picture
285 //! \details The server should start processing all pending operations for this
286 //! surface. This call is non-blocking. The client can start another
287 //! Begin/Render/End sequence on a different render target
288 //! \param [in] ctx
289 //! Pointer to VA driver context
290 //! \param [in] context
291 //! VA buffer id
292 //!
293 //! \return VAStatus
294 //! VA_STATUS_SUCCESS if success, else fail reason
295 //!
296 virtual VAStatus EndPicture (
297 VADriverContextP ctx,
298 VAContextID context
299 ) override;
300
301 //!
302 //! \brief Create a configuration for the encode/decode/vp pipeline
303 //! \details it passes in the attribute list that specifies the attributes it cares
304 //! about, with the rest taking default values.
305 //!
306 //! \param [in] ctx
307 //! Pointer to VA driver context
308 //! \param [in] profile
309 //! VA profile of configuration
310 //! \param [in] entrypoint
311 //! VA entrypoint of configuration
312 //! \param [out] attribList
313 //! VA attrib list
314 //! \param [out] attribsNum
315 //! Number of attribs
316 //! \param [out] configId
317 //! VA config id
318 //!
319 //! \return VAStatus
320 //! VA_STATUS_SUCCESS if success, else fail reason
321 //!
322 virtual VAStatus CreateConfig (
323 VADriverContextP ctx,
324 VAProfile profile,
325 VAEntrypoint entrypoint,
326 VAConfigAttrib *attribList,
327 int32_t attribsNum,
328 VAConfigID *configId
329 ) override;
330
331 //!
332 //! \brief Query video proc filters
333 //!
334 //! \param [in] ctx
335 //! Pointer to VA driver context
336 //! \param [in] context
337 //! VA context ID
338 //! \param [in] filters
339 //! VA proc filter type
340 //! \param [in] filtersNum
341 //! Number of filters
342 //!
343 //! \return VAStatus
344 //! VA_STATUS_SUCCESS if success, else fail reason
345 //!
346 virtual VAStatus QueryVideoProcFilters (
347 VADriverContextP ctx,
348 VAContextID context,
349 VAProcFilterType *filters,
350 uint32_t *filtersNum
351 ) override;
352
353 //!
354 //! \brief Query video processing filter capabilities.
355 //! The real implementation is in media_libva_vp.c, since it needs to use some definitions in vphal.h.
356 //!
357 //! \param [in] ctx
358 //! Pointer to VA driver context
359 //! \param [in] context
360 //! VA context ID
361 //! \param [in] type
362 //! VA proc filter type
363 //! \param [inout] filterCaps
364 //! FIlter caps
365 //! \param [inout] filterCapsNum
366 //! Number of filter caps
367 //!
368 //! \return VAStatus
369 //! VA_STATUS_SUCCESS if success, else fail reason
370 //!
371 virtual VAStatus QueryVideoProcFilterCaps (
372 VADriverContextP ctx,
373 VAContextID context,
374 VAProcFilterType type,
375 void *filterCaps,
376 uint32_t *filterCapsNum
377 ) override;
378
379 //!
380 //! \brief Query video proc pipeline caps
381 //!
382 //! \param [in] ctx
383 //! Pointer to VA driver context
384 //! \param [in] context
385 //! VA context ID
386 //! \param [in] filters
387 //! VA buffer ID
388 //! \param [in] filtersNum
389 //! Number of filters
390 //! \param [in] pipelineCaps
391 //! VA proc pipeline caps
392 //!
393 //! \return VAStatus
394 //! VA_STATUS_SUCCESS if success, else fail reason
395 //!
396 virtual VAStatus QueryVideoProcPipelineCaps (
397 VADriverContextP ctx,
398 VAContextID context,
399 VABufferID *filters,
400 uint32_t filtersNum,
401 VAProcPipelineCaps *pipelineCaps
402 ) override;
403
404 virtual VAStatus StatusCheck(
405 PDDI_MEDIA_CONTEXT mediaCtx,
406 DDI_MEDIA_SURFACE *surface,
407 VASurfaceID surfaceId
408 ) override;
409
410 virtual VAStatus ProcessPipeline(
411 VADriverContextP vaDrvCtx,
412 VAContextID ctxID,
413 VASurfaceID srcSurface,
414 VARectangle *srcRect,
415 VASurfaceID dstSurface,
416 VARectangle *dstRect
417 ) override;
418
419 virtual VAStatus PutSurface(
420 VADriverContextP ctx,
421 VASurfaceID surface,
422 void *draw,
423 int16_t srcx,
424 int16_t srcy,
425 uint16_t srcw,
426 uint16_t srch,
427 int16_t destx,
428 int16_t desty,
429 uint16_t destw,
430 uint16_t desth,
431 VARectangle *cliprects,
432 uint32_t numberCliprects,
433 uint32_t flags
434 ) override;
435
436 //!
437 //! \brief Extract VAProcPipelineParameterBuffer params and set the appropriate VPHAL params
438 //!
439 //! \param [in] vaDrvCtx
440 //! VA Driver context
441 //! \param [in] vpCtx
442 //! VP context
443 //! \param [in] pipelineParam
444 //! Pipeline params from application (VAProcPipelineParameterBuffer)
445 //!
446 //! \returns VA_STATUS_SUCCESS if call succeeds
447 //!
448 VAStatus DdiSetProcPipelineParams(
449 VADriverContextP vaDrvCtx,
450 PDDI_VP_CONTEXT vpCtx,
451 VAProcPipelineParameterBuffer *pipelineParam);
452
453 private:
454 //!
455 //! \brief Helper function for VpAllocateDrvCtxExt to Allocate PDDI_VP_CONTEXT
456 //!
457 //! \param [in] vaDrvCtx
458 //! Pointer to VA driver context
459 //! \param [in] vpCtx
460 //! VP context
461 //!
462 //! \return VAStatus
463 //! VA_STATUS_SUCCESS if succeeds, else fail reason
464 VAStatus DdiInitCtx(
465 VADriverContextP vaDrvCtx,
466 PDDI_VP_CONTEXT vpCtx);
467
468 //!
469 //! \brief Free VPHAL Driver render params resources
470 //!
471 //! \param [in] vpCtx
472 //! VP context
473 //! \param [in] vpHalRenderParams
474 //! vphal render params
475 //! \return
476 //!
477 void FreeVpHalRenderParams(
478 PDDI_VP_CONTEXT vpCtx,
479 PVPHAL_RENDER_PARAMS vpHalRenderParams);
480
481 //!
482 //! \brief Initialize VPHAL State and VPHAL settings per VP context
483 //!
484 //! \param [in] vpCtx
485 //! VP context
486 //!
487 //! \return VAStatus
488 //! VA_STATUS_SUCCESS if succeeds, else fail reason
489 VAStatus DdiInitVpHal(PDDI_VP_CONTEXT vpCtx);
490
491 //!
492 //! \brief Destroy VPHAL driver context
493 //!
494 //! \param [in] vpCtx
495 //! VP context
496 //!
497 //! \return VAStatus
498 //! VA_STATUS_SUCCESS if succeeds, else fail reason
499 VAStatus DdiDestroyVpHal(PDDI_VP_CONTEXT vpCtx);
500
501 //!
502 //! \brief Destroy VPHAL driver render params
503 //!
504 //! \param [in] vpCtx
505 //! VP context
506 //!
507 //! \return VAStatus
508 //! VA_STATUS_SUCCESS if succeeds, else fail reason
509 VAStatus DdiDestroyRenderParams(PDDI_VP_CONTEXT vpCtx);
510
511 //!
512 //! \brief Destroy VPHAL driver source params
513 //!
514 //! \param [in] vpCtx
515 //! VP context
516 //!
517 //! \return VAStatus
518 //! VA_STATUS_SUCCESS if succeeds, else fail reason
519 VAStatus DdiDestroySrcParams(PDDI_VP_CONTEXT vpCtx);
520
521 //!
522 //! \brief Destroy VPHAL driver reference params
523 //!
524 //! \param [in] vpCtx
525 //! VP context
526 //!
527 //! \return VAStatus
528 //! VA_STATUS_SUCCESS if succeeds, else fail reason
529 VAStatus DdiDestroyVpHalSurface(PVPHAL_SURFACE surf);
530
531 //!
532 //! \brief Destroy VPHAL driver target params
533 //!
534 //! \param [in] vpCtx
535 //! VP context
536 //!
537 //! \return VAStatus
538 //! VA_STATUS_SUCCESS if succeeds, else fail reason
539 VAStatus DdiDestroyTargetParams(PDDI_VP_CONTEXT vpCtx);
540
541 //!
542 //! \brief Query video processing Noise reduction filter caps.
543 //!
544 //! \param [in] queryFlag
545 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
546 //! \param [in] queryCapsNum
547 //! The filter caps number queried by app layer
548 //! \param [in] existCapsNum
549 //! The actual number of filters in vp module
550 //! \param [inout] filterCaps
551 //! FIlter caps
552 //!
553 //! \return VAStatus
554 //! VA_STATUS_SUCCESS if success, else fail reason
555 //!
556 VAStatus QueryNoiseReductionCapsAttrib(
557 uint32_t queryFlag,
558 uint32_t queryCapsNum,
559 uint32_t existCapsNum,
560 void *filterCaps);
561
562 //!
563 //! \brief Query video processing Deinterlacing filter caps.
564 //!
565 //! \param [in] queryFlag
566 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
567 //! \param [in] queryCapsNum
568 //! The filter caps number queried by app layer
569 //! \param [in] existCapsNum
570 //! The actual number of filters in vp module
571 //! \param [inout] filterCaps
572 //! FIlter caps
573 //!
574 //! \return VAStatus
575 //! VA_STATUS_SUCCESS if success, else fail reason
576 //!
577 VAStatus QueryDeinterlacingCapsAttrib(
578 uint32_t queryFlag,
579 uint32_t queryCapsNum,
580 uint32_t existCapsNum,
581 void *filterCaps);
582
583 //!
584 //! \brief Query video processing Sharpening filter caps.
585 //!
586 //! \param [in] queryFlag
587 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
588 //! \param [in] queryCapsNum
589 //! The filter caps number queried by app layer
590 //! \param [in] existCapsNum
591 //! The actual number of filters in vp module
592 //! \param [inout] filterCaps
593 //! FIlter caps
594 //!
595 //! \return VAStatus
596 //! VA_STATUS_SUCCESS if success, else fail reason
597 //!
598 VAStatus QuerySharpeningCapsAttrib(
599 uint32_t queryFlag,
600 uint32_t queryCapsNum,
601 uint32_t existCapsNum,
602 void *filterCaps);
603
604 //!
605 //! \brief Query video processing Color balance filter caps.
606 //!
607 //! \param [in] queryFlag
608 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
609 //! \param [in] queryCapsNum
610 //! The filter caps number queried by app layer
611 //! \param [in] existCapsNum
612 //! The actual number of filters in vp module
613 //! \param [inout] filterCaps
614 //! FIlter caps
615 //!
616 //! \return VAStatus
617 //! VA_STATUS_SUCCESS if success, else fail reason
618 //!
619 VAStatus QueryColorBalanceCapsAttrib(
620 uint32_t queryFlag,
621 uint32_t queryCapsNum,
622 uint32_t existCapsNum,
623 void *filterCaps);
624
625 //!
626 //! \brief Query video processing SkinToneEnhancement filter caps.
627 //!
628 //! \param [in] queryFlag
629 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
630 //! \param [in] queryCapsNum
631 //! The filter caps number queried by app layer
632 //! \param [in] existCapsNum
633 //! The actual number of filters in vp module
634 //! \param [inout] filterCaps
635 //! FIlter caps
636 //!
637 //! \return VAStatus
638 //! VA_STATUS_SUCCESS if success, else fail reason
639 //!
640 VAStatus QuerySkinToneEnhancementCapsAttrib(
641 uint32_t queryFlag,
642 uint32_t queryCapsNum,
643 uint32_t existCapsNum,
644 void *filterCaps);
645
646 //!
647 //! \brief Query video processing TotalColorCorrection filter caps.
648 //!
649 //! \param [in] queryFlag
650 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
651 //! \param [in] queryCapsNum
652 //! The filter caps number queried by app layer
653 //! \param [in] existCapsNum
654 //! The actual number of filters in vp module
655 //! \param [inout] filterCaps
656 //! FIlter caps
657 //!
658 //! \return VAStatus
659 //! VA_STATUS_SUCCESS if success, else fail reason
660 //!
661 VAStatus QueryTotalColorCorrectionCapsAttrib(
662 uint32_t queryFlag,
663 uint32_t queryCapsNum,
664 uint32_t existCapsNum,
665 void *filterCaps);
666
667 //!
668 //! \brief Query video processing HDR filter caps.
669 //!
670 //! \param [in] queryFlag
671 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
672 //! \param [in] queryCapsNum
673 //! The filter caps number queried by app layer
674 //! \param [in] existCapsNum
675 //! The actual number of filters in vp module
676 //! \param [inout] filterCaps
677 //! FIlter caps
678 //!
679 //! \return VAStatus
680 //! VA_STATUS_SUCCESS if success, else fail reason
681 //!
682 VAStatus QueryHDRToneMappingCapsAttrib(
683 uint32_t queryFlag,
684 uint32_t queryCapsNum,
685 uint32_t existCapsNum,
686 void *filterCaps);
687
688 //!
689 //! \brief Query video processing 3Dlut filter caps.
690 //!
691 //! \param [in] queryFlag
692 //! QUERY_CAPS_ATTRIBUTE: search caps attribute
693 //! \param [in] queryCapsNum
694 //! The filter caps number queried by app layer
695 //! \param [in] existCapsNum
696 //! The actual number of filters in vp module
697 //! \param [inout] filterCaps
698 //! FIlter caps
699 //!
700 //! \return VAStatus
701 //! VA_STATUS_SUCCESS if success, else fail reason
702 //!
703 VAStatus QueryLut3DCapsAttrib(
704 uint32_t queryFlag,
705 uint32_t queryCapsNum,
706 uint32_t existCapsNum,
707 void *filterCaps);
708
709 //! \brief Get the render parameters from Va Driver Context.
710 //!
711 //! \params [in] vpCtx
712 //! VP context
713 //!
714 //! \returns Pointer of render parameters
715 //!
716 PVPHAL_RENDER_PARAMS VpGetRenderParams(PDDI_VP_CONTEXT vpCtx);
717
718 //! \brief Get resource informaton from target surface, set OS Resource for VPHAL
719 //!
720 //! \params [in] pVpCtx
721 //! VP context
722 //! \params [in] boRt
723 //! media surface
724 //! \params [in] targetIndex
725 //! index of target surface in VpHal RenderParams.
726 //!
727 //! \returns: Result of operation
728 //!
729 VAStatus VpSetOsResource(PDDI_VP_CONTEXT vpCtx, PDDI_MEDIA_SURFACE boRt, uint32_t targetIndex);
730
731 //! \brief Set Render Params for VPHAL
732 //!
733 //! \params [in] mediaSurf
734 //! media surface
735 //! \params [inout] vpHalRenderParams
736 //! PVPHAL_RENDER_PARAMS.
737 //! \params [in] renderTarget
738 //! surface ID.
739 //!
740 void VpSetRenderParams(
741 PDDI_MEDIA_SURFACE mediaSurf,
742 PVPHAL_RENDER_PARAMS vpHalRenderParams,
743 VASurfaceID renderTarget);
744
745 //! \brief judge whether the pitch size match 16aligned usrptr path require or not
746 //!
747 //! \params [in] pitch
748 //! surface pitch size.
749 //! \params [in] format
750 //! surface foramt
751 //! \returns true if matched
752 //! for YV12 format, if pitch aligned with 128, go legacy path; if aligned with 16/32/64, go 16usrptr path
753 //! for other formats, legcy path for aligned with 64, 16usrpt path for aligned with 16/32
754 //!
755 bool VpIs16UsrPtrPitch(uint32_t pitch, DDI_MEDIA_FORMAT format);
756
757 //!
758 //! \brief dump feature mode parameters for Android
759 //!
760 //! \param [in] vpCtx
761 //! vp context
762 //! \return VAStatus
763 //! return VA_STATUS_SUCCESS if params is dumped to file.
764 //!
765 VAStatus VpReportFeatureMode(PDDI_VP_CONTEXT vpCtx);
766
767 //!
768 //! \brief initialize configuration values for Android
769 //!
770 //! \param [in] configValues
771 //! vp config values
772 //!
773 void VpConfigValuesInit(PVP_CONFIG configValues);
774
775 //!
776 //! \brief Report mode of different features
777 //!
778 //! \param [in] vpHalState
779 //! VPHAL state pointer
780 //! \param [inout] configValues
781 //! Porinter to configuration report value structure,
782 //! feature modes will be store in this structure.
783 //! \return void
784 //!
785 void VpHalDdiReportFeatureMode(
786 VpBase *vpHalState,
787 PVP_CONFIG configValues);
788
789 //!
790 //! \brief dump config values for Android
791 //!
792 //! \param [in] config
793 //! vp config values
794 //!
795 void VpFeatureReport(PVP_CONFIG config, PDDI_VP_CONTEXT vpCtx);
796
797 //!
798 //! \purpose judge whether the PipelineParam buffer is for target or not
799 //!
800 //! \param [in] vaDrvCtx
801 //! VA Driver context
802 //! \param [in] vpCtx
803 //! VP context
804 //! \param [in] pipelineParam
805 //! Pipeline parameters from application (VAProcPipelineParameterBuffer)
806 //!
807 //! \returns VA_STATUS_SUCCESS if call succeeds
808 //!
809 bool VpIsRenderTarget(
810 VADriverContextP vaDrvCtx,
811 PDDI_VP_CONTEXT vpCtx,
812 VAProcPipelineParameterBuffer *pipelineParam);
813
814 VAStatus DdiSetGpuPriority(
815 PDDI_VP_CONTEXT vpCtx,
816 int32_t priority);
817
818 //!
819 //! \brief Extract VAProcPipelineParameterBuffer params for target surface and set the appropriate VPHAL params
820 //!
821 //! \param [in] vaDrvCtx
822 //! VA Driver context
823 //! \param [in] vpCtx
824 //! VP context
825 //! \param [in] pipelineParam
826 //! Pipeline parameters from application (VAProcPipelineParameterBuffer)
827 //!
828 //! \returns VA_STATUS_SUCCESS if call succeeds
829 //!
830 VAStatus VpSetRenderTargetParams(
831 VADriverContextP vaDrvCtx,
832 PDDI_VP_CONTEXT vpCtx,
833 VAProcPipelineParameterBuffer *pipelineParam);
834
835 //!
836 //! \brief Set Color Standard Explictly.
837 //!
838 //! \param [in] vpHalSurf
839 //! src/target surface
840 //! \param [in] colorStandard
841 //! VA color standard VAProcColorStandardType
842 //! \param [in] colorProperties
843 //! input/output surface color properties
844 //! \returns appropriate VA_STATUS_SUCCESS if call succeeds
845 //!
846 VAStatus VpSetColorStandardExplictly(
847 PVPHAL_SURFACE vpHalSurf,
848 VAProcColorStandardType colorStandard,
849 VAProcColorProperties colorProperties);
850
851 //!
852 //! \brief // Set colorspace by default to avoid application don't set ColorStandard
853 //!
854 //! \param [in] vpHalSurf
855 //! src/target surface
856 //!
857 void VpSetColorSpaceByDefault(PVPHAL_SURFACE vpHalSurf);
858
859 //!
860 //! \brief Set Color Space according to ColorStandard.
861 //!
862 //! \param [in] vpHalSurf
863 //! src/target surface
864 //! \param [in] colorStandard
865 //! VA color standard VAProcColorStandardType
866 //! \param [in] colorProperties
867 //! input/output surface color properties
868 //! \returns
869 //!
870 void VpSetColorSpaceByColorStandard(
871 PVPHAL_SURFACE vpHalSurf,
872 VAProcColorStandardType colorStandard,
873 VAProcColorProperties colorProperties,
874 uint8_t colorRange);
875
876 //!
877 //! \brief Set Color Space according to ColorStandard.
878 //!
879 //! \param [in] vpCtx
880 //! vp context
881 //! \param [in] srcSurf
882 //! vphal surface
883 //! \returns
884 //!
885 void SetFrameID(PDDI_VP_CONTEXT vpCtx, PVPHAL_SURFACE srcSurf);
886
887 //!
888 //! \brief update sample type
889 //!
890 //! \param [in] srcSurf
891 //! vphal surface
892 //! \param [in] flags
893 //! Deinterlacing flags
894 //! \returns
895 //!
896 void UpdateSampleType(
897 PVPHAL_SURFACE srcSurf,
898 uint32_t flags);
899
900 //!
901 //! \brief Set src surface rect
902 //!
903 //! \param [inout] surfaceRegion
904 //! pointed to src rect
905 //! \param [in] vpHalTgtSurf
906 //! pointed to vphal surface
907 //! \param [in] mediaSrcSurf
908 //! pointed to media surface
909 //!
910 void SetSrcRect(
911 const VARectangle *surfaceRegion,
912 PVPHAL_SURFACE vpHalTgtSurf,
913 PDDI_MEDIA_SURFACE mediaSrcSurf);
914
915 //!
916 //! \brief Set dest surface rect
917 //!
918 //! \param [inout] surfaceRegion
919 //! pointed to dest rect
920 //! \param [in] vpHalTgtSurf
921 //! pointed to vphal surface
922 //! \param [in] mediaSrcSurf
923 //! pointed to media surface
924 //!
925 void SetDestRect(
926 const VARectangle *surfaceRegion,
927 PVPHAL_SURFACE vpHalTgtSurf,
928 PDDI_MEDIA_SURFACE mediaSrcSurf);
929
930 //!
931 //! \brief Check whether there is only Procamp with adjusting Brightness
932 //! \params [in] vpHalSrcSurf
933 //! pointed to vphal surfeca
934 //!
935 //! \returns true if call succeeds
936 //!
937 bool IsProcmpEnable(PVPHAL_SURFACE vpHalSrcSurf);
938
939 //!
940 //! \brief Map Chroma Sitting flags to appropriate VPHAL chroma sitting params
941 //!
942 //! \param [in] vpHalSurf
943 //! pointed to vphal surface
944 //! \param [in] chromasitingState
945 //! chromasiting State
946 //! \returns VA_STATUS_SUCCESS if call succeeds
947 //!
948 VAStatus VpUpdateProcChromaSittingState(
949 PVPHAL_SURFACE vpHalSurf,
950 uint8_t chromasitingState);
951
952 //!
953 //! \brief Set src surface rect
954 //!
955 //! \param [inout] surfaceRegion
956 //! pointed to src rect
957 //! \param [in] vpHalTgtSurf
958 //! pointed to vphal surface
959 //! \param [in] mediaSrcSurf
960 //! pointed to media surface
961 //!
962 void SetSrcSurfaceRect(
963 const VARectangle *surfRegion,
964 PVPHAL_SURFACE vpHalSrcSurf,
965 PDDI_MEDIA_SURFACE mediaSrcSurf);
966
967 //!
968 //! \brief Set dest surface rect
969 //!
970 //! \param [inout] outputRegion
971 //! pointed to dest rect
972 //! \param [in] vpHalTgtSurf
973 //! pointed to src vphal surface
974 //! \param [in] mediaSrcSurf
975 //! pointed to tgt vphal surface
976 //!
977 VAStatus SetDestSurfaceRect(
978 const VARectangle *outputRegion,
979 PVPHAL_SURFACE vpHalSrcSurf,
980 PVPHAL_SURFACE vpHalTgtSurf);
981
982 //! \brief Convert VAProcColorStandardType to VPHAL_CSPACE
983 //!
984 //! \param [in] vpHalSurf
985 //! src/target surface
986 //! \param [in] colorStandard
987 //! VA color standard VAProcColorStandardType
988 //! \param [in] flag
989 //! input/output surface flag for full/reduced color range
990 //! \returns appropriate VPHAL_CSPACE if call succeeds
991 //!
992 #if (VA_MAJOR_VERSION < 1)
993 VAStatus DdiGetColorSpace(
994 PVPHAL_SURFACE vpHalSurf,
995 VAProcColorStandardType colorStandard,
996 uint32_t flag);
997 #else
998 VAStatus DdiGetColorSpace(
999 PVPHAL_SURFACE vpHalSurf,
1000 VAProcColorStandardType colorStandard,
1001 VAProcColorProperties colorProperties);
1002 #endif
1003
1004 //!
1005 //! \brief Set background color for pipiline params
1006 //!
1007 //! \param [in] vpHalRenderParams
1008 //! pointer to PVPHAL_RENDER_PARAMS
1009 //! \param [in] outBackGroundcolor
1010 //! output background color
1011 //!
1012 VAStatus SetBackgroundColorfill(
1013 PVPHAL_RENDER_PARAMS vpHalRenderParams,
1014 uint32_t outBackGroundcolor);
1015
1016 //!
1017 //! \brief Set up split screen demo mode
1018 //! \param [in] splitDemoPosDdi
1019 //! split demo position setting from DDI layer
1020 //! \param [in] splitDemoParaDdi
1021 //! split demo parameters setting from DDI layer
1022 //! \param [inout] splitScreenDemoModeParams
1023 //! pointer to struct for split-screen demo mode parameters
1024 //! \param [inout] disableDemoMode
1025 //! return whether demo mode will be disable or not
1026 //! \param [in] osInterface
1027 //! pointer to MOS INTERFACE for OS interaction
1028 //! \return MOS_STATUS
1029 //!
1030 MOS_STATUS VpHalDdiSetupSplitScreenDemoMode(
1031 uint32_t splitDemoPosDdi,
1032 uint32_t splitDemoParaDdi,
1033 PVPHAL_SPLIT_SCREEN_DEMO_MODE_PARAMS *splitScreenDemoModeParams,
1034 bool *disableDemoMode,
1035 PMOS_INTERFACE osInterface);
1036
1037 //!
1038 //! \brief Update the future reference frames for VPHAL input surface
1039 //! \param [in] vpCtx
1040 //! VP context
1041 //! \param [in] vaDrvCtx
1042 //! VA Driver context
1043 //! \param [in] vpHalSrcSurf
1044 //! VpHal source surface
1045 //! \param [in] pipelineParam
1046 //! Pipeline parameter from application (VAProcPipelineParameterBuffer)
1047 //!
1048 //! \returns VA_STATUS_SUCCESS if call succeeds
1049 //!
1050 VAStatus DdiUpdateProcPipelineFutureReferenceFrames(
1051 PDDI_VP_CONTEXT vpCtx,
1052 VADriverContextP vaDrvCtx,
1053 PVPHAL_SURFACE vpHalSrcSurf,
1054 VAProcPipelineParameterBuffer *pipelineParam);
1055
1056 //!
1057 //! \brief Update the past reference frames for VPHAL input surface
1058 //!
1059 //! \param [in] vpCtx
1060 //! VP context
1061 //! \param [in] vaDrvCtx
1062 //! VA Driver context
1063 //! \param [in] vpHalSrcSurf
1064 //! VpHal source surface
1065 //! \param [in] pipelineParam
1066 //! Pipeline parameter from application (VAProcPipelineParameterBuffer)
1067 //! \returns VA_STATUS_SUCCESS if call succeeds
1068 //!
1069 VAStatus DdiUpdateProcPipelinePastReferenceFrames(
1070 PDDI_VP_CONTEXT vpCtx,
1071 VADriverContextP vaDrvCtx,
1072 PVPHAL_SURFACE vpHalSrcSurf,
1073 VAProcPipelineParameterBuffer *pipelineParam);
1074
1075 //!
1076 //! \brief Setup the appropriate filter params for VPHAL input surface based on Filter type
1077 //! \param [in] vaDrvCtx
1078 //! Driver context
1079 //! \param [in] vpCtx
1080 //! VP context
1081 //! \param [in] surfIndex
1082 //! surfIndex to the input surface array
1083 //! \param [in] filterType
1084 //! Filter type
1085 //! \param [in] data
1086 //! Buffer data
1087 //! \param [in] elementNum
1088 //! number of elements in the buffer(FilterParameter)
1089 //! \param [in] vpStateFlags
1090 //! filter enable status
1091 //!
1092 //! \returns VA_STATUS_SUCCESS if call succeeds
1093 //!
1094 VAStatus DdiUpdateFilterParamBuffer(
1095 VADriverContextP vaDrvCtx,
1096 PDDI_VP_CONTEXT vpCtx,
1097 uint32_t surfIndex,
1098 int32_t filterType,
1099 void *data,
1100 uint32_t elementNum,
1101 DDI_VP_STATE *vpStateFlags);
1102
1103 //!
1104 //! \brief Set DI filter params for input VPHAL surface
1105 //!
1106 //! \param [in] vpCtx
1107 //! VP context
1108 //! \param [in] surfIndex
1109 //! surfIndex to the input surface array
1110 //! \param [in] diParamBuff
1111 //! Pointer to DI param buffer data
1112 //!
1113 //! \returns VA_STATUS_SUCCESS if call succeeds
1114 //!
1115 VAStatus DdiSetProcFilterDinterlaceParams(
1116 PDDI_VP_CONTEXT vpCtx,
1117 uint32_t surfIndex,
1118 VAProcFilterParameterBufferDeinterlacing *diParamBuff);
1119
1120 //!
1121 //! \brief Set DN filter params for VPHAL input surface
1122 //!
1123 //! \param [in] vpCtx
1124 //! VP context
1125 //! \param [in] surfIndex
1126 //! surfIndex to the input surface array
1127 //! \param [in] dnParamBuff
1128 //! Pointer to DN param buffer data
1129 //!
1130 //! \returns VA_STATUS_SUCCESS if call succeeds
1131 //!
1132 VAStatus DdiSetProcFilterDenoiseParams(
1133 PDDI_VP_CONTEXT vpCtx,
1134 uint32_t surfIndex,
1135 VAProcFilterParameterBuffer *dnParamBuff);
1136
1137 //!
1138 //! \brief Set DN filter params for VPHAL input surface
1139 //!
1140 //! \param [in] vpCtx
1141 //! VP context
1142 //! \param [in] surfIndex
1143 //! surfIndex to the input surface array
1144 //! \param [in] hvsDnParamBuff
1145 //! Pointer to HVS DN param buffer data
1146 //!
1147 //! \returns VA_STATUS_SUCCESS if call succeeds
1148 //!
1149 VAStatus DdiSetProcFilterHVSDenoiseParams(
1150 PDDI_VP_CONTEXT vpCtx,
1151 uint32_t surfIndex,
1152 VAProcFilterParameterBufferHVSNoiseReduction *hvsDnParamBuff);
1153
1154 //!
1155 //! \brief Set DN filter params for VPHAL input surface
1156 //!
1157 //! \param [in] hvsDnParamBuff
1158 //! Pointer to HVS DN param buffer data
1159 //! \param [in] denoiseParams
1160 //! Pointer to PVPHAL_DENOISE_PARAMS
1161 //!
1162 //! \returns VA_STATUS_SUCCESS if call succeeds
1163 //!
1164 void SetHVSDnParams(
1165 VAProcFilterParameterBufferHVSNoiseReduction *hvsDnParamBuff,
1166 PVPHAL_DENOISE_PARAMS denoiseParams);
1167
1168 //!
1169 //! \brief Init IEF Params to their default value
1170 //! \param [out] iefParams
1171 //! The IEF Params struct to be initialized
1172 //! \return MOS_STATUS
1173 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
1174 //!
1175 MOS_STATUS VpHalDdiInitIEFParams(
1176 PVPHAL_IEF_PARAMS iefParams);
1177
1178 //!
1179 //! \brief Set Sharpness (Image Enhancement Filter, IEF) filter params for VPHAL input surface
1180 //!
1181 //! \param [in] vpCtx
1182 //! VP context
1183 //! \param [in] surfIndex
1184 //! surfIndex to the input surface array
1185 //! \param [in] sharpParamBuff
1186 //! Pointer to Sharpness param buffer data
1187 //!
1188 //! \returns VA_STATUS_SUCCESS if call succeeds
1189 //!
1190 VAStatus DdiSetProcFilterSharpnessParams(
1191 PDDI_VP_CONTEXT vpCtx,
1192 uint32_t surfIndex,
1193 VAProcFilterParameterBuffer *sharpParamBuff);
1194
1195 //!
1196 //! \brief Set Color Balance (procamp) filter params for VPHAL input surface
1197 //!
1198 //! \param [in] vpCtx
1199 //! VP context
1200 //! \param [in] surfIndex
1201 //! surfIndex to the input surface array
1202 //! \param [in] colorBalanceParamBuff
1203 //! Pointer to Colorbalance param buffer data
1204 //! \param [in] elementNum
1205 //! number of elements in the Colorbalance param buffer data
1206 //!
1207 //! \returns VA_STATUS_SUCCESS if call succeeds
1208 //!
1209 VAStatus DdiSetProcFilterColorBalanceParams(
1210 PDDI_VP_CONTEXT vpCtx,
1211 uint32_t surfIndex,
1212 VAProcFilterParameterBufferColorBalance *colorBalanceParamBuff,
1213 uint32_t elementNum);
1214
1215 //!
1216 //! \brief Set Color Balance (procamp) filter params for VPHAL input surface
1217 //!
1218 //! \param [in] src
1219 //! VPHAL input surface
1220 //! \param [in] colorBalanceParamBuff
1221 //! Pointer to Colorbalance param buffer data
1222 //! \param [in] procamp
1223 //! procamp flag
1224 //!
1225 //! \returns VA_STATUS_SUCCESS if call succeeds
1226 //!
1227 VAStatus SetColorBalanceParams(
1228 VAProcFilterParameterBufferColorBalance *colorBalanceParamBuff,
1229 uint32_t index,
1230 PVPHAL_SURFACE src,
1231 bool procamp);
1232
1233 //!
1234 //! \brief Set Skin Tone Enhancement (STE) filter params for VPHAL input surface
1235 //!
1236 //! \param [in] vpCtx
1237 //! VP context
1238 //! \param [in] surfIndex
1239 //! surfIndex to the input surface array
1240 //! \param [in] steParamBuff
1241 //! Pointer to Skin Tone Enhancement param buffer data
1242 //!
1243 //! \returns VA_STATUS_SUCCESS if call succeeds
1244 //!
1245 VAStatus DdiSetProcFilterSkinToneEnhancementParams(
1246 PDDI_VP_CONTEXT vpCtx,
1247 uint32_t surfIndex,
1248 VAProcFilterParameterBuffer *steParamBuff);
1249
1250 //!
1251 //! \brief Total Color Correction (TCC) filter params for VPHAL input surface
1252 //!
1253 //! \param [in] vpCtx
1254 //! VP context
1255 //! \param [in] surfIndex
1256 //! surfIndex to the input surface array
1257 //! \param [in] tccParamBuff
1258 //! Pointer to Total Color Correction param buffer data
1259 //! \param [in] elementNum
1260 //! number of elements in the Total Color Correction param buffer data
1261 //!
1262 //! \returns VA_STATUS_SUCCESS if call succeeds
1263 //!
1264 VAStatus DdiSetProcFilterTotalColorCorrectionParams(
1265 PDDI_VP_CONTEXT vpCtx,
1266 uint32_t surfIndex,
1267 VAProcFilterParameterBufferTotalColorCorrection *tccParamBuff,
1268 uint32_t elementNum);
1269
1270 //!
1271 //! \brief High Dynamic Range (HDR) Tone Mapping filter params for VPHAL input surface
1272 //!
1273 //! \param [in] vpCtx
1274 //! VP context
1275 //! \param [in] surfIndex
1276 //! uSurfIndex to the input surface array
1277 //! \param [in] hdrParamBuff
1278 //! Pointer to High Dynamic Range Tone Mapping param buffer data
1279 //! \param [in] elementNum
1280 //! number of elements in the High Dynamic Range Tone Mapping param buffer data
1281 //!
1282 //! \returns VA_STATUS_SUCCESS if call succeeds
1283 //!
1284 VAStatus DdiSetProcFilterHdrTmParams(
1285 PDDI_VP_CONTEXT vpCtx,
1286 uint32_t surfIndex,
1287 VAProcFilterParameterBufferHDRToneMapping *hdrTmParamBuff);
1288
1289 //!
1290 //! \brief Set the appropriate HDR params according to colour standard, HDR metadata.
1291 //!
1292 //! \param [in] vpHalSurf
1293 //! VPHAL Surface
1294 //! \param [in] hdrMetadata
1295 //! HDR metadata
1296 //!
1297 //! \returns VA_STATUS_SUCCESS if call succeeds
1298 //!
1299 VAStatus VpUpdateProcHdrState(
1300 const PVPHAL_SURFACE vpHalSurf,
1301 const VAHdrMetaData *hdrMetadata);
1302
1303 #if VA_CHECK_VERSION(1, 12, 0)
1304 //!
1305 //! \brief Three Three-Dimensional Look Up Table(3DLUT) filter params for VPHAL input surface
1306 //! \param
1307 //! \param [in] vaDrvCtx
1308 //! Driver context
1309 //! \param [in] vpCtx
1310 //! VP context
1311 //! \param [in] surfIndex
1312 //! surfIndex to the input surface array
1313 //! \param [in] lut3DParamBuff
1314 //! Pointer to 3DLUT param buffer data
1315 //!
1316 //! \returns VA_STATUS_SUCCESS if call succeeds
1317 //!
1318 VAStatus DdiSetProcFilter3DLutParams(
1319 VADriverContextP vaDrvCtx,
1320 PDDI_VP_CONTEXT vpCtx,
1321 uint32_t surfIndex,
1322 VAProcFilterParameterBuffer3DLUT *lut3DParamBuff);
1323 #endif
1324
1325 //!
1326 //! \brief clear filter params which is disabled for VPHAL input surface
1327 //!
1328 //! \param [in] vpCtx
1329 //! VP context
1330 //! \param [in] surfIndex
1331 //! uSurfIndex to the input surface array
1332 //! \param [in] vpStateFlags
1333 //! filter enable status
1334 //!
1335 //! \returns VA_STATUS_SUCCESS if call succeeds
1336 //!
1337 VAStatus DdiClearFilterParamBuffer(
1338 PDDI_VP_CONTEXT vpCtx,
1339 uint32_t surfIndex,
1340 DDI_VP_STATE vpStateFlags);
1341
1342 //!
1343 //! \brief Set Interpolation Method according to the flag
1344 //!
1345 //! \param [in] surface
1346 //! VA Surface
1347 //! \param [in] nterpolationflags
1348 //! Interpolation Flag
1349 //!
1350 //! \returns VA_STATUS_SUCCESS if call succeeds
1351 //!
1352 VAStatus VpSetInterpolationParams(
1353 PVPHAL_SURFACE surface,
1354 uint32_t nterpolationflags);
1355
1356 //!
1357 //! \brief Update VPHAL weave DI params
1358 //!
1359 //! \param [in] vpHalSrcSurf
1360 //! \param [in] filterFlags
1361 //!
1362 //! \returns VA_STATUS_SUCCESS if call succeeds
1363 //!
1364 void VpUpdateWeaveDI(PVPHAL_SURFACE vpHalSrcSurf, uint32_t filterFlags);
1365
1366 //!
1367 //! \brief Map VA Rotation flags to appropriate VPHAL Rotation params
1368 //!
1369 //! \param [in] vpHalSrcSurf
1370 //! \param [in] rotationState
1371 //!
1372 //! \returns VA_STATUS_SUCCESS if call succeeds
1373 //!
1374 VAStatus VpUpdateProcRotateState(PVPHAL_SURFACE vpHalSrcSurf, uint32_t rotationState);
1375
1376 //!
1377 //! \brief Map VA Mirroring flags to appropriate VPHAL Mirroring params
1378 //!
1379 //! \param [in] pHalSrcSurf
1380 //! \param [in] mirrorState
1381 //!
1382 //! \returns VA_STATUS_SUCCESS if call succeeds
1383 //!
1384 VAStatus VpUpdateProcMirrorState(PVPHAL_SURFACE vpHalSrcSurf, uint32_t mirrorState);
1385
1386 //!
1387 //! \brief Set alpha blending params for VPHAL input surface
1388 //!
1389 //! \param [in] vpCtx
1390 //! VP context
1391 //! \param [in] surfIndex
1392 //! surfIndex to the input surface array
1393 //! \param [in] pipelineParam
1394 //! Pipeline paramseter from application (VAProcPipelineParameterBuffer)
1395 //!
1396 //! \returns VA_STATUS_SUCCESS if call succeeds
1397 //!
1398 VAStatus DdiSetProcPipelineBlendingParams(
1399 PDDI_VP_CONTEXT vpCtx,
1400 uint32_t surfIndex,
1401 VAProcPipelineParameterBuffer *pipelineParam);
1402
1403 //!
1404 //! \brief Set alpha blending types
1405 //!
1406 //! \param [in] preMultAlpha
1407 //! flag
1408 //! \param [in] globalAlpha
1409 //! flag
1410 //! \param [in] blendingParams
1411 //! Pointer to Blending Params
1412 //!
1413 //! \returns VA_STATUS_SUCCESS if call succeeds
1414 //!
1415 void SetBlendingTypes(
1416 bool preMultAlpha,
1417 bool globalAlpha,
1418 PVPHAL_BLENDING_PARAMS blendingParams,
1419 float globalalpha);
1420
1421 //!
1422 //! \def IS_COLOR_SPACE_BT2020_YUV(_a)
1423 //! Check if the color space is BT2020 YUV
1424 //!
1425 #define IS_COLOR_SPACE_BT2020_YUV(_a) (_a == CSpace_BT2020 || \
1426 _a == CSpace_BT2020_FullRange)
1427
1428 //!
1429 //! \def IS_COLOR_SPACE_BT2020_RGB(_a)
1430 //! Check if the color space is BT2020 RGB
1431 //!
1432 #define IS_COLOR_SPACE_BT2020_RGB(_a) (_a == CSpace_BT2020_RGB || \
1433 _a == CSpace_BT2020_stRGB)
1434
1435 //!
1436 //! \def IS_COLOR_SPACE_BT2020(_a)
1437 //! Check if the color space is BT2020
1438 //!
1439 #define IS_COLOR_SPACE_BT2020(_a) (IS_COLOR_SPACE_BT2020_YUV(_a) || \
1440 IS_COLOR_SPACE_BT2020_RGB(_a))
1441
1442 //!
1443 //! \brief Get ready to process a picture to a target surface
1444 //!
1445 //! \param [in] vaDrvCtx
1446 //! VA Driver Context
1447 //! \param [in] vpCtx
1448 //! VP context
1449 //! \param [in] vaSurfID
1450 //! target surface ID
1451 //!
1452 //! \returns VA_STATUS_SUCCESS if call succeeds
1453 //!
1454 VAStatus DdiBeginPictureInt(
1455 VADriverContextP vaDrvCtx,
1456 PDDI_VP_CONTEXT vpCtx,
1457 VASurfaceID vaSurfID);
1458
1459 //!
1460 //! \brief Check if the format contains alpha channel
1461 //!
1462 //! \param [in] surface
1463 //! VpHal Surface
1464 //!
1465 //! \returns true if the format of surface contains alpha channel
1466 //!
1467 bool hasAlphaInSurface(PVPHAL_SURFACE surface);
1468
1469 //!
1470 //! \brief Extract Render Target params from VAProcPipelineParameterBuffer and set the appropriate VPHAL params for RT
1471 //!
1472 //! \param [in] vaDrvCtx
1473 //! VA Driver context
1474 //! \param [in] vpCtx
1475 //! VP context
1476 //! \param [in] pipelineParam
1477 //! VAProcPipelineParameterBuffer Pipeline paramseter from application
1478 //!
1479 //! \returns VA_STATUS_SUCCESS if call succeeds
1480 //!
1481 VAStatus DdiUpdateVphalTargetSurfColorSpace(
1482 VADriverContextP vaDrvCtx,
1483 PDDI_VP_CONTEXT vpCtx,
1484 VAProcPipelineParameterBuffer *pipelineParam,
1485 uint32_t targetIndex);
1486
1487 //!
1488 //! \brief set vphal surface when Surface sample type is VA_TOP_FIELD_FIRST
1489 //!
1490 //! \param [in] surfaceFlag
1491 //! Surface sample type
1492 //! \param [in] vpHalSrcSurf
1493 //! Pointer to PVPHAL_SURFACE
1494 //!
1495 VAStatus SetSurfaceParamsTopFieldFirst(uint32_t surfaceFlag, PVPHAL_SURFACE vpHalSrcSurf, PVPHAL_SURFACE vpHalTgtSurf);
1496
1497 //!
1498 //! \brief set vphal surface when Surface sample type is VA_BOTTOM_FIELD_FIRST
1499 //!
1500 //! \param [in] surfaceFlag
1501 //! Surface sample type
1502 //! \param [in] vpHalSrcSurf
1503 //! Pointer to PVPHAL_SURFACE
1504 //!
1505 VAStatus SetSurfaceParamsBottomFieldFirst(uint32_t surfaceFlag, PVPHAL_SURFACE vpHalSrcSurf, PVPHAL_SURFACE vpHalTgtSurf);
1506
1507 //!
1508 //! \brief set vphal surface when Surface sample type is VA_TOP_FIELD
1509 //!
1510 //! \param [in] surfaceFlag
1511 //! Surface sample type
1512 //! \param [in] vpHalSrcSurf
1513 //! Pointer to PVPHAL_SURFACE
1514 //!
1515 VAStatus SetSurfaceParamsTopField(uint32_t surfaceFlag, PVPHAL_SURFACE vpHalSrcSurf, PVPHAL_SURFACE vpHalTgtSurf);
1516
1517 //!
1518 //! \brief set vphal surface when Surface sample type is VA_BOTTOM_FIELD
1519 //!
1520 //! \param [in] surfaceFlag
1521 //! Surface sample type
1522 //! \param [in] vpHalSrcSurf
1523 //! Pointer to PVPHAL_SURFACE
1524 //!
1525 VAStatus SetSurfaceParamsBottomField(uint32_t surfaceFlag, PVPHAL_SURFACE vpHalSrcSurf, PVPHAL_SURFACE vpHalTgtSurf);
1526
1527 //!
1528 //! \brief set vphal surface when Surface sample type is VA_BOTTOM_FIELD
1529 //!
1530 //! \param [in] filterFlags
1531 //! filter flag
1532 //! \param [in] vpHalSrcSurf
1533 //! Pointer to PVPHAL_SURFACE
1534 //!
1535 void SetLegacyInterlaceScalingParams(PVPHAL_SURFACE vpHalSrcSurf, uint32_t filterFlags);
1536
1537 #if defined(X11_FOUND)
1538 //!
1539 //! \brief Rectangle initialization
1540 //!
1541 //! \param [in] rect
1542 //! Rectangle
1543 //! \param [in] destx
1544 //! Destination X
1545 //! \param [in] desty
1546 //! Destination Y
1547 //! \param [in] destw
1548 //! Destination W
1549 //! \param [in] desth
1550 //! Destination H
1551 //!
1552 void RectInit(
1553 RECT *rect,
1554 int16_t destx,
1555 int16_t desty,
1556 uint16_t destw,
1557 uint16_t desth);
1558
1559 //!
1560 //! \param ctx
1561 //! Pointer to VA driver context
1562 //! \param surface
1563 //! VA surface ID
1564 //! \param draw
1565 //! Drawable of window system
1566 //! \param srcx
1567 //! Source X of the region
1568 //! \param srcy
1569 //! Source Y of the region
1570 //! \param srcw
1571 //! Source W of the region
1572 //! \param srch
1573 //! Source H of the region
1574 //! \param destx
1575 //! Destination X
1576 //! \param desty
1577 //! Destination Y
1578 //! \param destw
1579 //! Destination W
1580 //! \param desth
1581 //! Destination H
1582 //! \param cliprects
1583 //! Client-supplied clip list
1584 //! \param numberCliprects
1585 //! Number of clip rects in the clip list
1586 //! \param flags
1587 //! De-interlacing flags
1588 //!
1589 VAStatus PutSurfaceLinuxHW(
1590 VADriverContextP ctx,
1591 VASurfaceID surface,
1592 void *draw,
1593 int16_t srcx,
1594 int16_t srcy,
1595 uint16_t srcw,
1596 uint16_t srch,
1597 int16_t destx,
1598 int16_t desty,
1599 uint16_t destw,
1600 uint16_t desth,
1601 VARectangle *cliprects,
1602 uint32_t numberCliprects,
1603 uint32_t flags);
1604 #endif // defined(X11_FOUND)
1605
1606 protected:
1607 static const VAProcFilterCapColorBalance m_vpColorBalCap[];
1608 static const VAProcFilterType m_vpSupportedFilters[DDI_VP_MAX_NUM_FILTERS];
1609
1610 MEDIA_CLASS_DEFINE_END(DdiVpFunctions)
1611 };
1612
1613 #endif //__DDI_VP_FUNCTIONS_H__