.. | .. |
---|
1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
---|
| 2 | + |
---|
2 | 3 | #include <linux/io.h> |
---|
3 | 4 | #include <linux/console.h> |
---|
4 | 5 | |
---|
5 | | -#include <drm/drmP.h> |
---|
6 | 6 | #include <drm/drm_crtc.h> |
---|
7 | 7 | #include <drm/drm_crtc_helper.h> |
---|
8 | 8 | #include <drm/drm_encoder.h> |
---|
9 | 9 | #include <drm/drm_fb_helper.h> |
---|
10 | | - |
---|
11 | 10 | #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> |
---|
15 | 13 | |
---|
16 | 14 | /* ---------------------------------------------------------------------- */ |
---|
17 | 15 | |
---|
.. | .. |
---|
51 | 49 | BOCHS_UNKNOWN, |
---|
52 | 50 | }; |
---|
53 | 51 | |
---|
54 | | -struct bochs_framebuffer { |
---|
55 | | - struct drm_framebuffer base; |
---|
56 | | - struct drm_gem_object *obj; |
---|
57 | | -}; |
---|
58 | | - |
---|
59 | 52 | struct bochs_device { |
---|
60 | 53 | /* hw */ |
---|
61 | 54 | void __iomem *mmio; |
---|
.. | .. |
---|
63 | 56 | void __iomem *fb_map; |
---|
64 | 57 | unsigned long fb_base; |
---|
65 | 58 | unsigned long fb_size; |
---|
| 59 | + unsigned long qext_size; |
---|
66 | 60 | |
---|
67 | 61 | /* mode */ |
---|
68 | 62 | u16 xres; |
---|
.. | .. |
---|
70 | 64 | u16 yres_virtual; |
---|
71 | 65 | u32 stride; |
---|
72 | 66 | u32 bpp; |
---|
| 67 | + struct edid *edid; |
---|
73 | 68 | |
---|
74 | 69 | /* 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; |
---|
78 | 72 | 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; |
---|
96 | 73 | }; |
---|
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 | | -} |
---|
125 | 74 | |
---|
126 | 75 | /* ---------------------------------------------------------------------- */ |
---|
127 | 76 | |
---|
128 | 77 | /* bochs_hw.c */ |
---|
129 | | -int bochs_hw_init(struct drm_device *dev, uint32_t flags); |
---|
| 78 | +int bochs_hw_init(struct drm_device *dev); |
---|
130 | 79 | void bochs_hw_fini(struct drm_device *dev); |
---|
131 | 80 | |
---|
132 | 81 | void bochs_hw_setmode(struct bochs_device *bochs, |
---|
133 | 82 | struct drm_display_mode *mode); |
---|
| 83 | +void bochs_hw_setformat(struct bochs_device *bochs, |
---|
| 84 | + const struct drm_format_info *format); |
---|
134 | 85 | 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); |
---|
136 | 88 | |
---|
137 | 89 | /* bochs_mm.c */ |
---|
138 | 90 | int bochs_mm_init(struct bochs_device *bochs); |
---|
139 | 91 | 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; |
---|
159 | 92 | |
---|
160 | 93 | /* bochs_kms.c */ |
---|
161 | 94 | int bochs_kms_init(struct bochs_device *bochs); |
---|
162 | | -void bochs_kms_fini(struct bochs_device *bochs); |
---|
163 | 95 | |
---|
164 | 96 | /* 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; |
---|