xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/renderhal/renderhal_common.cpp (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2015-2017, 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     renderhal_common.cpp
24 //! \brief    The file of common utilities definitions shared between VPHAL and RenderHal
25 //! \details  Common utilities for writing sync tag between VPHal and RenderHal
26 //!
27 #include "mos_os.h"
28 #include "mos_util_debug.h"
29 
30 //!
31 //! \brief    Write Sync Tag to VP and RenderHal GSH at the same time
32 //! \details  Write Sync Tag to VP and RenderHal GSH at the same time
33 //! \param    uint32_t *pdwVpSyncTag
34 //!           [in] Pointer to legacy VPHal pHwInterface GSH sync tag(last sync tag completed)
35 //! \param    uint32_t *pdwRenderHalSyncTag
36 //!           [in] Pointer to RenderHal GSH sync tag(last sync tag completed)
37 //! \param    uint32_t dwSyncTag
38 //!           [in] Value of Sync tag to be updated
39 //! \return   MOS_STATUS
40 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
41 //!
RenderCommon_WriteSyncTag(uint32_t * pdwVpSyncTag,uint32_t * pdwRenderHalSyncTag,uint32_t dwSyncTag)42 MOS_STATUS RenderCommon_WriteSyncTag(
43                                         uint32_t *pdwVpSyncTag,
44                                         uint32_t *pdwRenderHalSyncTag,
45                                         uint32_t dwSyncTag)
46 {
47     MOS_STATUS          eStatus = MOS_STATUS_SUCCESS;
48 
49     MOS_OS_CHK_NULL(pdwVpSyncTag);
50     MOS_OS_CHK_NULL(pdwRenderHalSyncTag);
51 
52     *pdwVpSyncTag           = dwSyncTag;
53     *pdwRenderHalSyncTag    = dwSyncTag;
54 
55 finish:
56     return eStatus;
57 }
58 
59 //!
60 //! \brief    Write Next Sync Tag to VP and RenderHal GSH at the same time
61 //! \details  Write Next Sync Tag to VP and RenderHal GSH at the same time
62 //! \param    uint32_t *pdwVpNextSyncTag
63 //!           [in] Pointer to legacy VPHal pHwInterface GSH next sync tag(Next sync tag value to use)
64 //! \param    uint32_t *pdwRenderHalNextSyncTag
65 //!           [in] Pointer to RenderHal GSH next sync tag(Next sync tag value to use)
66 //! \param    uint32_t dwSyncTag
67 //!           [in] Value of Sync tag to be updated
68 //! \return   MOS_STATUS
69 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
70 //!
RenderCommon_WriteNextSyncTag(uint32_t * pdwVpNextSyncTag,uint32_t * pdwRenderHalNextSyncTag,uint32_t dwNextSyncTag)71 MOS_STATUS RenderCommon_WriteNextSyncTag(
72                                         uint32_t *pdwVpNextSyncTag,
73                                         uint32_t *pdwRenderHalNextSyncTag,
74                                         uint32_t dwNextSyncTag)
75 {
76     MOS_STATUS          eStatus = MOS_STATUS_SUCCESS;
77 
78     MOS_OS_CHK_NULL(pdwVpNextSyncTag);
79     MOS_OS_CHK_NULL(pdwRenderHalNextSyncTag);
80 
81     *pdwVpNextSyncTag           = dwNextSyncTag;
82     *pdwRenderHalNextSyncTag    = dwNextSyncTag;
83 
84 finish:
85     return eStatus;
86 }
87 
88