/* * cl_image_bo_buffer.h - cl image bo buffer * * Copyright (c) 2015 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: Wind Yuan */ #ifndef XCAM_CL_IMAGE_BO_BUFFER_H #define XCAM_CL_IMAGE_BO_BUFFER_H #include #include #include #include namespace XCam { class CLImageBoBuffer; class CLBoBufferPool; class CLImageBoData : public DrmBoData { friend class CLBoBufferPool; friend class CLImageBoBuffer; public: virtual int get_fd (); private: explicit CLImageBoData (SmartPtr &display, SmartPtr &image, drm_intel_bo *bo); XCAM_DEAD_COPY (CLImageBoData); SmartPtr &get_image () { return _image; } private: SmartPtr _image; }; class CLImageBoBuffer : public DrmBoBuffer { friend class CLBoBufferPool; public: SmartPtr get_cl_image (); protected: CLImageBoBuffer (const VideoBufferInfo &info, const SmartPtr &data); //derived from SwappedBuffer virtual SmartPtr create_new_swap_buffer ( const VideoBufferInfo &info, SmartPtr &data); }; class CLBoBufferPool : public DrmBoBufferPool { public: explicit CLBoBufferPool (SmartPtr &display, SmartPtr &context); ~CLBoBufferPool (); protected: // derived from BufferPool virtual bool fixate_video_info (VideoBufferInfo &info); virtual SmartPtr allocate_data (const VideoBufferInfo &buffer_info); virtual SmartPtr create_buffer_from_data (SmartPtr &data); private: SmartPtr create_image_bo (const VideoBufferInfo &buffer_info); XCAM_DEAD_COPY (CLBoBufferPool); private: SmartPtr _context; }; }; #endif // XCAM_CL_IMAGE_BO_BUFFER_H