Skip to contentSkip to conversation

drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()

PATCH New Andrey Strachuk 1 participant 1 message Aug 12, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()

Make sure that virtual screen size is not less than physical screen one.

---
 drivers/gpu/drm/drm_fb_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +6 -0
index 2d4cee6a10ff..ea07c97bc5a9 100644
@@ -1355,6 +1355,12 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	    (drm_format_info_block_height(fb->format, 0) > 1))
 		return -EINVAL;
 
+	/* make sure that virtual resolution >= physical resolution */
+	if (var->xres_virtual < var->xres)
+		var->xres_virtual = var->xres;
+	if (var->yres_virtual < var->yres)
+		var->yres_virtual = var->yres;
+
 	/*
 	 * Changes struct fb_var_screeninfo are currently not pushed back
 	 * to KMS, hence fail if different settings are requested.
Signature · 1 line
2.25.1