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 TTMBUFFERMAPPER_H_ 17#define TTMBUFFERMAPPER_H_ 18 19#include <DataBuffer.h> 20#include <BufferMapper.h> 21#include <common/Wsbm.h> 22 23namespace android { 24namespace intel { 25 26class TTMBufferMapper : public BufferMapper { 27public: 28 TTMBufferMapper(Wsbm& wsbm, DataBuffer& buffer); 29 virtual ~TTMBufferMapper(); 30public: 31 bool map(); 32 bool unmap(); 33 34 uint32_t getGttOffsetInPage(int subIndex) const { 35 return mGttOffsetInPage; 36 } 37 void* getCpuAddress(int subIndex) const { 38 return mCpuAddress; 39 } 40 uint32_t getSize(int subIndex) const { 41 return mSize; 42 } 43 buffer_handle_t getKHandle(int subIndex) { 44 return 0; 45 } 46 buffer_handle_t getFbHandle(int subIndex) { 47 return 0; 48 } 49 void putFbHandle() { 50 return; 51 } 52 53 // wait idle 54 bool waitIdle(); 55private: 56 int mRefCount; 57 Wsbm& mWsbm; 58 void* mBufferObject; 59 60 // mapped info 61 uint32_t mGttOffsetInPage; 62 void* mCpuAddress; 63 uint32_t mSize; 64}; 65 66} //namespace intel 67} //namespace android 68 69 70#endif /* TTMBUFFERMAPPER_H_ */ 71