1 /* 2 // Copyright (c) 2014 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 #ifndef WSBM_H__ 17 #define WSBM_H__ 18 19 #include <ips/common/WsbmWrapper.h> 20 21 /** 22 * Class: WSBM 23 * A wrapper class to use libwsbm functionalities 24 */ 25 class Wsbm 26 { 27 private: 28 int mDrmFD; 29 public: 30 Wsbm(int drmFD); 31 ~Wsbm(); 32 bool initialize(); 33 void deinitialize(); 34 bool allocateTTMBuffer(uint32_t size, uint32_t align,void ** buf); 35 bool allocateTTMBufferUB(uint32_t size, uint32_t align, void ** buf, void *user_pt); 36 bool destroyTTMBuffer(void * buf); 37 void * getCPUAddress(void * buf); 38 uint32_t getGttOffset(void * buf); 39 bool wrapTTMBuffer(uint32_t handle, void **buf); 40 bool unreferenceTTMBuffer(void *buf); 41 bool waitIdleTTMBuffer(void *buf); 42 uint32_t getKBufHandle(void *buf); 43 private: 44 bool mInitialized; 45 }; 46 47 #endif /*__INTEL_WSBM_H__*/ 48