xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/vp/hal/vphal_render_sfc_base.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2010-2019, 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     vphal_render_sfc_base.h
24 //! \brief    The header file of the base class of VPHAL SFC rendering component
25 //! \details  The SFC renderer supports Scaling, IEF, CSC/ColorFill and Rotation.
26 //!           It's responsible for setting up HW states and generating the SFC
27 //!           commands.
28 //!
29 #ifndef __VPHAL_RENDER_SFC_BASE_H__
30 #define __VPHAL_RENDER_SFC_BASE_H__
31 
32 #include "mhw_sfc.h"
33 #include "renderhal_legacy.h"
34 #include "vphal.h"
35 #include "vphal_render_common.h"
36 #include "vphal_render_vebox_iecp.h"
37 
38 #ifndef __VPHAL_SFC_SUPPORTED
39 #define __VPHAL_SFC_SUPPORTED 1
40 #endif
41 
42 //!
43 //! \brief  Structure to hold AVS Coeff tables
44 //!
45 struct VPHAL_SFC_AVS_STATE
46 {
47     MHW_SFC_AVS_LUMA_TABLE      LumaCoeffs;
48     MHW_SFC_AVS_CHROMA_TABLE    ChromaCoeffs;
49     MHW_SFC_AVS_STATE           AvsStateParams;
50 };
51 
52 //!
53 //! \brief Transient Render data populated for every BLT call
54 //!
55 typedef struct _VPHAL_SFC_RENDER_DATA
56 {
57     bool                                bColorFill;                             //!< Enable ColorFill
58     bool                                bScaling;                               //!< Enable Scaling
59     bool                                bIEF;                                   //!< Enable IEF filter
60     bool                                bCSC;                                   //!< Enable CSC filter
61 
62     float                               fScaleX;                                //!< X Scaling ratio
63     float                               fScaleY;                                //!< Y Scaling ratio
64     uint16_t                            wIEFFactor;                             //!< IEF factor
65     MHW_SFC_STATE_PARAMS                *SfcStateParams;                        //!< Pointer to SFC state params
66     MHW_SFC_IEF_STATE_PARAMS            IEFStateParams;                         //!< Pointer to IEF state params
67     PMHW_AVS_PARAMS                     pAvsParams;                             //!< Pointer to AVS params
68     PVPHAL_COLORFILL_PARAMS             pColorFillParams;                       //!< Pointer to ColorFill params
69     PVPHAL_ALPHA_PARAMS                 pAlphaParams;                           //!< Pointer to Alpha params
70     VPHAL_CSPACE                        SfcInputCspace;                         //!< SFC Input Color Space
71     MOS_FORMAT                          SfcInputFormat;                         //!< SFC Input Format
72     VPHAL_ROTATION                      SfcRotation;                            //!< SFC Rotation Mode
73     VPHAL_SCALING_MODE                  SfcScalingMode;                         //!< SFC Scaling Mode
74     uint32_t                            SfcSrcChromaSiting;                     //!< SFC Source Surface Chroma Siting
75 
76     PVPHAL_SURFACE                      pSfcPipeOutSurface;                     //!< SFC Pipe output surface
77 
78     bool                                bForcePolyPhaseCoefs;                   //!< SFC AVS force polyphase coef
79 } VPHAL_SFC_RENDER_DATA, *PVPHAL_SFC_RENDER_DATA;
80 
81 #if __VPHAL_SFC_SUPPORTED
82 class VphalSfcState
83 {
84 public:
85     //!
86     //! \brief    VphalSfcState constructor
87     //! \param    [in] osInterface
88     //!           Pointer to os interface
89     //! \param    [in] renderHal
90     //!           pointer to renderhal structure
91     //! \param    [in] sfcInterface
92     //!           pointer to mhw sfc interface
93     //! \return   void
94     //!
95     VphalSfcState(PMOS_INTERFACE       osInterface,
96                   PRENDERHAL_INTERFACE renderHal,
97                   PMHW_SFC_INTERFACE   sfcInterface);
98     //!
99     //! \brief    VphalSfcState destructor
100     //! \return   void
101     //!
102     virtual ~VphalSfcState();
103 
104     //!
105     //! \brief    Disable the SFC functionality
106     //! \param    [in] disable
107     //!           true to disable, false to enable SFC
108     //! \return   void
109     //!
SetDisable(bool disable)110     void SetDisable(bool disable)
111     {
112         disableSFC = disable;
113     }
114 
115     //!
116     //! \brief    Set SFC MMC status
117     //! \param    [in] enable
118     //!           true to disable, false to enable SFC MMC
119     //! \return   void
120     //!
SetSfcOutputMmcStatus(bool enable)121     void SetSfcOutputMmcStatus(bool enable)
122     {
123         enableSfcMMC = enable;
124     }
125 
126     //!
127     //! \brief    Check if SFC functionality is disabled
128     //! \return   true if disabled, false if enabled
129     //!
IsDisabled()130     bool IsDisabled()
131     {
132         return disableSFC;
133     }
134 
135     //!
136     //! \brief    Check if SFC MMC is enabled
137     //! \return   true if enabled, false if disabled
138     //!
IsSfcMmcEnabled()139     bool IsSfcMmcEnabled()
140     {
141         return enableSfcMMC;
142     }
143 
144     //!
145     //! \brief    Set stero channel of input
146     //! \param    [in] currentChannel
147     //!           Current stero channel
148     //! \return   void
149     //!
SetStereoChannel(uint32_t currentChannel)150     void SetStereoChannel(uint32_t currentChannel)
151     {
152         m_currentChannel = currentChannel;
153     }
154 
155     //!
156     //! \brief    Get Sfc's input format
157     //! \return   MOS_FORMAT
158     //!
GetInputFormat()159     MOS_FORMAT GetInputFormat()
160     {
161         return m_renderData.SfcInputFormat;
162     }
163 
164     //!
165     //! \brief    Get Sfc's input color space
166     //! \return   VPHAL_CSPACE
167     //!
GetInputColorSpace()168     VPHAL_CSPACE GetInputColorSpace()
169     {
170         return m_renderData.SfcInputCspace;
171     }
172 
173     //!
174     //! \brief    Initialize sfc render data
175     //! \return   void
176     //!
InitRenderData()177     virtual void InitRenderData()
178     {
179         MOS_FreeMemory(m_renderData.SfcStateParams);
180         m_renderData = { };
181     }
182 
183     //!
184     //! \brief    Get the output pipe considering the SFC restrictions
185     //! \details  Check which output pipe can be applied, SFC or Comp
186     //! \param    [in] pSrc
187     //!           Pointer to input surface of SFC
188     //! \param    [in] pRenderTarget
189     //!           Pointer to RenderTarget
190     //! \param    [in] pcRenderParams
191     //!           Pointer to VpHal render parameters
192     //! \return   the output pipe mode
193     //!
194     virtual VPHAL_OUTPUT_PIPE_MODE GetOutputPipe(
195         PVPHAL_SURFACE              pSrc,
196         PVPHAL_SURFACE              pRenderTarget,
197         PCVPHAL_RENDER_PARAMS       pcRenderParams);
198 
199     //!
200     //! \brief    check whether SFC Write have offset which may hit compresed write limitation
201     //! \details  check whether SFC Write have offset which may hit compresed write limitation
202     //! \param    [in] pRenderTarget
203     //!           Pointer to RenderTarget
204     //! \return   the output pipe mode
205     //!
206     virtual bool IsSFCUncompressedWriteNeeded(
207         PVPHAL_SURFACE              pRenderTarget);
208 
209     //!
210     //! \brief    Check if SFC is feasible to generate output
211     //! \param    [in] pcRenderParams
212     //!           Pointer to VpHal render parameters
213     //! \param    [in] pSrcSurface
214     //!           Pointer to input surface of SFC
215     //! \param    [in] pRenderTarget
216     //!           Pointer to RenderTarget
217     //! \return   true if SFC is feasible
218     //!
219     virtual bool IsOutputPipeSfcFeasible(
220         PCVPHAL_RENDER_PARAMS       pcRenderParams,
221         PVPHAL_SURFACE              pSrcSurface,
222         PVPHAL_SURFACE              pRenderTarget);
223 
224     //!
225     //! \brief    Setup SFC Rendering Flags
226     //! \details  Set up the SFC rendering flag based the input and render target
227     //!           surface, SFC state and the ColorFill/Alpha parameters
228     //! \param    [in] pColorFillParams
229     //!           Pointer to ColorFill params
230     //! \param    [in] pAlphaParams
231     //!           Pointer to Alpha params
232     //! \param    [in] pSrc
233     //!           Pointer to Source Surface
234     //! \param    [in] pRenderTarget
235     //!           Pointer to Render Target Surface
236     //! \param    [in,out] pRenderData
237     //!           Pointer to Vebox render Data
238     //! \return   void
239     //!
240     virtual void SetRenderingFlags(
241         PVPHAL_COLORFILL_PARAMS         pColorFillParams,
242         PVPHAL_ALPHA_PARAMS             pAlphaParams,
243         PVPHAL_SURFACE                  pSrc,
244         PVPHAL_SURFACE                  pRenderTarget,
245         PVPHAL_VEBOX_RENDER_DATA        pRenderData);
246 
247     //!
248     //! \brief    Free resources used by SFC Pipe
249     //! \details  Free the AVS and IEF line buffer surfaces for SFC
250     //! \return   void
251     //!
252     virtual void FreeResources();
253 
254     //!
255     //! \brief    Check to see if the i/o surface is supported by SFC
256     //! \details  Check the format and the size of i/o surface and determine
257     //!           whether it can go through SFC pipe
258     //! \param    [in] pSrcSurface
259     //!           Pointer to Src surface
260     //! \param    [in] pOutSurface
261     //!           Pointer to Output surface
262     //! \param    [in] pAlphaParams
263     //!           Pointer to Alpha params
264     //! \return   true if SFC Pipe is needed else false
265     //!
266     virtual bool IsFormatSupported(
267         PVPHAL_SURFACE              pSrcSurface,
268         PVPHAL_SURFACE              pOutSurface,
269         PVPHAL_ALPHA_PARAMS         pAlphaParams);
270 
271     //!
272     //! \brief    Setup SFC states and parameters
273     //! \details  Setup SFC states and parameters including SFC State, AVS
274     //!           and IEF parameters
275     //! \param    [in] pSrcSurface
276     //!           Pointer to Source Surface
277     //! \param    [in] pOutSurface
278     //!           Pointer to Output Surface
279     //! \param    [in,out] pRenderData
280     //!           Pointer to Vebox Render data
281     //! \return   Return MOS_STATUS_SUCCESS if successful, otherwise failed
282     //!
283     virtual MOS_STATUS SetupSfcState(
284         PVPHAL_SURFACE                  pSrcSurface,
285         PVPHAL_SURFACE                  pOutSurface,
286         PVPHAL_VEBOX_RENDER_DATA        pRenderData);
287 
288     //!
289     //! \brief    Send SFC pipe commands
290     //! \details  Register the surfaces and send the commands needed by SFC pipe
291     //! \param    [in] pRenderData
292     //!           Pointer to Vebox Render data
293     //! \param    [in,out] pCmdBuffer
294     //!           Pointer to command buffer
295     //! \return   MOS_STATUS_SUCCESS if successful, otherwise failed
296     //!
297     virtual MOS_STATUS SendSfcCmd(
298         PVPHAL_VEBOX_RENDER_DATA        pRenderData,
299         PMOS_COMMAND_BUFFER             pCmdBuffer);
300 
301     //!
302     //! \brief    Set Sfc index used by HW
303     //! \details  VPHAL set Sfc index used by HW
304     //! \param    [in] dwSfcIndex;
305     //!           set which Sfc can be used by HW
306     //! \param    [in] dwSfcCount;
307     //!           set Sfc Count
308     //! \return   MOS_STATUS
309     //!           MOS_STATUS_SUCCESS if success, else fail reason
SetSfcIndex(uint32_t dwSfcIndex,uint32_t dwSfcCount)310     virtual MOS_STATUS SetSfcIndex(
311         uint32_t                    dwSfcIndex,
312         uint32_t                    dwSfcCount)
313     {
314         MOS_UNUSED(dwSfcIndex);
315         MOS_UNUSED(dwSfcCount);
316         return MOS_STATUS_SUCCESS;
317     }
318 
319 protected:
320     //!
321     //! \brief      Gen specific function for SFC adjust boundary
322     //! \details    Adjust the width and height of the input surface for SFC
323     //! \param      [in] pSurface
324     //!             Pointer to input Surface
325     //! \param      [out] pdwSurfaceWidth
326     //!             Pointer to adjusted surface width
327     //! \param      [out] pdwSurfaceHeight
328     //!             Pointer to adjusted surface height
329     //! \return     void
330     //!
331     virtual void AdjustBoundary(
332         PVPHAL_SURFACE              pSurface,
333         uint32_t*                   pdwSurfaceWidth,
334         uint32_t*                   pdwSurfaceHeight);
335 
336     //!
337     //! \brief    Allocate Resources for SFC Pipe
338     //! \details  Allocate the AVS and IEF line buffer surfaces for SFC
339     //! \return   Return MOS_STATUS_SUCCESS if successful, otherwise failed
340     //!
341     virtual MOS_STATUS AllocateResources();
342 
343     //!
344     //! \brief    Is the Format MMC Supported in SFC
345     //! \details  Check whether input format is supported by memory compression
346     //! \param    [in] Format
347     //!           Surface format
348     //! \return   true if supported, false if not
349     //!
350     virtual bool IsFormatMMCSupported(
351         MOS_FORMAT                  Format);
352 
353     //!
354     //! \brief    Check if SFC is capable to output
355     //! \details  Check all conditions to see if it meets SFC's capablitiy
356     //! \param    [in] isColorFill
357     //!           indicates whether color fill is required
358     //! \param    [in] src
359     //!           Pointer to source surface
360     //! \param    [in] renderTarget
361     //!           Pointer to renderTarget surface
362     //! \return   true if capable, false if not
363     //!
364     virtual bool IsOutputCapable(
365         bool            isColorFill,
366         PVPHAL_SURFACE  src,
367         PVPHAL_SURFACE  renderTarget);
368 
369     //!
370     //! \brief    Check if the input format is supported
371     //! \param    [in] srcSurface
372     //!           input surface
373     //! \return   true if supported, false if not
374     //!
375     virtual bool IsInputFormatSupported(
376         PVPHAL_SURFACE              srcSurface) = 0;
377 
378     //!
379     //! \brief    Check if the output format is supported
380     //! \param    [in] outSurface
381     //!           output surface
382     //! \return   true if supported, false if not
383     //!
384     virtual bool IsOutputFormatSupported(
385         PVPHAL_SURFACE              outSurface) = 0;
386 
387     //!
388     //! \brief    Get width and height align unit of input format
389     //! \param    [in] inputFormat
390     //!           input format
391     //! \param    [in] outputFormat
392     //!           output format
393     //! \param    [out] widthAlignUnit
394     //!           width align unit
395     //! \param    [out] heightAlignUnit
396     //!           height align unit
397     //! \return   void
398     //!
399     virtual void GetInputWidthHeightAlignUnit(
400         MOS_FORMAT              inputFormat,
401         MOS_FORMAT              outputFormat,
402         uint16_t                &widthAlignUnit,
403         uint16_t                &heightAlignUnit,
404         bool                    isInterlacedScaling = false) = 0;
405 
406     //!
407     //! \brief    Get width and height align unit of output format
408     //! \param    [in] outputFormat
409     //!           output format
410     //! \param    [out] widthAlignUnit
411     //!           width align unit
412     //! \param    [out] heightAlignUnit
413     //!           height align unit
414     //! \return   void
415     //!
416     virtual void GetOutputWidthHeightAlignUnit(
417         MOS_FORMAT              outputFormat,
418         uint16_t                &widthAlignUnit,
419         uint16_t                &heightAlignUnit,
420         bool                    isInterlacedScaling = false);
421 
422     //!
423     //! \brief    Setup SFC State related parameters
424     //! \details  Setup the SFC State related parameters based on the i/o surface
425     //!           and Vebox and SFC rendering data
426     //! \param    [in,out] pRenderData
427     //!           Pointer to Vebox Render data
428     //! \param    [in] pSrcSurface
429     //!           Pointer to Input Source Surface
430     //! \param    [in] pOutSurface
431     //!           Pointer to Output Source Surface
432     //! \return   MOS_STATUS
433     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
434     //!
435     virtual MOS_STATUS SetSfcStateParams(
436         PVPHAL_VEBOX_RENDER_DATA        pRenderData,
437         PVPHAL_SURFACE                  pSrcSurface,
438         PVPHAL_SURFACE                  pOutSurface);
439 
440     //!
441     //! \brief    Setup parameters related to SFC_IEF State
442     //! \details  Setup the IEF and CSC params of the SFC_IEF State
443     //! \param    [in] veboxRenderData
444     //!           Pointer to Vebox Render Data
445     //! \param    [in,out] sfcStateParams
446     //!           Pointer to SFC_STATE params
447     //! \param    [in] inputSurface
448     //!           Pointer to Input Surface
449     //! \return   void
450     //!
451     virtual void SetIefStateParams(
452         PVPHAL_VEBOX_RENDER_DATA        veboxRenderData,
453         PMHW_SFC_STATE_PARAMS           sfcStateParams,
454         PVPHAL_SURFACE                  inputSurface);
455 
456     //!
457     //! \brief    Setup CSC parameters of the SFC State
458     //! \param    [in,out] pSfcStateParams
459     //!           Pointer to SFC_STATE params
460     //! \param    [out] pIEFStateParams
461     //!           Pointer to MHW IEF state params
462     //! \return   void
463     //!
464     virtual void SetIefStateCscParams(
465         PMHW_SFC_STATE_PARAMS           pSfcStateParams,
466         PMHW_SFC_IEF_STATE_PARAMS       pIEFStateParams);
467 
468     //!
469     //! \brief    Update SFC Rendering Flags
470     //! \details  Update the SFC rendering flag based the input and render target
471     //!           surface, SFC state and the ColorFill/Alpha parameters
472     //! \param    [in] pSrcSurface
473     //!           Pointer to Source Surface
474     //! \param    [in] pOutSurface
475     //!           Pointer to Render Target Surface
476     //! \param    [in,out] pRenderData
477     //!           Pointer to Vebox Render Data
478     //! \return   MOS_STATUS
479     //!
480     virtual MOS_STATUS UpdateRenderingFlags(
481         PVPHAL_SURFACE                  pSrcSurface,
482         PVPHAL_SURFACE                  pOutSurface,
483         PVPHAL_VEBOX_RENDER_DATA        pRenderData);
484 
485     //!
486     //! \brief    Determine if CSC is required in SFC pipe and set related params
487     //! \param    [in] src
488     //!           Pointer to Source Surface
489     //! \param    [in] renderTarget
490     //!           Pointer to Target Surface
491     //! \return   void
492     //!
493     virtual void DetermineCscParams(
494         PVPHAL_SURFACE                  src,
495         PVPHAL_SURFACE                  renderTarget);
496 
497     //!
498     //! \brief    Determine SFC input surface format
499     //! \details  Determine SFC input surface format according to
500     //!           surface info and vebox flags
501     //! \param    [in] src
502     //!           Pointer to Source Surface
503     //! \param    [in] veboxRenderData
504     //!           Pointer to vebox Render Data
505     //! \return   void
506     //!
507     virtual void DetermineInputFormat(
508         PVPHAL_SURFACE                  src,
509         PVPHAL_VEBOX_RENDER_DATA        veboxRenderData);
510 
511     //!
512     //! \brief    Determine SFC input ordering mode
513     //! \details  Determine SFC input ordering mode according to
514     //!           vebox flags
515     //! \param    [in] veboxRenderData
516     //!           Pointer to vebox Render Data
517     //! \param    [out] sfcStateParams
518     //!           Pointer to SFC state params
519     //! \return   void
520     //!
521     virtual void SetSfcStateInputOrderingMode(
522         PVPHAL_VEBOX_RENDER_DATA    veboxRenderData,
523         PMHW_SFC_STATE_PARAMS       sfcStateParams);
524 
525     //!
526     //! \brief    Send SFC pipe commands
527     //! \details  Register the surfaces and send the commands needed by SFC pipe
528     //! \param    [in] pSfcInterface
529     //!           Pointer to SFC interface
530     //! \param    [in] pMhwMiInterface
531     //!           Pointer to MI interface
532     //! \param    [in] pOsInterface
533     //!           Pointer to OS interface
534     //! \param    [in] pSfcPipeOutSurface
535     //!           Pointer to SFC Output surface
536     //! \param    [in,out] pCmdBuffer
537     //!           Pointer to command buffer
538     //! \return   MOS_STATUS_SUCCESS if successful, otherwise failed
539     //!
RenderSfcMmcCMD(PMHW_SFC_INTERFACE pSfcInterface,MhwMiInterface * pMhwMiInterface,PMOS_INTERFACE pOsInterface,PMHW_SFC_OUT_SURFACE_PARAMS pSfcPipeOutSurface,PMOS_COMMAND_BUFFER pCmdBuffer)540     virtual MOS_STATUS RenderSfcMmcCMD(
541         PMHW_SFC_INTERFACE          pSfcInterface,
542         MhwMiInterface            * pMhwMiInterface,
543         PMOS_INTERFACE              pOsInterface,
544         PMHW_SFC_OUT_SURFACE_PARAMS pSfcPipeOutSurface,
545         PMOS_COMMAND_BUFFER         pCmdBuffer)
546     {
547         return MOS_STATUS_SUCCESS;
548     }
549 
550     //!
551     //! \brief    Set SFC MMC States
552     //! \details  Update the SFC output MMC status
553     //! \param    [in] renderData
554     //!           Pointer to Render Data
555     //! \param    [in] outSurface
556     //!           Pointer to Sfc Output Surface
557     //! \param    [in,out] sfcStateParams
558     //!           Pointer to SFC State Params
559     //! \return   MOS_STATUS
560     //!
561     virtual MOS_STATUS SetSfcMmcStatus(
562         PVPHAL_VEBOX_RENDER_DATA    renderData,
563         PVPHAL_SURFACE              outSurface,
564         PMHW_SFC_STATE_PARAMS       sfcStateParams);
565 
566 private:
567 
568     //!
569     //! \brief    Setup parameters related to SFC_AVS State
570     //! \details  Setup the 8x8 table of SFC sampler
571     //! \return   MOS_STATUS
572     //!
573     MOS_STATUS SetAvsStateParams();
574 
575 public:
576     bool                            m_bSFC2Pass = false;
577     bool                            m_bSFC2PassPerfMode = false;
578 
579 protected:
580     bool                            disableSFC    = false;                      //!< Disable SFC for validation purposes
581     bool                            enableSfcMMC  = false;                      //!< Memory compression enbale flag - read from User feature keys
582 
583     PMOS_INTERFACE                  m_osInterface;                              //!< Os Interface
584     PRENDERHAL_INTERFACE            m_renderHal;                                //!< Pointer to RenderHal Structure Interface
585     PMHW_SFC_INTERFACE              m_sfcInterface;                             //!< Pointer to SFC Structure Interface
586 
587                                                                                 // AVS related params
588     MHW_AVS_PARAMS                  m_AvsParameters       = {};                 //!< AVS parameters
589     VPHAL_SFC_AVS_STATE             m_avsState            = {};                 //!< AVS State and Coeff. table
590 
591                                                                                 // ColorFill CSC related params
592     VPHAL_COLOR_SAMPLE_8            m_colorFillColorSrc   = {};                 //!< ColorFill Sample from DDI
593     VPHAL_COLOR_SAMPLE_8            m_colorFillColorDst   = {};                 //!< ColorFill Sample programmed in Sfc State
594     VPHAL_CSPACE                    m_colorFillSrcCspace  = {};                 //!< Cspace of the source ColorFill Color
595     VPHAL_CSPACE                    m_colorFillRTCspace   = {};                 //!< Cspace of the Render Target
596 
597                                                                                 // CSC related params
598     VPHAL_CSPACE                    m_cscRTCspace      = {};                    //!< Cspace of Render Target
599     VPHAL_CSPACE                    m_cscInputCspace   = {};                    //!< Cspace of input frame
600     float                           m_cscCoeff[9]     = {};                     //!< [3x3] Coeff matrix
601     float                           m_cscInOffset[3]  = {};                     //!< [3x1] Input Offset matrix
602     float                           m_cscOutOffset[3] = {};                     //!< [3x1] Output Offset matrix
603 
604                                                                                 // Surfaces used by SFC
605     VPHAL_SURFACE                   m_AVSLineBufferSurface = {};                //!< AVS Line Buffer Surface for SFC
606     VPHAL_SURFACE                   m_IEFLineBufferSurface = {};                //!< IEF Line Buffer Surface for SFC
607     VPHAL_SURFACE                   m_SFDLineBufferSurface = {};                //!< SFD Line Buffer Surface for SFC
608 
609                                                                                 // Stereo state.
610     uint32_t                        m_currentChannel = 0;                       //!< 0=StereoLeft or nonStereo, 1=StereoRight. N/A in nonStereo
611 
612     VPHAL_SFC_RENDER_DATA           m_renderData = {};                          //!< Transient Render data populated for every BLT call
613 
614     MediaUserSettingSharedPtr m_userSettingPtr = nullptr;                       //!< usersettingInstance
615 };
616 #else
617 // A dummy class that does nothing when SFC is not supported
618 
619 class VphalSfcState
620 {
621 public:
VphalSfcState(PMOS_INTERFACE osInterface,PRENDERHAL_INTERFACE renderHal,PMHW_SFC_INTERFACE sfcInterface)622     VphalSfcState(
623         PMOS_INTERFACE       osInterface,
624         PRENDERHAL_INTERFACE renderHal,
625         PMHW_SFC_INTERFACE   sfcInterface) {}
~VphalSfcState()626     virtual ~VphalSfcState() {}
627 
628     //!
629     //! \brief    Disable the SFC functionality
630     //! \param    [in] disable
631     //!           true to disable, false to enable SFC
632     //! \return   void
SetDisable(bool disable)633     void SetDisable(bool disable)
634     {
635 
636     }
637 
638     //!
639     //! \brief    Set SFC MMC status
640     //! \param    [in] enable
641     //!           true to disable, false to enable SFC MMC
642     //! \return   void
SetSfcOutputMmcStatus(bool enable)643     void SetSfcOutputMmcStatus(bool enable)
644     {
645 
646     }
647     //!
648     //! \brief    Check if SFC functionality is disabled
649     //! \return   true if disabled, false if enabled
IsDisabled()650     bool IsDisabled()
651     {
652         return true;
653     }
654 
655     //!
656     //! \brief    Set stero channel of input
657     //! \param    [in] currentChannel
658     //!           Current stero channel
659     //! \return   void
SetStereoChannel(uint32_t currentChannel)660     void SetStereoChannel(uint32_t currentChannel)
661     {
662 
663     }
664 
GetInputFormat()665     MOS_FORMAT GetInputFormat()
666     {
667         return Format_Invalid;
668     }
669 
GetInputColorSpace()670     VPHAL_CSPACE GetInputColorSpace()
671     {
672         return CSpace_None;
673     }
674 
InitRenderData()675     void InitRenderData()
676     {
677         {};
678     }
679 
680     //!
681     //! \brief    Get the output pipe considering the SFC restrictions
682     //! \details  Check which output pipe can be applied, SFC or Comp
683     //! \param    [in] pSrc
684     //!           Pointer to input surface of SFC
685     //! \param    [in] pRenderTarget
686     //!           Pointer to RenderTarget
687     //! \param    [in] pcRenderParams
688     //!           Pointer to VpHal render parameters
689     //! \return   the output pipe mode
690     //!
GetOutputPipe(PVPHAL_SURFACE pSrc,PVPHAL_SURFACE pRenderTarget,PCVPHAL_RENDER_PARAMS pcRenderParams)691     VPHAL_OUTPUT_PIPE_MODE GetOutputPipe(
692         PVPHAL_SURFACE              pSrc,
693         PVPHAL_SURFACE              pRenderTarget,
694         PCVPHAL_RENDER_PARAMS       pcRenderParams)
695     {
696         return VPHAL_OUTPUT_PIPE_MODE_COMP;
697     }
698 
699     //!
700     //! \brief    Setup SFC Rendering Flags
701     //! \details  Set up the SFC rendering flag based the input and render target
702     //!           surface, SFC state and the ColorFill/Alpha parameters
703     //! \param    [in] pColorFillParams
704     //!           Pointer to ColorFill params
705     //! \param    [in] pAlphaParams
706     //!           Pointer to Alpha params
707     //! \param    [in] pSrc
708     //!           Pointer to Source Surface
709     //! \param    [in] pRenderTarget
710     //!           Pointer to Render Target Surface
711     //! \param    [in,out] pRenderData
712     //!           Pointer to Vebox render Data
713     //! \return   void
714     //!
SetRenderingFlags(PVPHAL_COLORFILL_PARAMS pColorFillParams,PVPHAL_ALPHA_PARAMS pAlphaParams,PVPHAL_SURFACE pSrc,PVPHAL_SURFACE pRenderTarget,PVPHAL_VEBOX_RENDER_DATA pRenderData)715     void SetRenderingFlags(
716         PVPHAL_COLORFILL_PARAMS         pColorFillParams,
717         PVPHAL_ALPHA_PARAMS             pAlphaParams,
718         PVPHAL_SURFACE                  pSrc,
719         PVPHAL_SURFACE                  pRenderTarget,
720         PVPHAL_VEBOX_RENDER_DATA        pRenderData)    {  }
721 
722     //!
723     //! \brief    Free resources used by SFC Pipe
724     //! \details  Free the AVS and IEF line buffer surfaces for SFC
725     //! \return   void
726     //!
FreeResources()727     void FreeResources() { }
728 
729     //!
730     //! \brief    Check to see if the i/o surface is supported by SFC
731     //! \details  Check the format and the size of i/o surface and determine
732     //!           whether it can go through SFC pipe
733     //! \param    [in] pSrcSurface
734     //!           Pointer to Src surface
735     //! \param    [in] pOutSurface
736     //!           Pointer to Output surface
737     //! \param    [in] pAlphaParams
738     //!           Pointer to Alpha params
739     //! \return   true if SFC Pipe is needed else false
740     //!
IsFormatSupported(PVPHAL_SURFACE pSrcSurface,PVPHAL_SURFACE pOutSurface,PVPHAL_ALPHA_PARAMS pAlphaParams)741     bool IsFormatSupported(
742         PVPHAL_SURFACE              pSrcSurface,
743         PVPHAL_SURFACE              pOutSurface,
744         PVPHAL_ALPHA_PARAMS         pAlphaParams) { return false;}
745 
746     //!
747     //! \brief    Setup SFC states and parameters
748     //! \details  Setup SFC states and parameters including SFC State, AVS
749     //!           and IEF parameters
750     //! \param    [in] pSrcSurface
751     //!           Pointer to Source Surface
752     //! \param    [in] pOutSurface
753     //!           Pointer to Output Surface
754     //! \param    [in,out] pRenderData
755     //!           Pointer to Vebox Render data
756     //! \return   Return MOS_STATUS_SUCCESS if successful, otherwise failed
757     //!
SetupSfcState(PVPHAL_SURFACE pSrcSurface,PVPHAL_SURFACE pOutSurface,PVPHAL_VEBOX_RENDER_DATA pRenderData)758     MOS_STATUS SetupSfcState(
759         PVPHAL_SURFACE                  pSrcSurface,
760         PVPHAL_SURFACE                  pOutSurface,
761         PVPHAL_VEBOX_RENDER_DATA        pRenderData)    {return MOS_STATUS_SUCCESS; }
762 
763     //!
764     //! \brief    Send SFC pipe commands
765     //! \details  Register the surfaces and send the commands needed by SFC pipe
766     //! \param    [in] pRenderData
767     //!           Pointer to Vebox Render data
768     //! \param    [in,out] pCmdBuffer
769     //!           Pointer to command buffer
770     //! \return   MOS_STATUS_SUCCESS if successful, otherwise failed
771     //!
SendSfcCmd(PVPHAL_VEBOX_RENDER_DATA pRenderData,PMOS_COMMAND_BUFFER pCmdBuffer)772     MOS_STATUS SendSfcCmd(
773         PVPHAL_VEBOX_RENDER_DATA        pRenderData,
774         PMOS_COMMAND_BUFFER             pCmdBuffer)   { return MOS_STATUS_SUCCESS;}
775 };
776 #endif
777 
778 #endif // __VPHAL_RENDER_SFC_BASE_H__
779