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 GRAPHIC_BUFFER_H 17 #define GRAPHIC_BUFFER_H 18 19 #include <DataBuffer.h> 20 21 22 namespace android { 23 namespace intel { 24 25 class GraphicBuffer : public DataBuffer { 26 public: 27 enum { 28 USAGE_INVALID = 0xffffffff, 29 }; 30 31 public: 32 GraphicBuffer(buffer_handle_t handle); ~GraphicBuffer()33 virtual ~GraphicBuffer() {} 34 35 virtual void resetBuffer(buffer_handle_t handle); 36 getUsage()37 uint32_t getUsage() const { return mUsage; } getBpp()38 uint32_t getBpp() const { return mBpp; } 39 40 static bool isProtectedUsage(uint32_t usage); 41 static bool isProtectedBuffer(GraphicBuffer *buffer); 42 43 static bool isCompressionUsage(uint32_t usage); 44 static bool isCompressionBuffer(GraphicBuffer *buffer); 45 46 private: 47 void initBuffer(buffer_handle_t handle); 48 49 protected: 50 uint32_t mUsage; 51 uint32_t mBpp; 52 }; 53 54 } // namespace intel 55 } // namespace android 56 57 #endif /* GRAPHIC_BUFFER_H */ 58