xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/cm/cm_surface_sampler.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 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      cm_surface_sampler.h
24 //! \brief     Contains Class CmSurfaceSampler8x8  definitions
25 //!
26 
27 #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACESAMPLER_H_
28 #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACESAMPLER_H_
29 
30 #include "cm_surface.h"
31 
32 enum SAMPLER_SURFACE_TYPE
33 {
34     SAMPLER_SURFACE_TYPE_2D,
35     SAMPLER_SURFACE_TYPE_2DUP,
36     SAMPLER_SURFACE_TYPE_3D
37 };
38 
39 namespace CMRT_UMD
40 {
41 class CmSurfaceSampler : public CmSurface
42 {
43 public:
44     static int32_t Create(uint32_t index, uint32_t handleFor2D3D, uint32_t indexForCurrent, SAMPLER_SURFACE_TYPE surfaceType, CmSurfaceManager* surfaceManager, CmSurfaceSampler* &surfaceSampler, CM_FLAG* flag);
45     virtual int32_t GetSurfaceIndex(SurfaceIndex*& index);
46     int32_t GetHandle( uint32_t& handle );
47     int32_t GetSurfaceType(SAMPLER_SURFACE_TYPE& type);
48     int32_t GetCmIndexCurrent( uint16_t & index ) ;
49     int32_t SetMemoryObjectControl(MEMORY_OBJECT_CONTROL memCtrl, MEMORY_TYPE memType, uint32_t age);
50 
51     //NOT depend on RTTI::dynamic_cast
Type()52     CM_ENUM_CLASS_TYPE Type() const {return CM_ENUM_CLASS_TYPE_CMSURFACESAMPLER;};
53 
54 protected:
55     CmSurfaceSampler(uint32_t indexForCurrent, uint32_t handleFor2D3D, SAMPLER_SURFACE_TYPE surfaceType, CmSurfaceManager* surfaceManager, CM_FLAG* flag);
56     ~CmSurfaceSampler( void );
57 
58     int32_t Initialize( uint32_t index );
59     uint32_t m_handleFor2D3D;
60     uint32_t m_indexForCurrent; // SurfaceIndex's ID for 2D/3D, also indexing surface array
61 
62     SAMPLER_SURFACE_TYPE m_surfaceType; //0-Surface 2D, 1-Surface 3D
63     CM_FLAG m_flag;
64 
65 private:
66     CmSurfaceSampler(const CmSurfaceSampler& other);
67     CmSurfaceSampler& operator=(const CmSurfaceSampler& other);
68 };
69 };//namespace
70 
71 #endif  // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACESAMPLER_H_
72