diff options
author | Tao Bao | 2017-02-07 14:51:00 -0600 |
---|---|---|
committer | Tao Bao | 2017-02-10 19:05:15 -0600 |
commit | 557fa1f45e413777a31b1bb2db4eee826c3ee486 (patch) | |
tree | eb142b80610f473197e284f372784c25f04a4f3b /minui/graphics_adf.h | |
parent | df464dbe79202b62f8b2cf73f45e52d9f32e5e5e (diff) | |
download | platform-bootable-recovery-557fa1f45e413777a31b1bb2db4eee826c3ee486.tar.gz platform-bootable-recovery-557fa1f45e413777a31b1bb2db4eee826c3ee486.tar.xz platform-bootable-recovery-557fa1f45e413777a31b1bb2db4eee826c3ee486.zip |
minui: Move graphics_{adf,drm,fbdev} into classes.
This CL defines minui_backend as an interface, and expresses the three
backends (adf, drm and fbdev) as subclasses to the interface.
Test: 'Run graphics test' on N9, Pixel C and N5X.
Change-Id: I0e23951c7b2e2ff918957a8d9fc8b0085b6e5952
Diffstat (limited to 'minui/graphics_adf.h')
-rw-r--r-- | minui/graphics_adf.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/minui/graphics_adf.h b/minui/graphics_adf.h new file mode 100644 index 00000000..2f019ed0 --- /dev/null +++ b/minui/graphics_adf.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 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 | |||
17 | #ifndef _GRAPHICS_ADF_H_ | ||
18 | #define _GRAPHICS_ADF_H_ | ||
19 | |||
20 | #include <adf/adf.h> | ||
21 | |||
22 | #include "graphics.h" | ||
23 | |||
24 | class GRSurfaceAdf : public GRSurface { | ||
25 | private: | ||
26 | int fence_fd; | ||
27 | int fd; | ||
28 | __u32 offset; | ||
29 | __u32 pitch; | ||
30 | |||
31 | friend class MinuiBackendAdf; | ||
32 | }; | ||
33 | |||
34 | class MinuiBackendAdf : public MinuiBackend { | ||
35 | public: | ||
36 | GRSurface* Init() override; | ||
37 | GRSurface* Flip() override; | ||
38 | void Blank(bool) override; | ||
39 | ~MinuiBackendAdf() override; | ||
40 | MinuiBackendAdf(); | ||
41 | |||
42 | private: | ||
43 | int SurfaceInit(const drm_mode_modeinfo* mode, GRSurfaceAdf* surf); | ||
44 | int InterfaceInit(); | ||
45 | int DeviceInit(adf_device* dev); | ||
46 | void SurfaceDestroy(GRSurfaceAdf* surf); | ||
47 | void Sync(GRSurfaceAdf* surf); | ||
48 | |||
49 | int intf_fd; | ||
50 | adf_id_t eng_id; | ||
51 | __u32 format; | ||
52 | adf_device dev; | ||
53 | unsigned int current_surface; | ||
54 | unsigned int n_surfaces; | ||
55 | GRSurfaceAdf surfaces[2]; | ||
56 | }; | ||
57 | |||
58 | #endif // _GRAPHICS_ADF_H_ | ||