Debian Codegraph @

media_driver/agnostic/Xe_M/Xe_XPM_plus/shared/renderhal_memdecomp.cpp

raw
1 /*
2 * Copyright (c) 2020, 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_memdecomp.cpp
24 //! \brief Defines data structures and interfaces for media memory decompression.
25 //! \details
26 //!
27 #include "renderhal_memdecomp.h"
28
29 MediaRenderDecompState::MediaRenderDecompState() :
30 MediaMemDecompBaseState(),
31 m_osInterface(nullptr),
32 m_mhwMiInterface(nullptr),
33 m_cpInterface(nullptr),
34 m_renderInterface(nullptr)
35 {
36 }
37
38 MediaRenderDecompState::~MediaRenderDecompState()
39 {
40 if (m_cpInterface)
41 {
42 if (m_osInterface)
43 {
44 m_osInterface->pfnDeleteMhwCpInterface(m_cpInterface);
45 m_cpInterface = nullptr;
46 }
47 else
48 {
49 RENDERHAL_MEMORY_DECOMP_ASSERTMESSAGE("Failed to destroy cpInterface.");
50 }
51 }
52 MOS_Delete(m_mhwMiInterface);
53 MOS_Delete(m_renderInterface);
54
55 if (m_osInterface)
56 {
57 m_osInterface->pfnDestroy(m_osInterface, false);
58 MOS_FreeMemory(m_osInterface);
59 m_osInterface = nullptr;
60 }
61 }
62
63 MOS_STATUS MediaRenderDecompState::MemoryDecompress(PMOS_RESOURCE targetResource)
64 {
65 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
66
67 MHW_FUNCTION_ENTER;
68
69 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(targetResource);
70
71 return eStatus;
72 }
73
74 MOS_STATUS MediaRenderDecompState::MediaMemoryCopy(
75 PMOS_RESOURCE inputResource,
76 PMOS_RESOURCE outputResource,
77 bool outputCompressed)
78 {
79 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
80
81 MHW_FUNCTION_ENTER;
82
83 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(inputResource);
84 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(outputResource);
85
86 return eStatus;
87 }
88
89 MOS_STATUS MediaRenderDecompState::MediaMemoryCopy2D(
90 PMOS_RESOURCE inputResource,
91 PMOS_RESOURCE outputResource,
92 uint32_t copyWidth,
93 uint32_t copyHeight,
94 uint32_t copyInputOffset,
95 uint32_t copyOutputOffset,
96 uint32_t bpp,
97 bool outputCompressed)
98 {
99 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
100
101 MHW_FUNCTION_ENTER;
102
103 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(inputResource);
104 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(outputResource);
105
106 return eStatus;
107 }
108
109 MOS_STATUS MediaRenderDecompState::Initialize(
110 PMOS_INTERFACE osInterface,
111 MhwCpInterface *cpInterface,
112 PMHW_MI_INTERFACE mhwMiInterface,
113 MhwRenderInterface *renderInterface)
114 {
115 MOS_STATUS eStatus;
116
117 eStatus = MOS_STATUS_SUCCESS;
118
119 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(osInterface);
120 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(cpInterface);
121 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(mhwMiInterface);
122 RENDERHAL_MEMORY_DECOMP_CHK_NULL_RETURN(renderInterface);
123
124 m_osInterface = osInterface;
125 m_cpInterface = cpInterface;
126 m_mhwMiInterface = mhwMiInterface;
127 m_renderInterface = renderInterface;
128
129 return eStatus;
130 }