Re: [Intel-gfx] [PATCH 2/4] drm: Refuse to create zero width/height cmdline modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 07, 2019 at 07:26:09PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> 
> If the user specifies zero width/height cmdline mode i915 will
> blow up as the fbdev path will bypass the regular fb sanity
> check that would otherwise have refused to create a framebuffer
> with zero width/height.
> 
> The reason I thought to try this is so that I can force a specific
> depth for fbdev without actually having to hardcode the mode
> on the kernel cmdline. Eg. if I pass video=0x0-8 I will get an
> 8bpp framebuffer at my monitor's native resolution.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Makes sense. Maybe we should fix the fbdev helper code and stop it from
bypassing normal drm_fb sanity checks too, but that's another story.
Probably would mean rebasing somehow into Noralf's generic fbdev stuff,
which doesn't use magic direct access to the driver anymore.

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/drm_modes.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 5a07a28fec6d..b36248a5d826 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1593,6 +1593,9 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
>  {
>  	struct drm_display_mode *mode;
>  
> +	if (cmd->xres == 0 || cmd->yres == 0)
> +		return NULL;
> +
>  	if (cmd->cvt)
>  		mode = drm_cvt_mode(dev,
>  				    cmd->xres, cmd->yres,
> -- 
> 2.21.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux