[Letux-kernel] [PATCH] omapdrm: try to allocate non-tiled buffer object if tiled fails
Andreas Kemnade
andreas at kemnade.info
Wed Feb 15 07:29:48 CET 2017
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
More information about the Letux-kernel
mailing list