- Timestamp:
- Oct 16, 2018 11:48:44 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_fb.c
r74773 r74864 51 51 #include <VBoxVideo.h> 52 52 53 # define VBOX_DIRTY_DELAY (HZ / 30)53 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL_74) 54 54 /** 55 55 * Tell the host about dirty rectangles to update. … … 124 124 vbox_bo_unreserve(bo); 125 125 } 126 #endif 126 127 127 128 #ifdef CONFIG_FB_DEFERRED_IO 128 static void vbox_deferred_io(struct fb_info *info, struct list_head *pagelist) 129 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL_74) 130 static void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagelist) 129 131 { 130 132 struct vbox_fbdev *fbdev = info->par; … … 150 152 } 151 153 } 154 # endif 152 155 153 156 static struct fb_deferred_io vbox_defio = { 154 .delay = VBOX_DIRTY_DELAY,155 .deferred_io = vbox_deferred_io,157 .delay = HZ / 30, 158 .deferred_io = drm_fb_helper_deferred_io, 156 159 }; 157 160 #endif 158 161 159 static void vbox_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 162 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(RHEL_73) 163 static void drm_fb_helper_sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 160 164 { 161 165 struct vbox_fbdev *fbdev = info->par; … … 165 169 } 166 170 167 static void vbox_copyarea(struct fb_info *info, const struct fb_copyarea *area)171 static void drm_fb_helper_sys_copyarea(struct fb_info *info, const struct fb_copyarea *area) 168 172 { 169 173 struct vbox_fbdev *fbdev = info->par; … … 173 177 } 174 178 175 static void vbox_imageblit(struct fb_info *info, const struct fb_image *image)179 static void drm_fb_helper_sys_imageblit(struct fb_info *info, const struct fb_image *image) 176 180 { 177 181 struct vbox_fbdev *fbdev = info->par; … … 181 185 image->height); 182 186 } 187 #endif 183 188 184 189 static struct fb_ops vboxfb_ops = { … … 186 191 .fb_check_var = drm_fb_helper_check_var, 187 192 .fb_set_par = drm_fb_helper_set_par, 188 .fb_fillrect = vbox_fillrect,189 .fb_copyarea = vbox_copyarea,190 .fb_imageblit = vbox_imageblit,193 .fb_fillrect = drm_fb_helper_sys_fillrect, 194 .fb_copyarea = drm_fb_helper_sys_copyarea, 195 .fb_imageblit = drm_fb_helper_sys_imageblit, 191 196 .fb_pan_display = drm_fb_helper_pan_display, 192 197 .fb_blank = drm_fb_helper_blank, … … 221 226 } 222 227 228 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(RHEL_73) 229 static struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *helper) 230 { 231 struct fb_info *info; 232 struct vbox_fbdev *fbdev = 233 container_of(helper, struct vbox_fbdev, helper); 234 struct drm_device *dev = fbdev->helper.dev; 235 struct device *device = &dev->pdev->dev; 236 237 info = framebuffer_alloc(0, device); 238 if (!info) 239 return ERR_PTR(-ENOMEM); 240 fbdev->helper.fbdev = info; 241 242 if (fb_alloc_cmap(&info->cmap, 256, 0)) 243 return ERR_PTR(-ENOMEM); 244 245 info->apertures = alloc_apertures(1); 246 if (!info->apertures) 247 return ERR_PTR(-ENOMEM); 248 249 return info; 250 } 251 #endif 252 223 253 static int vboxfb_create(struct drm_fb_helper *helper, 224 254 struct drm_fb_helper_surface_size *sizes) … … 230 260 struct drm_framebuffer *fb; 231 261 struct fb_info *info; 232 struct device *device = &dev->pdev->dev;233 262 struct drm_gem_object *gobj; 234 263 struct vbox_bo *bo; … … 280 309 } 281 310 282 info = framebuffer_alloc(0, device); 283 if (!info) 284 return -ENOMEM; 311 info = drm_fb_helper_alloc_fbi(helper); 312 if (IS_ERR(info)) 313 return -PTR_ERR(info); 314 285 315 info->par = fbdev; 286 316 … … 289 319 fb = &fbdev->afb.base; 290 320 fbdev->helper.fb = fb; 291 fbdev->helper.fbdev = info;292 321 293 322 strcpy(info->fix.id, "vboxdrmfb"); … … 301 330 info->fbops = &vboxfb_ops; 302 331 303 ret = fb_alloc_cmap(&info->cmap, 256, 0);304 if (ret)305 return -ENOMEM;306 307 332 /* 308 333 * This seems to be done for safety checking that the framebuffer 309 334 * is not registered twice by different drivers. 310 335 */ 311 info->apertures = alloc_apertures(1);312 if (!info->apertures)313 return -ENOMEM;314 336 info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0); 315 337 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
Note:
See TracChangeset
for help on using the changeset viewer.