[Letux-kernel] Fwd: [PATCH] omapdrm: try to allocate non-tiled buffer object if tiled fails

H. Nikolaus Schaller hns at goldelico.com
Wed Feb 15 10:15:49 CET 2017


Hi Matthijs,
Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.

Comments?

BR,
Nikolaus



> Anfang der weitergeleiteten Nachricht:
> 
> Von: Andreas Kemnade <andreas at kemnade.info>
> Betreff: [Letux-kernel] [PATCH] omapdrm: try to allocate non-tiled buffer object if tiled fails
> Datum: 15. Februar 2017 um 07:29:48 MEZ
> An: letux-kernel at openphoenux.org
> Antwort an: Discussions about the Letux Kernel <letux-kernel at openphoenux.org>
> 
> If omap_gem_new is called with OMAP_BO_TILED_32 and there is no DMM
> it immediatetly returns NULL. That causes a framebuffer device
> not to be created if there is no DMM available.
> So do a second try to allocate a buffer object using
> the old parameters so a framebuffer will still be created on OMAP3
> devices.
> 
> Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
> ---
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 46 ++++++++++++++++++++----------------
> 1 file changed, 25 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index 4a06444..fa52a94 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -119,26 +119,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
> 	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
> 			sizes->surface_depth);
> 
> -#if 0
> -	mode_cmd.width = sizes->surface_width;
> -	mode_cmd.height = sizes->surface_height;
> -
> -	mode_cmd.pitches[0] =
> -			DIV_ROUND_UP(mode_cmd.width * sizes->surface_bpp, 8);
> -
> -	fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
> -	if (fbdev->ywrap_enabled) {
> -		/* need to align pitch to page size if using DMM scrolling */
> -		mode_cmd.pitches[0] = PAGE_ALIGN(mode_cmd.pitches[0]);
> -	}
> -
> -	/* allocate backing bo */
> -	gsize = (union omap_gem_size){
> -		.bytes = PAGE_ALIGN(mode_cmd.pitches[0] * mode_cmd.height),
> -	};
> -	DBG("allocating %d bytes for fb %d", gsize.bytes, dev->primary->index);
> -	fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_SCANOUT | OMAP_BO_WC);
> -#else
> 	mode_cmd.width = 8192;  // XXX HACK
> 	mode_cmd.height = sizes->surface_height;
> 
> @@ -155,7 +135,31 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
> 		}
> 	};
> 	fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_TILED_32 | OMAP_BO_WC);
> -#endif
> +	if (!fbdev->bo) {
> +		mode_cmd.width = sizes->surface_width;
> +		mode_cmd.height = sizes->surface_height;
> +
> +		mode_cmd.pitches[0] =
> +			DIV_ROUND_UP(mode_cmd.width * sizes->surface_bpp, 8);
> +
> +		fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
> +		if (fbdev->ywrap_enabled) {
> +			/* need to align pitch to page size
> +			 * if using DMM scrolling
> +			 */
> +			mode_cmd.pitches[0] = PAGE_ALIGN(mode_cmd.pitches[0]);
> +		}
> +
> +		/* allocate backing bo */
> +		gsize = (union omap_gem_size){
> +			.bytes = PAGE_ALIGN(mode_cmd.pitches[0] *
> +				mode_cmd.height),
> +		};
> +		DBG("allocating %d bytes for fb %d", gsize.bytes,
> +			dev->primary->index);
> +		fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_SCANOUT |
> +			OMAP_BO_WC);
> +	}
> 	if (!fbdev->bo) {
> 		dev_err(dev->dev, "failed to allocate buffer object\n");
> 		ret = -ENOMEM;
> -- 
> 2.1.4
> 
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel



More information about the Letux-kernel mailing list