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_ 59