Skip to contentSkip to conversation

drm/vmwgfx: Restore Guest-Backed only cursor plane support

PATCH Superseded Ian Forbes 4 participants 6 messages Oct 29, 2025 – Nov 3, 2025

Subsystems (3)
lore
Share & tools
lore

Ian Forbes

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: Restore Guest-Backed only cursor plane support

The referenced fixes commit broke the cursor plane for configurations which have Guest-Backed surfaces but no cursor MOB support.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 14 ++++++++++++++
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h |  1 +
 2 files changed, 15 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +14 -0
index 718832b08d96..87f0f61e470c 100644
@@ -100,6 +100,8 @@ vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
 	if (vmw->has_mob) {
 		if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
 			return VMW_CURSOR_UPDATE_MOB;
+		else
+			return VMW_CURSOR_UPDATE_GB_ONLY;
 	}
 
 	return VMW_CURSOR_UPDATE_NONE;
@@ -139,6 +141,7 @@ static u32 vmw_cursor_mob_size(enum vmw_cursor_update_type update_type,
 {
 	switch (update_type) {
 	case VMW_CURSOR_UPDATE_LEGACY:
+	case VMW_CURSOR_UPDATE_GB_ONLY:
 	case VMW_CURSOR_UPDATE_NONE:
 		return 0;
 	case VMW_CURSOR_UPDATE_MOB:
@@ -623,6 +626,7 @@ int vmw_cursor_plane_prepare_fb(struct drm_plane *plane,
 		if (!surface || vps->cursor.legacy.id == surface->snooper.id)
 			vps->cursor.update_type = VMW_CURSOR_UPDATE_NONE;
 		break;
+	case VMW_CURSOR_UPDATE_GB_ONLY:
 	case VMW_CURSOR_UPDATE_MOB: {
 		bo = vmw_user_object_buffer(&vps->uo);
 		if (bo) {
@@ -762,6 +766,16 @@ vmw_cursor_plane_atomic_update(struct drm_plane *plane,
 	case VMW_CURSOR_UPDATE_MOB:
 		vmw_cursor_update_mob(dev_priv, vps);
 		break;
+	case VMW_CURSOR_UPDATE_GB_ONLY:
+		struct vmw_bo *bo = vmw_user_object_buffer(&vps->uo);
+
+		if (bo)
+			vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
+						   vps->base.crtc_w,
+						   vps->base.crtc_h,
+						   vps->base.hotspot_x,
+						   vps->base.hotspot_y);
+		break;
 	case VMW_CURSOR_UPDATE_NONE:
 		/* do nothing */
 		break;
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h +1 -0
index 40694925a70e..0c2cc0699b0d 100644
@@ -33,6 +33,7 @@ static const u32 __maybe_unused vmw_cursor_plane_formats[] = {
 enum vmw_cursor_update_type {
 	VMW_CURSOR_UPDATE_NONE = 0,
 	VMW_CURSOR_UPDATE_LEGACY,
+	VMW_CURSOR_UPDATE_GB_ONLY,
 	VMW_CURSOR_UPDATE_MOB,
 };
 
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 16 lines · Ian Forbes

The referenced fixes commit broke the cursor plane for configurations which have Guest-Backed surfaces but no cursor MOB support.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 14 ++++++++++++++
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h |  1 +
 2 files changed, 15 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +0 -0
index 718832b08d96..87f0f61e470c 100644

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps) · line 107

Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +2 -0
@@ -100,6 +100,8 @@ vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
        if (vmw->has_mob) {
                if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
                        return VMW_CURSOR_UPDATE_MOB;
+               else
+                       return VMW_CURSOR_UPDATE_GB_ONLY;
        }
 
        return VMW_CURSOR_UPDATE_NONE;

Could you add a drm_warn_once before this return to give us a clear clue what's happening here in the future?

Otherwise it looks great, thanks for fixing this!

z

author
#3 lore raw

PATCH v2 1/1 drm/vmwgfx: Restore Guest-Backed only cursor plane support

In reply to Ian Forbes

The referenced fixes commit broke the cursor plane for configurations which have Guest-Backed surfaces but no cursor MOB support.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")

---

v2:
- Add drm_warn_once on unknown cursor type

 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 16 +++++++++++++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h |  1 +
 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +15 -1
index 718832b08d96..29af13f52fe4 100644
@@ -100,8 +100,10 @@ vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
 	if (vmw->has_mob) {
 		if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
 			return VMW_CURSOR_UPDATE_MOB;
+		else
+			return VMW_CURSOR_UPDATE_GB_ONLY;
 	}
-
+	drm_warn_once(&vmw->drm, "Unknown Cursor Type!\n");
 	return VMW_CURSOR_UPDATE_NONE;
 }
 
@@ -139,6 +141,7 @@ static u32 vmw_cursor_mob_size(enum vmw_cursor_update_type update_type,
 {
 	switch (update_type) {
 	case VMW_CURSOR_UPDATE_LEGACY:
+	case VMW_CURSOR_UPDATE_GB_ONLY:
 	case VMW_CURSOR_UPDATE_NONE:
 		return 0;
 	case VMW_CURSOR_UPDATE_MOB:
@@ -623,6 +626,7 @@ int vmw_cursor_plane_prepare_fb(struct drm_plane *plane,
 		if (!surface || vps->cursor.legacy.id == surface->snooper.id)
 			vps->cursor.update_type = VMW_CURSOR_UPDATE_NONE;
 		break;
+	case VMW_CURSOR_UPDATE_GB_ONLY:
 	case VMW_CURSOR_UPDATE_MOB: {
 		bo = vmw_user_object_buffer(&vps->uo);
 		if (bo) {
@@ -762,6 +766,16 @@ vmw_cursor_plane_atomic_update(struct drm_plane *plane,
 	case VMW_CURSOR_UPDATE_MOB:
 		vmw_cursor_update_mob(dev_priv, vps);
 		break;
+	case VMW_CURSOR_UPDATE_GB_ONLY:
+		struct vmw_bo *bo = vmw_user_object_buffer(&vps->uo);
+
+		if (bo)
+			vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
+						   vps->base.crtc_w,
+						   vps->base.crtc_h,
+						   vps->base.hotspot_x,
+						   vps->base.hotspot_y);
+		break;
 	case VMW_CURSOR_UPDATE_NONE:
 		/* do nothing */
 		break;
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h +1 -0
index 40694925a70e..0c2cc0699b0d 100644
@@ -33,6 +33,7 @@ static const u32 __maybe_unused vmw_cursor_plane_formats[] = {
 enum vmw_cursor_update_type {
 	VMW_CURSOR_UPDATE_NONE = 0,
 	VMW_CURSOR_UPDATE_LEGACY,
+	VMW_CURSOR_UPDATE_GB_ONLY,
 	VMW_CURSOR_UPDATE_MOB,
 };
 
Signature · 1 line
2.51.1
#4 lore raw
kernel test robot noticed the following build errors:

Hi Ian,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.18-rc3 next-20251031] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ian-Forbes/drm-vmwgfx-Restore-Guest-Backed-only-cursor-plane-support/20251030-224831
base:   git://anongit.freedesktop.org/drm/drm drm-next
patch link:    https://lore.kernel.org/r/20251030143910.134767-1-ian.forbes%40broadcom.com
patch subject: [PATCH v2] drm/vmwgfx: Restore Guest-Backed only cursor plane support
config: arm64-randconfig-001-20251101 (https://download.01.org/0day-ci/archive/20251101/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251101/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c: In function 'vmw_cursor_plane_atomic_update':

>> drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c:770:3: error: a label can only be part of a statement and a declaration is not a statement
      struct vmw_bo *bo = vmw_user_object_buffer(&vps->uo);
      ^~~~~~

vim +770 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c

739
740 void
741 vmw_cursor_plane_atomic_update(struct drm_plane *plane,
742 struct drm_atomic_state *state)
743 {
744 struct drm_plane_state *new_state =
745 drm_atomic_get_new_plane_state(state, plane);
746 struct drm_plane_state *old_state =
747 drm_atomic_get_old_plane_state(state, plane);
748 struct drm_crtc *crtc = new_state->crtc ?: old_state->crtc;
749 struct vmw_private *dev_priv = vmw_priv(plane->dev);
750 struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
751 struct vmw_plane_state *vps = vmw_plane_state_to_vps(new_state);
752 s32 hotspot_x, hotspot_y, cursor_x, cursor_y;
753
754 /*
755 * Hide the cursor if the new bo is null
756 */
757 if (vmw_user_object_is_null(&vps->uo)) {
758 vmw_cursor_update_position(dev_priv, false, 0, 0);
759 return;
760 }
761
762 switch (vps->cursor.update_type) {
763 case VMW_CURSOR_UPDATE_LEGACY:
764 vmw_cursor_plane_update_legacy(dev_priv, vps);
765 break;
766 case VMW_CURSOR_UPDATE_MOB:
767 vmw_cursor_update_mob(dev_priv, vps);
768 break;
769 case VMW_CURSOR_UPDATE_GB_ONLY:

 > 770			struct vmw_bo *bo = vmw_user_object_buffer(&vps->uo);
   771	
   772			if (bo)
   773				vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
   774							   vps->base.crtc_w,
   775							   vps->base.crtc_h,
   776							   vps->base.hotspot_x,
   777							   vps->base.hotspot_y);

778 break;
779 case VMW_CURSOR_UPDATE_NONE:
780 /* do nothing */
781 break;
782 }
783
784 /*
785 * For all update types update the cursor position
786 */
787 cursor_x = new_state->crtc_x + du->set_gui_x;
788 cursor_y = new_state->crtc_y + du->set_gui_y;
789
790 hotspot_x = vps->cursor.legacy.hotspot_x + new_state->hotspot_x;
791 hotspot_y = vps->cursor.legacy.hotspot_y + new_state->hotspot_y;
792
793 vmw_cursor_update_position(dev_priv, true, cursor_x + hotspot_x,
794 cursor_y + hotspot_y);
795 }
796

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author
#5 lore raw

PATCH v3 1/1 drm/vmwgfx: Restore Guest-Backed only cursor plane support

In reply to Ian Forbes

The referenced fixes commit broke the cursor plane for configurations which have Guest-Backed surfaces but no cursor MOB support.

Fixes 965544150d1c ("drm/vmwgfx: Refactor cursor handling")

---

v2:
- Add drm_warn_once on unknown cursor type
v3:
- Fixed compiler error on GCC 8

 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 16 +++++++++++++++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h |  1 +
 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c +15 -1
index 718832b08d96..c46f17ba7236 100644
@@ -100,8 +100,10 @@ vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
 	if (vmw->has_mob) {
 		if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
 			return VMW_CURSOR_UPDATE_MOB;
+		else
+			return VMW_CURSOR_UPDATE_GB_ONLY;
 	}
-
+	drm_warn_once(&vmw->drm, "Unknown Cursor Type!\n");
 	return VMW_CURSOR_UPDATE_NONE;
 }
 
@@ -139,6 +141,7 @@ static u32 vmw_cursor_mob_size(enum vmw_cursor_update_type update_type,
 {
 	switch (update_type) {
 	case VMW_CURSOR_UPDATE_LEGACY:
+	case VMW_CURSOR_UPDATE_GB_ONLY:
 	case VMW_CURSOR_UPDATE_NONE:
 		return 0;
 	case VMW_CURSOR_UPDATE_MOB:
@@ -623,6 +626,7 @@ int vmw_cursor_plane_prepare_fb(struct drm_plane *plane,
 		if (!surface || vps->cursor.legacy.id == surface->snooper.id)
 			vps->cursor.update_type = VMW_CURSOR_UPDATE_NONE;
 		break;
+	case VMW_CURSOR_UPDATE_GB_ONLY:
 	case VMW_CURSOR_UPDATE_MOB: {
 		bo = vmw_user_object_buffer(&vps->uo);
 		if (bo) {
@@ -737,6 +741,7 @@ void
 vmw_cursor_plane_atomic_update(struct drm_plane *plane,
 			       struct drm_atomic_state *state)
 {
+	struct vmw_bo *bo;
 	struct drm_plane_state *new_state =
 		drm_atomic_get_new_plane_state(state, plane);
 	struct drm_plane_state *old_state =
@@ -762,6 +767,15 @@ vmw_cursor_plane_atomic_update(struct drm_plane *plane,
 	case VMW_CURSOR_UPDATE_MOB:
 		vmw_cursor_update_mob(dev_priv, vps);
 		break;
+	case VMW_CURSOR_UPDATE_GB_ONLY:
+		bo = vmw_user_object_buffer(&vps->uo);
+		if (bo)
+			vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
+						   vps->base.crtc_w,
+						   vps->base.crtc_h,
+						   vps->base.hotspot_x,
+						   vps->base.hotspot_y);
+		break;
 	case VMW_CURSOR_UPDATE_NONE:
 		/* do nothing */
 		break;
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h +1 -0
index 40694925a70e..0c2cc0699b0d 100644
@@ -33,6 +33,7 @@ static const u32 __maybe_unused vmw_cursor_plane_formats[] = {
 enum vmw_cursor_update_type {
 	VMW_CURSOR_UPDATE_NONE = 0,
 	VMW_CURSOR_UPDATE_LEGACY,
+	VMW_CURSOR_UPDATE_GB_ONLY,
 	VMW_CURSOR_UPDATE_MOB,
 };
 
Signature · 1 line
2.51.1