[PATCH 4/6] drm/omap: Allow allocation of larger buffers

Archit Taneja archit at ti.com
Fri Apr 11 00:23:33 PDT 2014


The drm ioctl DRM_IOCTL_MODE_ADDFB2 doesn't let us allocate buffers which are
greater than what is specified in the driver through dev->mode_config.

Create helpers for DISPC which return the max manager width and height supported
by the device. The maximum width for a framebuffer is set to the combined width
of the all the crtcs, assuming they are arranged horizontally.

Signed-off-by: Archit Taneja <archit at ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 10 ++++++----
 drivers/video/omap2/dss/dispc.c    | 12 ++++++++++++
 include/video/omapdss.h            |  2 ++
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index c8270e4..55ec575 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -306,11 +306,13 @@ static int omap_modeset_init(struct drm_device *dev)
 	dev->mode_config.min_width = 32;
 	dev->mode_config.min_height = 32;
 
-	/* note: eventually will need some cpu_is_omapXYZ() type stuff here
-	 * to fill in these limits properly on different OMAP generations..
+	/*
+	 * Note: the maximum width is set to the combined width of all the
+	 * crtcs. We could assume the same for the maximum height too, but
+	 * we generally don't use such a configuration.
 	 */
-	dev->mode_config.max_width = 2048;
-	dev->mode_config.max_height = 2048;
+	dev->mode_config.max_width = num_crtcs * dispc_mgr_max_width();
+	dev->mode_config.max_height = dispc_mgr_max_height();
 
 	dev->mode_config.funcs = &omap_mode_config_funcs;
 
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 77d6221..47f9829 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2999,6 +2999,18 @@ void dispc_mgr_set_timings(enum omap_channel channel,
 }
 EXPORT_SYMBOL(dispc_mgr_set_timings);
 
+u16 dispc_mgr_max_width(void)
+{
+	return dispc.feat->mgr_width_max;
+}
+EXPORT_SYMBOL(dispc_mgr_max_width);
+
+u16 dispc_mgr_max_height(void)
+{
+	return dispc.feat->mgr_height_max;
+}
+EXPORT_SYMBOL(dispc_mgr_max_height);
+
 static void dispc_mgr_set_lcd_divisor(enum omap_channel channel, u16 lck_div,
 		u16 pck_div)
 {
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 3d7c51a..53637ac 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -949,6 +949,8 @@ void dispc_mgr_set_lcd_config(enum omap_channel channel,
 		const struct dss_lcd_mgr_config *config);
 void dispc_mgr_set_timings(enum omap_channel channel,
 		const struct omap_video_timings *timings);
+u16 dispc_mgr_max_width(void);
+u16 dispc_mgr_max_height(void);
 void dispc_mgr_setup(enum omap_channel channel,
 		const struct omap_overlay_manager_info *info);
 
-- 
1.8.3.2



More information about the dri-devel mailing list