diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index b1984f901a6d..20c8fe94249e 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -288,6 +288,19 @@ static int drm_client_modeset_commit_legacy(struct drm_client_dev *client)
 	return ret;
 }
 
+static int __drm_client_modeset_commit_force(struct drm_client_dev *client)
+{
+	struct drm_device *dev = client->dev;
+	int ret;
+
+	if (drm_drv_uses_atomic_modeset(dev))
+		ret = drm_client_modeset_commit_atomic(client, true);
+	else
+		ret = drm_client_modeset_commit_legacy(client);
+
+	return ret;
+}
+
 /**
  * drm_client_modeset_commit_force() - Force commit CRTC configuration
  * @client: DRM client
@@ -299,14 +312,10 @@ static int drm_client_modeset_commit_legacy(struct drm_client_dev *client)
  */
 int drm_client_modeset_commit_force(struct drm_client_dev *client)
 {
-	struct drm_device *dev = client->dev;
 	int ret;
 
 	mutex_lock(&client->modeset_mutex);
-	if (drm_drv_uses_atomic_modeset(dev))
-		ret = drm_client_modeset_commit_atomic(client, true);
-	else
-		ret = drm_client_modeset_commit_legacy(client);
+	ret = __drm_client_modeset_commit_force(client);
 	mutex_unlock(&client->modeset_mutex);
 
 	return ret;
@@ -390,3 +399,94 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode)
 	return ret;
 }
 EXPORT_SYMBOL(drm_client_modeset_dpms);
