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 GRALLOC_BUFFER_MAPPER_BASE_H 17#define GRALLOC_BUFFER_MAPPER_BASE_H 18 19#include <BufferMapper.h> 20#include <common/GrallocSubBuffer.h> 21#include <common/GrallocBufferBase.h> 22 23namespace android { 24namespace intel { 25 26class GrallocBufferMapperBase : public BufferMapper { 27public: 28 GrallocBufferMapperBase(DataBuffer& buffer); 29 virtual ~GrallocBufferMapperBase(); 30public: 31 virtual bool map() = 0; 32 virtual bool unmap() = 0; 33 34 uint32_t getGttOffsetInPage(int subIndex) const; 35 void* getCpuAddress(int subIndex) const; 36 uint32_t getSize(int subIndex) const; 37 virtual buffer_handle_t getKHandle(int subIndex); 38 virtual buffer_handle_t getFbHandle(int subIndex) = 0; 39 virtual void putFbHandle() = 0; 40 41protected: 42 // mapped info 43 uint32_t mGttOffsetInPage[SUB_BUFFER_MAX]; 44 void* mCpuAddress[SUB_BUFFER_MAX]; 45 uint32_t mSize[SUB_BUFFER_MAX]; 46 buffer_handle_t mKHandle[SUB_BUFFER_MAX]; 47}; 48 49} // namespace intel 50} // namespace android 51 52#endif /* TNG_GRALLOC_BUFFER_MAPPER_H */ 53