forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/bochs/bochs.h
....@@ -1,17 +1,15 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2
+
23 #include <linux/io.h>
34 #include <linux/console.h>
45
5
-#include <drm/drmP.h>
66 #include <drm/drm_crtc.h>
77 #include <drm/drm_crtc_helper.h>
88 #include <drm/drm_encoder.h>
99 #include <drm/drm_fb_helper.h>
10
-
1110 #include <drm/drm_gem.h>
12
-
13
-#include <drm/ttm/ttm_bo_driver.h>
14
-#include <drm/ttm/ttm_page_alloc.h>
11
+#include <drm/drm_gem_vram_helper.h>
12
+#include <drm/drm_simple_kms_helper.h>
1513
1614 /* ---------------------------------------------------------------------- */
1715
....@@ -51,11 +49,6 @@
5149 BOCHS_UNKNOWN,
5250 };
5351
54
-struct bochs_framebuffer {
55
- struct drm_framebuffer base;
56
- struct drm_gem_object *obj;
57
-};
58
-
5952 struct bochs_device {
6053 /* hw */
6154 void __iomem *mmio;
....@@ -63,6 +56,7 @@
6356 void __iomem *fb_map;
6457 unsigned long fb_base;
6558 unsigned long fb_size;
59
+ unsigned long qext_size;
6660
6761 /* mode */
6862 u16 xres;
....@@ -70,97 +64,34 @@
7064 u16 yres_virtual;
7165 u32 stride;
7266 u32 bpp;
67
+ struct edid *edid;
7368
7469 /* drm */
75
- struct drm_device *dev;
76
- struct drm_crtc crtc;
77
- struct drm_encoder encoder;
70
+ struct drm_device *dev;
71
+ struct drm_simple_display_pipe pipe;
7872 struct drm_connector connector;
79
- bool mode_config_initialized;
80
-
81
- /* ttm */
82
- struct {
83
- struct drm_global_reference mem_global_ref;
84
- struct ttm_bo_global_ref bo_global_ref;
85
- struct ttm_bo_device bdev;
86
- bool initialized;
87
- } ttm;
88
-
89
- /* fbdev */
90
- struct {
91
- struct bochs_framebuffer gfb;
92
- struct drm_fb_helper helper;
93
- int size;
94
- bool initialized;
95
- } fb;
9673 };
97
-
98
-#define to_bochs_framebuffer(x) container_of(x, struct bochs_framebuffer, base)
99
-
100
-struct bochs_bo {
101
- struct ttm_buffer_object bo;
102
- struct ttm_placement placement;
103
- struct ttm_bo_kmap_obj kmap;
104
- struct drm_gem_object gem;
105
- struct ttm_place placements[3];
106
- int pin_count;
107
-};
108
-
109
-static inline struct bochs_bo *bochs_bo(struct ttm_buffer_object *bo)
110
-{
111
- return container_of(bo, struct bochs_bo, bo);
112
-}
113
-
114
-static inline struct bochs_bo *gem_to_bochs_bo(struct drm_gem_object *gem)
115
-{
116
- return container_of(gem, struct bochs_bo, gem);
117
-}
118
-
119
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
120
-
121
-static inline u64 bochs_bo_mmap_offset(struct bochs_bo *bo)
122
-{
123
- return drm_vma_node_offset_addr(&bo->bo.vma_node);
124
-}
12574
12675 /* ---------------------------------------------------------------------- */
12776
12877 /* bochs_hw.c */
129
-int bochs_hw_init(struct drm_device *dev, uint32_t flags);
78
+int bochs_hw_init(struct drm_device *dev);
13079 void bochs_hw_fini(struct drm_device *dev);
13180
13281 void bochs_hw_setmode(struct bochs_device *bochs,
13382 struct drm_display_mode *mode);
83
+void bochs_hw_setformat(struct bochs_device *bochs,
84
+ const struct drm_format_info *format);
13485 void bochs_hw_setbase(struct bochs_device *bochs,
135
- int x, int y, u64 addr);
86
+ int x, int y, int stride, u64 addr);
87
+int bochs_hw_load_edid(struct bochs_device *bochs);
13688
13789 /* bochs_mm.c */
13890 int bochs_mm_init(struct bochs_device *bochs);
13991 void bochs_mm_fini(struct bochs_device *bochs);
140
-int bochs_mmap(struct file *filp, struct vm_area_struct *vma);
141
-
142
-int bochs_gem_create(struct drm_device *dev, u32 size, bool iskernel,
143
- struct drm_gem_object **obj);
144
-int bochs_gem_init_object(struct drm_gem_object *obj);
145
-void bochs_gem_free_object(struct drm_gem_object *obj);
146
-int bochs_dumb_create(struct drm_file *file, struct drm_device *dev,
147
- struct drm_mode_create_dumb *args);
148
-int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
149
- uint32_t handle, uint64_t *offset);
150
-
151
-int bochs_framebuffer_init(struct drm_device *dev,
152
- struct bochs_framebuffer *gfb,
153
- const struct drm_mode_fb_cmd2 *mode_cmd,
154
- struct drm_gem_object *obj);
155
-int bochs_bo_pin(struct bochs_bo *bo, u32 pl_flag, u64 *gpu_addr);
156
-int bochs_bo_unpin(struct bochs_bo *bo);
157
-
158
-extern const struct drm_mode_config_funcs bochs_mode_funcs;
15992
16093 /* bochs_kms.c */
16194 int bochs_kms_init(struct bochs_device *bochs);
162
-void bochs_kms_fini(struct bochs_device *bochs);
16395
16496 /* bochs_fbdev.c */
165
-int bochs_fbdev_init(struct bochs_device *bochs);
166
-void bochs_fbdev_fini(struct bochs_device *bochs);
97
+extern const struct drm_mode_config_funcs bochs_mode_funcs;