• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * cl_va_memory.h - CL va memory
3  *
4  *  Copyright (c) 2015 Intel Corporation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Author: Wind Yuan <feng.yuan@intel.com>
19  */
20 
21 #ifndef XCAM_CL_VA_MEMORY_H
22 #define XCAM_CL_VA_MEMORY_H
23 
24 #include "ocl/cl_memory.h"
25 #include "ocl/intel/cl_intel_context.h"
26 #include "drm_bo_buffer.h"
27 
28 namespace XCam {
29 
30 class CLVaBuffer
31     : public CLBuffer
32 {
33 public:
34     explicit CLVaBuffer (
35         const SmartPtr<CLIntelContext> &context,
36         SmartPtr<DrmBoBuffer> &bo);
37 
38 private:
39     bool init_va_buffer (const SmartPtr<CLIntelContext> &context, SmartPtr<DrmBoBuffer> &bo);
40 
41     XCAM_DEAD_COPY (CLVaBuffer);
42 
43 private:
44     SmartPtr<DrmBoBuffer>   _bo;
45 };
46 
47 class CLVaImage
48     : public CLImage
49 {
50 public:
51     explicit CLVaImage (
52         const SmartPtr<CLIntelContext> &context,
53         SmartPtr<DrmBoBuffer> &bo,
54         uint32_t offset = 0,
55         bool single_plane = false);
56     explicit CLVaImage (
57         const SmartPtr<CLIntelContext> &context,
58         SmartPtr<DrmBoBuffer> &bo,
59         const CLImageDesc &image_info,
60         uint32_t offset = 0);
~CLVaImage()61     ~CLVaImage () {}
62 
63 private:
64     bool init_va_image (
65         const SmartPtr<CLIntelContext> &context, SmartPtr<DrmBoBuffer> &bo,
66         const CLImageDesc &cl_desc, uint32_t offset);
67     bool merge_multi_plane (
68         const VideoBufferInfo &video_info,
69         CLImageDesc &cl_desc);
70 
71     XCAM_DEAD_COPY (CLVaImage);
72 
73 private:
74     SmartPtr<DrmBoBuffer>   _bo;
75     cl_libva_image          _va_image_info;
76 };
77 
78 };
79 #endif //
80