[Letux-kernel] [small team RFC v3 09/10] omapdrm: try to allocate non-tiled buffer object if tiled fails
H. Nikolaus Schaller
hns at goldelico.com
Mon Feb 5 17:21:04 CET 2018
From: Andreas Kemnade <andreas at kemnade.info>
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 | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index b181c7e89560..65a936253521 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -152,6 +152,30 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
mode_cmd.pitches[0] = PAGE_ALIGN(
DIV_ROUND_UP(gsize.tiled.width * sizes->surface_bpp, 8));
#endif
+
+ if (!fbdev->bo) {
+ 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.12.2
More information about the Letux-kernel
mailing list