drm/fb: handle tiled connectors better
authorRob Clark <robdclark@gmail.com>
Wed, 11 Mar 2015 14:23:14 +0000 (10:23 -0400)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 11 Mar 2015 21:10:11 +0000 (22:10 +0100)
We don't want tile 0,0 to artificially constrain the size of the legacy
fbdev device.  Instead when reducing fb_size to be the minimum of all
displays, only consider the rightmost and bottommost tiles.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Tested-by: Hai Li <hali@codeaurora.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_fb_helper.c

index dca98a40a550b59a004a14de4da700a4639e6e49..1a20db7c971f4bc3c5f48c76307d3625ffc1b92a 100644 (file)
@@ -1034,9 +1034,16 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
        crtc_count = 0;
        for (i = 0; i < fb_helper->crtc_count; i++) {
                struct drm_display_mode *desired_mode;
-               int x, y;
+               struct drm_mode_set *mode_set;
+               int x, y, j;
+               /* in case of tile group, are we the last tile vert or horiz?
+                * If no tile group you are always the last one both vertically
+                * and horizontally
+                */
+               bool lastv = true, lasth = true;
 
                desired_mode = fb_helper->crtc_info[i].desired_mode;
+               mode_set = &fb_helper->crtc_info[i].mode_set;
 
                if (!desired_mode)
                        continue;
@@ -1051,8 +1058,21 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
 
                sizes.surface_width  = max_t(u32, desired_mode->hdisplay + x, sizes.surface_width);
                sizes.surface_height = max_t(u32, desired_mode->vdisplay + y, sizes.surface_height);
-               sizes.fb_width  = min_t(u32, desired_mode->hdisplay + x, sizes.fb_width);
-               sizes.fb_height = min_t(u32, desired_mode->vdisplay + y, sizes.fb_height);
+
+               for (j = 0; j < mode_set->num_connectors; j++) {
+                       struct drm_connector *connector = mode_set->connectors[j];
+                       if (connector->has_tile) {
+                               lasth = (connector->tile_h_loc == (connector->num_h_tile - 1));
+                               lastv = (connector->tile_v_loc == (connector->num_v_tile - 1));
+                               /* cloning to multiple tiles is just crazy-talk, so: */
+                               break;
+                       }
+               }
+
+               if (lasth)
+                       sizes.fb_width  = min_t(u32, desired_mode->hdisplay + x, sizes.fb_width);
+               if (lastv)
+                       sizes.fb_height = min_t(u32, desired_mode->vdisplay + y, sizes.fb_height);
        }
 
        if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) {