From patchwork Fri Jun 23 09:46:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 13290211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D99C6EB64DD for ; Fri, 23 Jun 2023 09:46:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F17DF10E032; Fri, 23 Jun 2023 09:46:58 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0808910E032 for ; Fri, 23 Jun 2023 09:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687513616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EWV5IJPnuL/n2//LEWW5JxIujCzv2HOlTOGeXhOLqDs=; b=YAEia51HOhMc11DxFxqZkwF6q4LqY/ZpZUDWZqHk8tn33jgSLNWtCHyGgVUFlZIKN2xWm9 Qb/jUCa3N9AJgWhmG62ppuTHiQRqu9qD6aog2ANMNnfDl2k9kQLQtXcS7HsDClEBqvwqVZ L6IvXHztcab6uJC1gprqxW8fQHMVftQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-OzhPwuZkMEGAqaHpNurnJg-1; Fri, 23 Jun 2023 05:46:52 -0400 X-MC-Unique: OzhPwuZkMEGAqaHpNurnJg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA8CE28088BA; Fri, 23 Jun 2023 09:46:51 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73C6014682FB; Fri, 23 Jun 2023 09:46:50 +0000 (UTC) From: Jocelyn Falempe To: tzimmermann@suse.de, airlied@redhat.com, kuohsiang_chou@aspeedtech.com, jammy_huang@aspeedtech.com Subject: [PATCH] drm/ast: Fix default resolution when no monitor is connected on DP Date: Fri, 23 Jun 2023 11:46:39 +0200 Message-Id: <20230623094639.434293-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jocelyn Falempe , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Since commit fae7d186403e ("drm/probe-helper: Default to 640x480 if no EDID on DP") The default resolution is now 640x480 when no monitor is connected. But Aspeed graphics is mostly used in servers, where no monitor is attached. This also affects the "remote" resolution to 640x480, which is inconvenient, and breaks the anaconda installer. So when no EDID is present, set 1024x768 as preferred resolution. Fixes: fae7d186403e ("drm/probe-helper: Default to 640x480 if no EDID on DP") Signed-off-by: Jocelyn Falempe --- drivers/gpu/drm/ast/ast_mode.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) base-commit: 0adec22702d497385dbdc52abb165f379a00efba diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 36374828f6c8..8f7b7cc021c7 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1589,9 +1589,31 @@ static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs .get_modes = ast_dp501_connector_helper_get_modes, }; +static int ast_dp_probe_single_connector_modes(struct drm_connector *connector, + uint32_t maxX, uint32_t maxY) +{ + int ret; + struct drm_display_mode *mode; + + ret = drm_helper_probe_single_connector_modes(connector, maxX, maxY); + /* + * When no monitor are detected, DP now default to 640x480 + * As aspeed is mostly used in remote server, and DP monitors are + * rarely attached, it's better to default to 1024x768 + */ + if (!connector->edid_blob_ptr) { + list_for_each_entry(mode, &connector->modes, head) { + if (mode->hdisplay == 1024 && mode->vdisplay == 768) + mode->type |= DRM_MODE_TYPE_PREFERRED; + drm_mode_sort(&connector->modes); + } + } + return ret; +} + static const struct drm_connector_funcs ast_dp501_connector_funcs = { .reset = drm_atomic_helper_connector_reset, - .fill_modes = drm_helper_probe_single_connector_modes, + .fill_modes = ast_dp_probe_single_connector_modes, .destroy = drm_connector_cleanup, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, @@ -1678,7 +1700,7 @@ static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs static const struct drm_connector_funcs ast_astdp_connector_funcs = { .reset = drm_atomic_helper_connector_reset, - .fill_modes = drm_helper_probe_single_connector_modes, + .fill_modes = ast_dp_probe_single_connector_modes, .destroy = drm_connector_cleanup, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,