1/*
2 * Copyright 2016 The Android Open Source Project
3 * * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *      http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC0MAPPER_H
17#define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC0MAPPER_H
18
19#include "GrallocMapper.h"
20
21#include <hardware/gralloc.h>
22
23namespace android {
24namespace hardware {
25namespace graphics {
26namespace mapper {
27namespace V2_0 {
28namespace implementation {
29
30class Gralloc0Mapper : public GrallocMapper {
31   public:
32    Gralloc0Mapper(const hw_module_t* module);
33
34   private:
35    Error registerBuffer(buffer_handle_t bufferHandle) override;
36    void unregisterBuffer(buffer_handle_t bufferHandle) override;
37    Error lockBuffer(buffer_handle_t bufferHandle, uint64_t cpuUsage,
38                     const IMapper::Rect& accessRegion, int fenceFd,
39                     void** outData) override;
40    Error lockBuffer(buffer_handle_t bufferHandle, uint64_t cpuUsage,
41                     const IMapper::Rect& accessRegion, int fenceFd,
42                     YCbCrLayout* outLayout) override;
43    Error unlockBuffer(buffer_handle_t bufferHandle, int* outFenceFd) override;
44
45    const gralloc_module_t* mModule;
46    uint8_t mMinor;
47};
48
49}  // namespace implementation
50}  // namespace V2_0
51}  // namespace mapper
52}  // namespace graphics
53}  // namespace hardware
54}  // namespace android
55
56#endif  // ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_GRALLOC0MAPPER_H
57