• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2007-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_manager.h
24 //! \brief     Contains Class CmSurfaceManager  definitions
25 //!
26 
27 #ifndef MEDIADRIVER_LINUX_COMMON_CM_CMSURFACEMANAGER_H_
28 #define MEDIADRIVER_LINUX_COMMON_CM_CMSURFACEMANAGER_H_
29 
30 #include "cm_def.h"
31 #include "cm_hal.h"
32 #include "cm_surface_manager_base.h"
33 
34 typedef enum _MOS_FORMAT MOS_FORMAT;
35 
36 namespace CMRT_UMD
37 {
38 class CmDeviceRT;
39 class CmSurface;
40 class CmBuffer_RT;
41 class CmSurfaceVme;
42 class CmSurfaceSampler8x8;
43 class CmSurfaceSampler;
44 class CmSurface2DUPRT;
45 class CmSurface2DRT;
46 class CmSurface3DRT;
47 class CmStateBuffer;
48 class CmKernelRT;
49 
50 class CmSurfaceManager:public CmSurfaceManagerBase
51 {
52 public:
53     static int32_t Create(
54         CmDeviceRT* device,
55         CM_HAL_MAX_VALUES halMaxValues,
56         CM_HAL_MAX_VALUES_EX lalMaxValuesEx,
57         CmSurfaceManager* &manager );
58 
59     static int32_t Destroy( CmSurfaceManager* &manager );
60 
61     int32_t CreateSurface2DFromMosResource(MOS_RESOURCE * mosResource, bool createdByCm, CmSurface2DRT* &surface);
62     int32_t UpdateSurface2D(MOS_RESOURCE * mosResource, int index, uint32_t handle);
63 
64     int32_t Surface2DSanityCheck(uint32_t width, uint32_t height, CM_SURFACE_FORMAT format);
65 
66 protected:
67     CmSurfaceManager(CmDeviceRT* device);
68     CmSurfaceManager();
69     ~CmSurfaceManager( void );
70     int32_t GetSurfaceInfo( MOS_RESOURCE *mosResource, uint32_t &width, uint32_t &height, uint32_t &pitch, CM_SURFACE_FORMAT &format);
71 
72 private:
73     CmSurfaceManager (const CmSurfaceManager& other);
74     CmSurfaceManager& operator= (const CmSurfaceManager& other);
75 };
76 }; //namespace
77 
78 #endif  // #ifndef MEDIADRIVER_LINUX_COMMON_CM_CMSURFACEMANAGER_H_
79