.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* Hisilicon Hibmc SoC drm driver |
---|
2 | 3 | * |
---|
3 | 4 | * Based on the bochs drm driver. |
---|
.. | .. |
---|
8 | 9 | * Rongrong Zou <zourongrong@huawei.com> |
---|
9 | 10 | * Rongrong Zou <zourongrong@gmail.com> |
---|
10 | 11 | * Jianhua Li <lijianhua@huawei.com> |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or modify |
---|
13 | | - * it under the terms of the GNU General Public License as published by |
---|
14 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
15 | | - * (at your option) any later version. |
---|
16 | | - * |
---|
17 | 12 | */ |
---|
18 | 13 | |
---|
19 | 14 | #ifndef HIBMC_DRM_DRV_H |
---|
20 | 15 | #define HIBMC_DRM_DRV_H |
---|
21 | 16 | |
---|
22 | | -#include <drm/drmP.h> |
---|
23 | | -#include <drm/drm_atomic.h> |
---|
24 | 17 | #include <drm/drm_fb_helper.h> |
---|
25 | | -#include <drm/drm_gem.h> |
---|
26 | | -#include <drm/ttm/ttm_bo_driver.h> |
---|
| 18 | +#include <drm/drm_framebuffer.h> |
---|
27 | 19 | |
---|
28 | | -struct hibmc_framebuffer { |
---|
29 | | - struct drm_framebuffer fb; |
---|
30 | | - struct drm_gem_object *obj; |
---|
31 | | -}; |
---|
32 | | - |
---|
33 | | -struct hibmc_fbdev { |
---|
34 | | - struct drm_fb_helper helper; |
---|
35 | | - struct hibmc_framebuffer *fb; |
---|
36 | | - int size; |
---|
37 | | -}; |
---|
| 20 | +struct drm_device; |
---|
38 | 21 | |
---|
39 | 22 | struct hibmc_drm_private { |
---|
40 | 23 | /* hw */ |
---|
.. | .. |
---|
42 | 25 | void __iomem *fb_map; |
---|
43 | 26 | unsigned long fb_base; |
---|
44 | 27 | unsigned long fb_size; |
---|
45 | | - bool msi_enabled; |
---|
46 | 28 | |
---|
47 | 29 | /* drm */ |
---|
48 | 30 | struct drm_device *dev; |
---|
| 31 | + struct drm_plane primary_plane; |
---|
| 32 | + struct drm_crtc crtc; |
---|
| 33 | + struct drm_encoder encoder; |
---|
| 34 | + struct drm_connector connector; |
---|
49 | 35 | bool mode_config_initialized; |
---|
50 | | - struct drm_atomic_state *suspend_state; |
---|
51 | | - |
---|
52 | | - /* ttm */ |
---|
53 | | - struct drm_global_reference mem_global_ref; |
---|
54 | | - struct ttm_bo_global_ref bo_global_ref; |
---|
55 | | - struct ttm_bo_device bdev; |
---|
56 | | - bool initialized; |
---|
57 | | - |
---|
58 | | - /* fbdev */ |
---|
59 | | - struct hibmc_fbdev *fbdev; |
---|
60 | | - bool mm_inited; |
---|
61 | 36 | }; |
---|
62 | | - |
---|
63 | | -#define to_hibmc_framebuffer(x) container_of(x, struct hibmc_framebuffer, fb) |
---|
64 | | - |
---|
65 | | -struct hibmc_bo { |
---|
66 | | - struct ttm_buffer_object bo; |
---|
67 | | - struct ttm_placement placement; |
---|
68 | | - struct ttm_bo_kmap_obj kmap; |
---|
69 | | - struct drm_gem_object gem; |
---|
70 | | - struct ttm_place placements[3]; |
---|
71 | | - int pin_count; |
---|
72 | | -}; |
---|
73 | | - |
---|
74 | | -static inline struct hibmc_bo *hibmc_bo(struct ttm_buffer_object *bo) |
---|
75 | | -{ |
---|
76 | | - return container_of(bo, struct hibmc_bo, bo); |
---|
77 | | -} |
---|
78 | | - |
---|
79 | | -static inline struct hibmc_bo *gem_to_hibmc_bo(struct drm_gem_object *gem) |
---|
80 | | -{ |
---|
81 | | - return container_of(gem, struct hibmc_bo, gem); |
---|
82 | | -} |
---|
83 | 37 | |
---|
84 | 38 | void hibmc_set_power_mode(struct hibmc_drm_private *priv, |
---|
85 | 39 | unsigned int power_mode); |
---|
.. | .. |
---|
88 | 42 | |
---|
89 | 43 | int hibmc_de_init(struct hibmc_drm_private *priv); |
---|
90 | 44 | int hibmc_vdac_init(struct hibmc_drm_private *priv); |
---|
91 | | -int hibmc_fbdev_init(struct hibmc_drm_private *priv); |
---|
92 | | -void hibmc_fbdev_fini(struct hibmc_drm_private *priv); |
---|
93 | | - |
---|
94 | | -int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel, |
---|
95 | | - struct drm_gem_object **obj); |
---|
96 | | -struct hibmc_framebuffer * |
---|
97 | | -hibmc_framebuffer_init(struct drm_device *dev, |
---|
98 | | - const struct drm_mode_fb_cmd2 *mode_cmd, |
---|
99 | | - struct drm_gem_object *obj); |
---|
100 | 45 | |
---|
101 | 46 | int hibmc_mm_init(struct hibmc_drm_private *hibmc); |
---|
102 | 47 | void hibmc_mm_fini(struct hibmc_drm_private *hibmc); |
---|
103 | | -int hibmc_bo_pin(struct hibmc_bo *bo, u32 pl_flag, u64 *gpu_addr); |
---|
104 | | -int hibmc_bo_unpin(struct hibmc_bo *bo); |
---|
105 | | -void hibmc_gem_free_object(struct drm_gem_object *obj); |
---|
106 | 48 | int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev, |
---|
107 | 49 | struct drm_mode_create_dumb *args); |
---|
108 | | -int hibmc_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev, |
---|
109 | | - u32 handle, u64 *offset); |
---|
110 | | -int hibmc_mmap(struct file *filp, struct vm_area_struct *vma); |
---|
111 | 50 | |
---|
112 | 51 | extern const struct drm_mode_config_funcs hibmc_mode_funcs; |
---|
113 | 52 | |
---|