+
+static void pan_set(struct drm_client_dev *client, unsigned int x,
+		    unsigned int y)
+{
+	struct drm_mode_set *mode_set;
+
+	drm_client_for_each_modeset(mode_set, client) {
+		mode_set->x = x;
+		mode_set->y = y;
+	}
+}
+
+static int drm_client_modeset_pan_display_atomic(struct drm_client_dev *client,
+						 unsigned int x,
+						 unsigned int y,
+						 unsigned int default_x,
+						 unsigned int default_y)
+{
+	int ret;
+
+	pan_set(client, x, y);
+
+	ret = __drm_client_modeset_commit_force(client);
+	if (ret)
+		pan_set(client, default_x, default_y);
+
+	return ret;
+}
+
+static int drm_client_modeset_pan_display_legacy(struct drm_client_dev *client,
+						 unsigned int x,
+						 unsigned int y)
+{
+	struct drm_device *dev = client->dev;
+	struct drm_mode_set *modeset;
+	int ret = 0;
+
+	drm_modeset_lock_all(dev);
+	drm_client_for_each_modeset(modeset, client) {
+		modeset->x = x;
+		modeset->y = y;
+
+		if (modeset->num_connectors)
+			ret = drm_mode_set_config_internal(modeset);
+	}
+	drm_modeset_unlock_all(dev);
+
+	return ret;
+}
+
+/**
+ * drm_client_modeset_dpms() - Set display panning
+ * @client: DRM client
+ * @x: Horizontal coordinate
+ * @y: Vertical coordinate
+ * @default_x: Fallback horizontal coordinate
+ * @default_y: Fallback vertical coordinate
+ *
+ * This function sets the display panning for screens with a virtual
+ * resolution. The x and y coordinates refer to the display's upper
+ * left pixel. If updating fails, the fallback coordinates provide a
+ * safe default value, such as (0,0).
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_pan_display(struct drm_client_dev *client,
+				   unsigned int x, unsigned int y,
+				   unsigned int default_x,
+				   unsigned int default_y)
+{
+	struct drm_device *dev = client->dev;
+	int ret;
+
+	if (!drm_master_internal_acquire(dev))
+		return -EBUSY;
+
+	mutex_lock(&client->modeset_mutex);
+	if (drm_drv_uses_atomic_modeset(dev))
+		ret = drm_client_modeset_pan_display_atomic(client, x, y,
+							    default_x,
+							    default_y);
+	else
+		ret = drm_client_modeset_pan_display_legacy(client, x, y);
+	mutex_unlock(&client->modeset_mutex);
+
+	drm_master_internal_release(dev);
+
+	return ret;
+}
+EXPORT_SYMBOL(drm_client_modeset_pan_display);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 7b388674a456..482e92c182c8 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1548,64 +1548,6 @@ int drm_fb_helper_set_par(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_set_par);
 
-static void pan_set(struct drm_fb_helper *fb_helper, int x, int y)
-{
-	struct drm_mode_set *mode_set;
-
-	mutex_lock(&fb_helper->client.modeset_mutex);
-	drm_client_for_each_modeset(mode_set, &fb_helper->client) {
-		mode_set->x = x;
-		mode_set->y = y;
-	}
-	mutex_unlock(&fb_helper->client.modeset_mutex);
-}
-
-static int pan_display_atomic(struct fb_var_screeninfo *var,
-			      struct fb_info *info)
-{
-	struct drm_fb_helper *fb_helper = info->par;
-	int ret;
-
-	pan_set(fb_helper, var->xoffset, var->yoffset);
-
-	ret = drm_client_modeset_commit_force(&fb_helper->client);
-	if (!ret) {
-		info->var.xoffset = var->xoffset;
-		info->var.yoffset = var->yoffset;
-	} else
-		pan_set(fb_helper, info->var.xoffset, info->var.yoffset);
-
-	return ret;
-}
-
-static int pan_display_legacy(struct fb_var_screeninfo *var,
-			      struct fb_info *info)
-{
-	struct drm_fb_helper *fb_helper = info->par;
-	struct drm_client_dev *client = &fb_helper->client;
-	struct drm_mode_set *modeset;
-	int ret = 0;
-
-	drm_modeset_lock_all(fb_helper->dev);
-	mutex_lock(&client->modeset_mutex);
-	drm_client_for_each_modeset(modeset, client) {
-		modeset->x = var->xoffset;
-		modeset->y = var->yoffset;
-
-		if (modeset->num_connectors) {
-			ret = drm_mode_set_config_internal(modeset);
-			if (!ret) {
-				info->var.xoffset = var->xoffset;
-				info->var.yoffset = var->yoffset;
-			}
-		}
-	}
-	mutex_unlock(&client->modeset_mutex);
-	drm_modeset_unlock_all(fb_helper->dev);
-
-	return ret;
-}
-
 /**
  * drm_fb_helper_pan_display - implementation for &fb_ops.fb_pan_display
  * @var: updated screen information
@@ -1615,27 +1557,22 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
 			      struct fb_info *info)
 {
 	struct drm_fb_helper *fb_helper = info->par;
-	struct drm_device *dev = fb_helper->dev;
 	int ret;
 
 	if (oops_in_progress)
 		return -EBUSY;
 
 	mutex_lock(&fb_helper->lock);
-	if (!drm_master_internal_acquire(dev)) {
-		ret = -EBUSY;
-		goto unlock;
-	}
-
-	if (drm_drv_uses_atomic_modeset(dev))
-		ret = pan_display_atomic(var, info);
-	else
-		ret = pan_display_legacy(var, info);
-
-	drm_master_internal_release(dev);
-unlock:
+	ret = drm_client_modeset_pan_display(&fb_helper->client, var->xoffset,
+					     var->yoffset, info->var.xoffset,
+					     info->var.yoffset);
 	mutex_unlock(&fb_helper->lock);
 
+	if (!ret) {
+		info->var.xoffset = var->xoffset;
+		info->var.yoffset = var->yoffset;
+	}
+
 	return ret;
 }
 EXPORT_SYMBOL(drm_fb_helper_pan_display);
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index 6cf48419f77f..37bf55634227 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -159,6 +159,10 @@ bool drm_client_panel_rotation(struct drm_mode_set *modeset, unsigned int *rotat
 int drm_client_modeset_commit_force(struct drm_client_dev *client);
 int drm_client_modeset_commit(struct drm_client_dev *client);
 int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
+int drm_client_modeset_pan_display(struct drm_client_dev *client,
+				   unsigned int x, unsigned int y,
+				   unsigned int default_x,
+				   unsigned int default_y);
 
 /**
  * drm_client_for_each_modeset() - Iterate over client modesets
