Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 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 | |
Sean Paul | 5d8acfc | 2016-04-21 16:26:27 -0400 | [diff] [blame] | 17 | #ifndef ANDROID_PLATFORM_DRM_GENERIC_H_ |
| 18 | #define ANDROID_PLATFORM_DRM_GENERIC_H_ |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 19 | |
Alexandru Gheorghe | 0f5abd7 | 2018-05-01 14:37:10 +0100 | [diff] [blame] | 20 | #include "drmdevice.h" |
Sean Paul | 6376996 | 2016-04-21 16:25:06 -0400 | [diff] [blame] | 21 | #include "platform.h" |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 22 | |
| 23 | #include <hardware/gralloc.h> |
| 24 | |
Roman Stratiienko | 6f5e450 | 2019-11-27 19:23:03 +0200 | [diff] [blame] | 25 | #include <drm/drm_fourcc.h> |
| 26 | |
| 27 | #ifndef DRM_FORMAT_INVALID |
| 28 | #define DRM_FORMAT_INVALID 0 |
| 29 | #endif |
| 30 | |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 31 | namespace android { |
| 32 | |
| 33 | class DrmGenericImporter : public Importer { |
| 34 | public: |
Alexandru Gheorghe | 0f5abd7 | 2018-05-01 14:37:10 +0100 | [diff] [blame] | 35 | DrmGenericImporter(DrmDevice *drm); |
Haixia Shi | 479412c | 2015-10-27 10:40:48 -0700 | [diff] [blame] | 36 | ~DrmGenericImporter() override; |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 37 | |
| 38 | int Init(); |
| 39 | |
Haixia Shi | 479412c | 2015-10-27 10:40:48 -0700 | [diff] [blame] | 40 | int ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) override; |
| 41 | int ReleaseBuffer(hwc_drm_bo_t *bo) override; |
Alexey Firago | 18ec688 | 2018-11-21 23:47:05 +0300 | [diff] [blame] | 42 | bool CanImportBuffer(buffer_handle_t handle) override; |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 43 | |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 44 | uint32_t ConvertHalFormatToDrm(uint32_t hal_format); |
John Stultz | a451483 | 2018-08-24 16:27:36 -0700 | [diff] [blame] | 45 | uint32_t DrmFormatToBitsPerPixel(uint32_t drm_format); |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 46 | |
Mykhailo Sopiha | ad43886 | 2019-06-06 14:45:27 +0300 | [diff] [blame] | 47 | protected: |
Alexandru Gheorghe | 0f5abd7 | 2018-05-01 14:37:10 +0100 | [diff] [blame] | 48 | DrmDevice *drm_; |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 49 | |
Mykhailo Sopiha | ad43886 | 2019-06-06 14:45:27 +0300 | [diff] [blame] | 50 | private: |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 51 | const gralloc_module_t *gralloc_; |
Mykhailo Sopiha | 1693bc3 | 2019-07-08 18:28:56 +0300 | [diff] [blame] | 52 | bool exclude_non_hwfb_; |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 53 | }; |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 54 | } // namespace android |
Sean Paul | da6270d | 2015-06-01 14:11:52 -0400 | [diff] [blame] | 55 | |
| 56 | #endif |