From patchwork Fri Mar 6 21:23:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5957851 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BB0D6BF440 for ; Fri, 6 Mar 2015 21:23:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7C432038F for ; Fri, 6 Mar 2015 21:23:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 011F52034E for ; Fri, 6 Mar 2015 21:23:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28A996E90F; Fri, 6 Mar 2015 13:23:31 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f178.google.com (mail-qc0-f178.google.com [209.85.216.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 32BB96E90F for ; Fri, 6 Mar 2015 13:23:29 -0800 (PST) Received: by qcvs11 with SMTP id s11so19730909qcv.7 for ; Fri, 06 Mar 2015 13:23:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gJOxbdOjOH2cbJ/ndXlJiuQ6kJyMMAPKNN9m/DOs5Fs=; b=s0hTGJm/ikkpj4DrazWvfcw/VccOSSP68d6DNQqfeze0pp7/RrgaZf1La70MTdiJSw n6z7K5LTyque41yDSFRRdzo+BQAHJUc1aP2nQwMqbtHbZZF9gUAVnLa9KW6cK4CmChF+ /CNGkCk4GSb6MgbVUHWMpZETIlg99jt3h3SDOuKtNEM19//jgJtKqD9zqFynTdlV4s3M m7CKfWD21NWHjeX/sFEzA27oayFtk0/0m4zZmmv0bf69EAkthFe4EZ3wqraF4apJ5+WI jnDEPNP0KNe09Ti8RvhEkm6ukfgWSxch3WZiTC4nDX8hBAtNsH0sVc6dXDB+7lTPzMtA qAWg== X-Received: by 10.229.214.199 with SMTP id hb7mr4840943qcb.12.1425677008863; Fri, 06 Mar 2015 13:23:28 -0800 (PST) Received: from localhost ([2601:6:2c00:943:eab1:fcff:fe75:3f91]) by mx.google.com with ESMTPSA id 76sm6554701qhs.5.2015.03.06.13.23.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2015 13:23:28 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/5] drm/fb: handle tiled connectors better Date: Fri, 6 Mar 2015 16:23:10 -0500 Message-Id: <1425676990-14341-6-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1425676990-14341-1-git-send-email-robdclark@gmail.com> References: <1425676990-14341-1-git-send-email-robdclark@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Hai Li --- drivers/gpu/drm/drm_fb_helper.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 5ec3849..182f04a 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -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_width); - 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) {