• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
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 UPDATER_UI_FBDEV_DRIVER_H
17 #define UPDATER_UI_FBDEV_DRIVER_H
18 
19 #include <cstdint>
20 #include <linux/fb.h>
21 #include "macros.h"
22 #include "graphic_drv.h"
23 
24 namespace Updater {
25 struct FbBufferObject {
26     uint32_t width {};
27     uint32_t height {};
28     uint32_t size {};
29     void *vaddr {};
30 };
31 
32 class FbdevDriver : public GraphicDrv {
33     DISALLOW_COPY_MOVE(FbdevDriver);
34 public:
35     FbdevDriver() = default;
36     ~FbdevDriver() override;
37     bool Init() override;
38     void Flip(const uint8_t *buf) override;
39     void GetGrSurface(GrSurface &surface) override;
40 private:
41     void FBLog() const;
42     void ReleaseFb(const struct FbBufferObject *fbo);
43     struct FbBufferObject buff_ {};
44     struct fb_fix_screeninfo finfo_ {};
45     struct fb_var_screeninfo vinfo_ {};
46 };
47 } // namespace Updater
48 #endif
49