VirtualBox

Ignore:
Timestamp:
Mar 3, 2016 8:22:29 PM (9 years ago)
Author:
vboxsync
Message:

bugref:8087: Additions/x11: support non-root X server: properly report when we are unable to display a hardware mouse cursor because the host does not currently wish to.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r59697 r59914  
    617617 *  if the corresponding alpha value in the ARGB image is greater than 0xF0. */
    618618static void copy_cursor_image(u8 *src, u8 *dst, int width, int height,
    619                               size_t cbMask)
     619                              size_t mask_size)
    620620{
    621621    unsigned i, j;
    622     size_t cbLine = (width + 7) / 8;
    623 
    624     memcpy(dst + cbMask, src, width * height * 4);
     622    size_t line_size = (width + 7) / 8;
     623
     624    memcpy(dst + mask_size, src, width * height * 4);
    625625    for (i = 0; i < height; ++i)
    626626        for (j = 0; j < width; ++j)
    627627            if (((uint32_t *)src)[i * width + j] > 0xf0000000)
    628                 dst[i * cbLine + j / 8] |= (0x80 >> (j % 8));
     628                dst[i * line_size + j / 8] |= (0x80 >> (j % 8));
    629629}
    630630
     
    641641    u8 *src;
    642642    u8 *dst = NULL;
    643     size_t cbData, cbMask;
     643    u32 caps = 0;
     644    size_t data_size, mask_size;
    644645    bool src_isiomem;
    645646
     
    651652    if (   width > VBOX_MAX_CURSOR_WIDTH || height > VBOX_MAX_CURSOR_HEIGHT
    652653        || width == 0 || hot_x > width || height == 0 || hot_y > height)
     654        return -EINVAL;
     655    rc = VBoxQueryConfHGSMI(&vbox->submit_info,
     656                            VBOX_VBVA_CONF32_CURSOR_CAPABILITIES, &caps);
     657    ret = -RTErrConvertToErrno(rc);
     658    if (ret)
     659        return ret;
     660    if (   caps & VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER
     661        || !(caps & VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE))
    653662        return -EINVAL;
    654663
     
    662671            /* The mask must be calculated based on the alpha channel, one bit
    663672             * per ARGB word, and must be 32-bit padded. */
    664             cbMask  = ((width + 7) / 8 * height + 3) & ~3;
    665             cbData = width * height * 4 + cbMask;
    666             dst = kmalloc(cbData, GFP_KERNEL);
     673            mask_size  = ((width + 7) / 8 * height + 3) & ~3;
     674            data_size = width * height * 4 + mask_size;
     675            dst = kmalloc(data_size, GFP_KERNEL);
    667676            if (dst)
    668677            {
     
    676685                                          | VBOX_MOUSE_POINTER_SHAPE
    677686                                          | VBOX_MOUSE_POINTER_ALPHA;
    678                         copy_cursor_image(src, dst, width, height, cbMask);
     687                        copy_cursor_image(src, dst, width, height, mask_size);
    679688                        rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags,
    680689                                                         hot_x, hot_y, width,
    681                                                          height, dst, cbData);
    682                         ret = RTErrConvertToErrno(rc);
     690                                                         height, dst, data_size);
     691                        ret = -RTErrConvertToErrno(rc);
    683692                    }
    684693                    else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette