Debian Codegraph @

media_driver/agnostic/common/cm/cm_ish_base.h

raw
1 /*
2 * Copyright (c) 2018-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 cm_ish_base.h
24 //! \brief Contains Class CmISHBase definitions
25 //!
26 #pragma once
27
28 #include "mos_os.h"
29 #include <list>
30 #include "igfxfmid.h"
31 #include "frame_tracker.h"
32
33 class CmKernelEx;
34 typedef struct _CM_HAL_STATE CM_HAL_STATE;
35
36 class CmISHBase
37 {
38 public:
39 MOS_STATUS Initialize(CM_HAL_STATE *cmhal, FrameTrackerProducer *trackerProducer);
40
41 virtual MOS_STATUS LoadKernels(CmKernelEx **kernels, int count);
42
43 inline MOS_RESOURCE* GetResource() {return m_resource; }
44
45 uint32_t GetSize() {return m_size; }
46
47 MOS_STATUS Refresh();
48
49 inline void Submit(uint32_t trackerIndex, uint32_t tracker) {m_lastTrackerToken->Merge(trackerIndex, tracker) ; }
50
51 inline uint32_t GetSipKernelOffset() {return m_sipKernelOffset; }
52
53 virtual void Clean();
54
55 // SIP kernels
56 bool m_isSipKernelLoaded;
57 uint8_t *m_sipKernel;
58 uint32_t m_sipKernelSize;
59 uint32_t m_sipKernelOffset;
60
61 protected:
62 CmISHBase();
63 virtual ~CmISHBase();
64
65 MOS_STATUS ExpandHeapSize(uint32_t extraSize);
66
67 virtual MOS_STATUS CreateSipKernel(CM_HAL_STATE *state) = 0;
68
69 MOS_INTERFACE *m_osInterface;
70 MOS_RESOURCE *m_resource;
71 uint8_t *m_lockedData;
72 uint32_t m_size;
73 uint32_t m_offset;
74
75 // sync resources
76 //uint32_t *m_latestTracker;
77 //uint32_t m_lastTracker;
78 FrameTrackerProducer *m_trackerProducer;
79 FrameTrackerToken *m_lastTrackerToken;
80
81 // destroyed buffers
82 std::list<MOS_RESOURCE *> m_destroyedResources;
83 std::list<FrameTrackerToken *> m_destroyedTrackers;
84
85 //recorded info
86 std::vector<CmKernelEx *> m_addedKernels;
87 uint32_t m_addedKernelCount;
88 std::map<uint64_t, uint32_t> m_addedHashValues;
89
90 // settings
91 const uint32_t m_initSize = 0x80000;
92 const uint32_t m_expandStep = 0x80000;
93 const uint32_t m_kernelAlign = 64;
94 const uint32_t m_kernelPadding = 128;
95
96 };