1
0
Fork 0
android_external_drm_hwcomp.../bufferinfo/BufferInfo.h
Roman Stratiienko 4b2cc484f9 drm_hwcomposer: Reorganize struct DrmHwcLayer
1. Move BlendMode, ColorSpace, SampleRange fields to the struct BufferInfo,
   allowing extraction of the data from native_handle using Metadata@4 API.
   Use it when data from HWC2 API can't be used (Currently it's a BlendMode
   case for CLIENT layer)

2. Rename DrmHwcLayer to LayerData and move it to compositor/ directory.
   (I was confused in the past because of similarity of names DrmHwcLayer
    vs HwcLayer, so this step should meke it easier for newcomers to
    understand the code)

3. Allow clonning of the LayerData to propagate it through the composition
   pipeline. Thus LayerData can be used by both HwcLayer to track state
   and by the compositor.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-17 11:20:44 +03:00

57 lines
1.4 KiB
C++

/*
* Copyright (C) 2022 The Android Open Source Project
*
* 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.
*/
#pragma once
#include <cstdint>
constexpr int kBufferMaxPlanes = 4;
enum class BufferColorSpace : int32_t {
kUndefined,
kItuRec601,
kItuRec709,
kItuRec2020,
};
enum class BufferSampleRange : int32_t {
kUndefined,
kFullRange,
kLimitedRange,
};
enum class BufferBlendMode : int32_t {
kUndefined,
kNone,
kPreMult,
kCoverage,
};
struct BufferInfo {
uint32_t width;
uint32_t height;
uint32_t format; /* DRM_FORMAT_* from drm_fourcc.h */
uint32_t pitches[kBufferMaxPlanes];
uint32_t offsets[kBufferMaxPlanes];
/* sizes[] is used only by mapper@4 metadata getter for internal purposes */
uint32_t sizes[kBufferMaxPlanes];
int prime_fds[kBufferMaxPlanes];
uint64_t modifiers[kBufferMaxPlanes];
BufferColorSpace color_space;
BufferSampleRange sample_range;
BufferBlendMode blend_mode;
};