Changeset 60300 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Apr 3, 2016 7:31:33 PM (9 years ago)
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r59240 r60300 664 664 if (pyHost) 665 665 *pyHost = p->y; 666 Log(("%s: return: x=%u, y=%u\n", __PRETTY_FUNCTION__, (unsigned) x, (unsigned)y));666 Log(("%s: return: x=%u, y=%u\n", __PRETTY_FUNCTION__, (unsigned)p->x, (unsigned)p->y)); 667 667 } 668 668 /* Free the IO buffer. */ -
trunk/src/VBox/Additions/linux/drm/vbox_drv.h
r60290 r60300 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; … … 125 127 uint32_t input_mapping_width; 126 128 uint32_t input_mapping_height; 127 }; 129 uint32_t cursor_width; 130 uint32_t cursor_height; 131 uint32_t cursor_hot_x; 132 uint32_t cursor_hot_y; 133 size_t cursor_data_size; 134 uint8_t cursor_data[CURSOR_DATA_SIZE]; 135 }; 136 137 #undef CURSOR_PIXEL_COUNT 138 #undef CURSOR_DATA_SIZE 128 139 129 140 int vbox_driver_load(struct drm_device *dev, unsigned long flags); -
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r60290 r60300 319 319 static const struct drm_crtc_funcs vbox_crtc_funcs = { 320 320 .cursor_move = vbox_cursor_move, 321 #ifdef DRM_IOCTL_MODE_CURSOR2322 321 .cursor_set2 = vbox_cursor_set2, 323 #endif324 322 .reset = vbox_crtc_reset, 325 323 .set_config = drm_crtc_helper_set_config, … … 659 657 vbox_crtc->cursor_enabled = true; 660 658 if ( width > VBOX_MAX_CURSOR_WIDTH || height > VBOX_MAX_CURSOR_HEIGHT 661 || width == 0 || h ot_x > width || height == 0 || hot_y > height)659 || width == 0 || height == 0) 662 660 return -EINVAL; 663 661 rc = VBoxQueryConfHGSMI(&vbox->submit_info, … … 681 679 mask_size = ((width + 7) / 8 * height + 3) & ~3; 682 680 data_size = width * height * 4 + mask_size; 683 dst = kmalloc(data_size, GFP_KERNEL); 684 if (dst) 681 vbox->cursor_hot_x = min((uint32_t)max(hot_x, 0), width); 682 vbox->cursor_hot_y = min((uint32_t)max(hot_y, 0), height); 683 vbox->cursor_width = width; 684 vbox->cursor_height = height; 685 vbox->cursor_data_size = data_size; 686 dst = vbox->cursor_data; 687 ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map); 688 if (!ret) 685 689 { 686 ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map);687 if (! ret)690 src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem); 691 if (!src_isiomem) 688 692 { 689 src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem); 690 if (!src_isiomem) 691 { 692 uint32_t flags = VBOX_MOUSE_POINTER_VISIBLE 693 | VBOX_MOUSE_POINTER_SHAPE 694 | VBOX_MOUSE_POINTER_ALPHA; 695 copy_cursor_image(src, dst, width, height, mask_size); 696 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, 697 hot_x, hot_y, width, 698 height, dst, data_size); 699 ret = -RTErrConvertToErrno(rc); 700 } 701 else 702 DRM_ERROR("src cursor bo should be in main memory\n"); 703 ttm_bo_kunmap(&uobj_map); 693 uint32_t flags = VBOX_MOUSE_POINTER_VISIBLE 694 | VBOX_MOUSE_POINTER_SHAPE 695 | VBOX_MOUSE_POINTER_ALPHA; 696 copy_cursor_image(src, dst, width, height, mask_size); 697 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, 698 vbox->cursor_hot_x, 699 vbox->cursor_hot_y, 700 width, height, dst, 701 data_size); 702 ret = -RTErrConvertToErrno(rc); 704 703 } 705 kfree(dst); 704 else 705 DRM_ERROR("src cursor bo should be in main memory\n"); 706 ttm_bo_kunmap(&uobj_map); 706 707 } 708 else 709 vbox->cursor_data_size = 0; 707 710 vbox_bo_unreserve(bo); 708 711 } … … 721 724 { 722 725 struct vbox_private *vbox = crtc->dev->dev_private; 723 724 VBoxHGSMICursorPosition(&vbox->submit_info, true, x + crtc->x, 725 y + crtc->y, NULL, NULL); 726 return 0; 727 } 726 uint32_t flags = VBOX_MOUSE_POINTER_VISIBLE 727 | VBOX_MOUSE_POINTER_SHAPE 728 | VBOX_MOUSE_POINTER_ALPHA; 729 uint32_t host_x, host_y; 730 uint32_t hot_x = 0; 731 uint32_t hot_y = 0; 732 int rc; 733 734 /* We compare these to unsigned later and don't need to handle negative. */ 735 if (x + crtc->x < 0 || y + crtc->y < 0 || vbox->cursor_data_size == 0) 736 return 0; 737 rc = VBoxHGSMICursorPosition(&vbox->submit_info, true, x + crtc->x, 738 y + crtc->y, &host_x, &host_y); 739 if (RT_FAILURE(rc)) 740 return -RTErrConvertToErrno(rc); 741 if (x + crtc->x < host_x) 742 hot_x = min(host_x - x - crtc->x, vbox->cursor_width); 743 if (y + crtc->y < host_y) 744 hot_y = min(host_y - y - crtc->y, vbox->cursor_height); 745 if (hot_x == vbox->cursor_hot_x && hot_y == vbox->cursor_hot_y) 746 return 0; 747 vbox->cursor_hot_x = hot_x; 748 vbox->cursor_hot_y = hot_y; 749 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, hot_x, hot_y, 750 vbox->cursor_width, vbox->cursor_height, 751 vbox->cursor_data, 752 vbox->cursor_data_size); 753 return -RTErrConvertToErrno(rc); 754 }
Note:
See TracChangeset
for help on using the changeset viewer.