Changeset 60284 in vbox for trunk/src/VBox/Additions/linux/drm
- Timestamp:
- Apr 1, 2016 10:25:29 AM (9 years ago)
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_drv.c
r60174 r60284 193 193 }; 194 194 195 static long vbox_ioctl(struct file *filp, unsigned int cmd, 196 unsigned long arg) 197 { 198 struct drm_file *file_priv = filp->private_data; 199 struct vbox_private *vbox = file_priv->minor->dev->dev_private; 200 201 #ifdef DRM_IOCTL_MODE_CURSOR2 202 if ((cmd == DRM_IOCTL_MODE_CURSOR) && vbox != NULL) 203 vbox->have_cursor_hotspot = false; 204 if ((cmd == DRM_IOCTL_MODE_CURSOR2) && vbox != NULL) 205 vbox->have_cursor_hotspot = true; 206 #endif 207 return drm_ioctl(filp, cmd, arg); 208 } 195 209 196 210 static const struct file_operations vbox_fops = … … 199 213 .open = drm_open, 200 214 .release = drm_release, 201 .unlocked_ioctl = drm_ioctl,215 .unlocked_ioctl = vbox_ioctl, 202 216 .mmap = vbox_mmap, 203 217 .poll = drm_poll, -
trunk/src/VBox/Additions/linux/drm/vbox_drv.h
r60141 r60284 85 85 #define VBOX_MAX_CURSOR_WIDTH 64 86 86 #define VBOX_MAX_CURSOR_HEIGHT 64 87 #define CURSOR_PIXEL_COUNT VBOX_MAX_CURSOR_WIDTH * VBOX_MAX_CURSOR_HEIGHT 88 #define CURSOR_DATA_SIZE CURSOR_PIXEL_COUNT * 4 + CURSOR_PIXEL_COUNT / 8 87 89 88 90 struct vbox_fbdev; … … 123 125 bool fbdev_init; 124 126 struct work_struct hotplug_work; 125 }; 127 bool have_cursor_hotspot; 128 uint32_t cursor_width; 129 uint32_t cursor_height; 130 size_t cursor_data_size; 131 uint8_t cursor_data[CURSOR_DATA_SIZE]; 132 }; 133 134 #undef CURSOR_PIXEL_COUNT 135 #undef CURSOR_DATA_SIZE 126 136 127 137 int vbox_driver_load(struct drm_device *dev, unsigned long flags); -
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r60198 r60284 678 678 mask_size = ((width + 7) / 8 * height + 3) & ~3; 679 679 data_size = width * height * 4 + mask_size; 680 dst = kmalloc(data_size, GFP_KERNEL); 681 if (dst) 680 vbox->cursor_width = width; 681 vbox->cursor_height = height; 682 vbox->cursor_data_size = data_size; 683 dst = vbox->cursor_data; 684 ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map); 685 if (!ret) 682 686 { 683 ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map);684 if (! ret)687 src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem); 688 if (!src_isiomem) 685 689 { 686 src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem); 687 if (!src_isiomem) 688 { 689 uint32_t flags = VBOX_MOUSE_POINTER_VISIBLE 690 | VBOX_MOUSE_POINTER_SHAPE 691 | VBOX_MOUSE_POINTER_ALPHA; 692 copy_cursor_image(src, dst, width, height, mask_size); 693 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, 694 hot_x, hot_y, width, 695 height, dst, data_size); 696 ret = -RTErrConvertToErrno(rc); 697 } 698 else 699 DRM_ERROR("src cursor bo should be in main memory\n"); 700 ttm_bo_kunmap(&uobj_map); 690 uint32_t flags = VBOX_MOUSE_POINTER_VISIBLE 691 | VBOX_MOUSE_POINTER_SHAPE 692 | VBOX_MOUSE_POINTER_ALPHA; 693 copy_cursor_image(src, dst, width, height, mask_size); 694 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, 695 hot_x, hot_y, width, 696 height, dst, data_size); 697 ret = -RTErrConvertToErrno(rc); 701 698 } 702 kfree(dst); 699 else 700 DRM_ERROR("src cursor bo should be in main memory\n"); 701 ttm_bo_kunmap(&uobj_map); 703 702 } 703 else 704 vbox->cursor_data_size = 0; 704 705 vbox_bo_unreserve(bo); 705 706 } … … 718 719 { 719 720 struct vbox_private *vbox = crtc->dev->dev_private; 721 uint32_t flags = VBOX_MOUSE_POINTER_VISIBLE 722 | VBOX_MOUSE_POINTER_SHAPE 723 | VBOX_MOUSE_POINTER_ALPHA; 724 uint32_t host_x, host_y; 725 uint32_t hot_x = 0; 726 uint32_t hot_y = 0; 727 int rc; 720 728 721 729 VBoxHGSMICursorPosition(&vbox->submit_info, true, x + crtc->x, 722 y + crtc->y, NULL, NULL); 730 y + crtc->y, &host_x, &host_y); 731 if (!vbox->have_cursor_hotspot && vbox->cursor_data_size != 0) { 732 if (x + crtc->x > host_x) 733 hot_x = min(x + crtc->x - host_x, vbox->cursor_width); 734 if (y + crtc->y > host_y) 735 hot_y = min(y + crtc->y - host_y, vbox->cursor_height); 736 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, 737 hot_x < 64 ? hot_x : 64, 738 hot_y < 64 ? hot_y : 64, 739 vbox->cursor_width, 740 vbox->cursor_height, 741 vbox->cursor_data, 742 vbox->cursor_data_size); 743 return -RTErrConvertToErrno(rc); 744 } 723 745 return 0; 724 746 }
Note:
See TracChangeset
for help on using the changeset viewer.