blob: 02aec92170aabfca54bdfab1147d0ca3744841ec [file] [log] [blame]
/*
* Copyright (C) 2020 Samsung Electronics Co. Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef EXYNOS_GRAPHIC_BUFFER_H_
#define EXYNOS_GRAPHIC_BUFFER_H_
#include "ExynosGraphicBufferCore.h"
#include <cstdint>
#include <ui/GraphicBufferAllocator.h>
#include <ui/GraphicBufferMapper.h>
#include <ui/GraphicTypes.h>
#include <ui/PixelFormat.h>
#include <ui/Rect.h>
/* Gralloc1 usages enum is provided here to ensure backward compatibility
* This enum will be deprecated in Android S so please consider switching to
* BufferUsage::<USAGE> found in
* hardware/interfaces/1.0(or 1.1, 1.2)/types.hal
*/
#include <hardware/gralloc1.h>
namespace vendor {
namespace graphics {
/* Android default usages */
typedef android::hardware::graphics::common::V1_2::BufferUsage BufferUsage;
/* Mapper extension class to allow locking with 64-bit usages */
class ExynosGraphicBufferMapper : public android::GraphicBufferMapper {
public:
static inline ExynosGraphicBufferMapper &get() {
return static_cast<ExynosGraphicBufferMapper &>(getInstance());
}
android::status_t lock64(buffer_handle_t handle, uint64_t usage, const android::Rect &bounds, void **vaddr,
int32_t *outBytesPerPixel = nullptr, int32_t *outBytesPerStride = nullptr);
android::status_t lockYCbCr64(buffer_handle_t handle, uint64_t usage, const android::Rect &bounds,
android_ycbcr *ycbcr);
};
typedef class android::GraphicBufferAllocator ExynosGraphicBufferAllocator;
/* libion helper for use by OMX only */
namespace ion {
typedef int ion_user_handle_t;
int get_ion_fd();
} /* namespace ion */
} /* namespace graphics */
} /* namespace vendor */
#endif /* EXYNOS_GRAPHIC_BUFFER_H_ */