From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C70AC10F0E for ; Mon, 15 Apr 2019 16:45:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C15F21900 for ; Mon, 15 Apr 2019 16:45:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T5RIYLwT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="cnBy0CyM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C15F21900 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=emDI038R9E1ufhyeZMW4LzBL4XMsMKnyEyUiJxX4vMU=; b=T5RIYLwT7XRSZh CuxiGHbjaKgezvGfGSCn0uUcSVv22Hg3uTLLajH6Fc299mI3EVbuIITrE83bj50XYSIjYhVn2ruQg s97auH7/cwRIUukpdcx39cAdY4deWf8rFfuXlhb/H39OBoxclw2/VFqnqmnIdcFfYBjQUCvsKb6Nm yihaRbU8jkA6HSWpMndn0u/h0q6k0URkJIh5GOft0x8QLY+TekUoT9NjTFB+b2YmjBCUsnqWWkgrY KtDKVgJkd79kEERJvpllsVCBUOXIYnPStbTT9KvhPiq5+6jz3pmFayFFhCW7n5g/CRckwLsH1koT4 v/PlMhSaM4wBe8OoI4gw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG4jW-0002zu-Pn; Mon, 15 Apr 2019 16:45:26 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG4jT-0002zW-0G for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 16:45:24 +0000 Received: by mail-ed1-x543.google.com with SMTP id u57so14665747edm.3 for ; Mon, 15 Apr 2019 09:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=k5+mJWxB3Ea7LesSyWW9NW3dIde6YF4YuaWGQ9aQTNk=; b=cnBy0CyMFttxb96MFyyd5WVJc6i5meoATy/GL655Mw0jpCrm+jnQvn/FxP42ssEDoo 8eX/T0LkDGdNrpV/7w0tYs1oNS415D2j03qJQrn1e0k9A8M7vM930vT462njxmCSV+26 MIe2y8qofsHu1xCa6EBvwseuVRT/VK846NyAg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=k5+mJWxB3Ea7LesSyWW9NW3dIde6YF4YuaWGQ9aQTNk=; b=VONIwNgLYk0Tzfr4oDnwlBKCJkfr3sCk+C7PXQO8Y0DWYLw3P8C58FElYTZooZQU1e kFqT0tNidTsRml2pkjK/Yw9SpbMF4pM0AqPy2EzuaSk9/2Vcp2/PMvy7pC7C4ncDb6eH hPEOkWit6ToCd7pziID+SN/d2lPLHcxnmqYljBpk6EwXa1sy7Mr0yiDN0V+T2qFjfZnx o3EWeVLXLxv0ILviSBKEVLihV9bM1aDDHBm9OJcEXAcafoP0l/RZszOH80kXdPW6fOVu +pZ/9R8P9iWvGtOtr7LwHDXDYcjEPYoSKahOI0HA9LBLyQTkmgkqyqnSlQ3/wjfIGfyx TnpA== X-Gm-Message-State: APjAAAUlqQSO2ZpNbvW0Uys9O/cSoUopKvhuyeLj3FGf/liWS8w8BLd1 flAe6udc9P5fP5k2sPa984hDJg== X-Google-Smtp-Source: APXvYqwoXkp+GJOpaQDzL7BzQXXPalsXf72tPHAnjXowKG3MzSg7M7M5BokitxK9ifAunCG8RgUnOQ== X-Received: by 2002:a17:906:1dd5:: with SMTP id v21mr40558159ejh.142.1555346719982; Mon, 15 Apr 2019 09:45:19 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id a9sm3222101edt.93.2019.04.15.09.45.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Apr 2019 09:45:19 -0700 (PDT) Date: Mon, 15 Apr 2019 18:45:16 +0200 From: Daniel Vetter To: Maxime Ripard Subject: Re: [PATCH v2 4/5] drm/modes: Parse overscan properties Message-ID: <20190415164516.GJ2665@phenom.ffwll.local> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.19.0-1-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_094523_042986_A06B7A2B X-CRM114-Status: GOOD ( 22.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: eben@raspberrypi.org, David Airlie , Maarten Lankhorst , dri-devel@lists.freedesktop.org, Paul Kocialkowski , Sean Paul , Thomas Petazzoni , Daniel Vetter , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 11, 2019 at 03:22:42PM +0200, Maxime Ripard wrote: > Properly configuring the overscan properties might be needed for the > initial setup of the framebuffer for display that still have overscan. > Let's allow for more properties on the kernel command line to setup each > margin. > > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/drm_fb_helper.c | 47 ++++++++++++++++++++++++++++++++++- > drivers/gpu/drm/drm_modes.c | 44 ++++++++++++++++++++++++++++++++- > include/drm/drm_connector.h | 1 +- > 3 files changed, 92 insertions(+) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 8781897559b2..4e403fe1f451 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -2567,6 +2567,51 @@ static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper, > fb_helper->sw_rotations |= DRM_MODE_ROTATE_0; > } > > +static void drm_setup_connector_margins(struct drm_connector *connector) > +{ > + struct drm_cmdline_mode *cmdline = &connector->cmdline_mode; > + struct drm_modeset_acquire_ctx ctx; > + struct drm_atomic_state *state; > + struct drm_device *dev = connector->dev; > + int ret; > + > + if (!drm_drv_uses_atomic_modeset(dev)) > + return; > + > + drm_modeset_acquire_init(&ctx, 0); You can't do more than one atomic commit, and you need to restore everything (since userspace might have changed stuff) every time. That's why all the atomic code goes through restore_fbdev_mode_atomic eventually. See also how rotation is handled already. I guess you can omit handling this for non-atomic, since no one cares. > + > + state = drm_atomic_state_alloc(dev); > + state->acquire_ctx = &ctx; > + > +retry: > + drm_atomic_set_property(state, &connector->base, > + dev->mode_config.tv_left_margin_property, > + cmdline->overscan_left); > + > + drm_atomic_set_property(state, &connector->base, > + dev->mode_config.tv_right_margin_property, > + cmdline->overscan_right); > + > + drm_atomic_set_property(state, &connector->base, > + dev->mode_config.tv_top_margin_property, > + cmdline->overscan_top); > + > + drm_atomic_set_property(state, &connector->base, > + dev->mode_config.tv_bottom_margin_property, > + cmdline->overscan_bottom); > + > + ret = drm_atomic_commit(state); > + if (ret == -EDEADLK) { > + drm_atomic_state_clear(state); > + drm_modeset_backoff(&ctx); > + goto retry; > + } > + > + drm_atomic_state_put(state); > + drm_modeset_drop_locks(&ctx); > + drm_modeset_acquire_fini(&ctx); > +} > + > static void drm_setup_crtcs(struct drm_fb_helper *fb_helper, > u32 width, u32 height) > { > @@ -2680,6 +2725,8 @@ static void drm_setup_crtcs_fb(struct drm_fb_helper *fb_helper) > struct drm_connector *connector = > fb_helper->connector_info[i]->connector; > > + drm_setup_connector_margins(connector); > + > /* use first connected connector for the physical dimensions */ > if (connector->status == connector_status_connected) { > info->var.width = connector->display_info.width_mm; > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > index ac8d70b92b62..493ba3ccde70 100644 > --- a/drivers/gpu/drm/drm_modes.c > +++ b/drivers/gpu/drm/drm_modes.c > @@ -1586,6 +1586,50 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len, > } else if (!strncmp(option, "reflect_y", delim - option)) { > rotation |= DRM_MODE_REFLECT_Y; > sep = delim; > + } else if (!strncmp(option, "overscan_right", delim - option)) { > + const char *value = delim + 1; > + unsigned int margin; > + > + margin = simple_strtol(value, &sep, 10); > + > + /* Make sure we have parsed something */ > + if (sep == value) > + return -EINVAL; > + > + mode->overscan_right = margin; > + } else if (!strncmp(option, "overscan_left", delim - option)) { > + const char *value = delim + 1; > + unsigned int margin; > + > + margin = simple_strtol(value, &sep, 10); > + > + /* Make sure we have parsed something */ > + if (sep == value) > + return -EINVAL; > + > + mode->overscan_left = margin; > + } else if (!strncmp(option, "overscan_top", delim - option)) { > + const char *value = delim + 1; > + unsigned int margin; > + > + margin = simple_strtol(value, &sep, 10); > + > + /* Make sure we have parsed something */ > + if (sep == value) > + return -EINVAL; > + > + mode->overscan_top = margin; > + } else if (!strncmp(option, "overscan_bottom", delim - option)) { > + const char *value = delim + 1; > + unsigned int margin; > + > + margin = simple_strtol(value, &sep, 10); > + > + /* Make sure we have parsed something */ > + if (sep == value) > + return -EINVAL; > + > + mode->overscan_bottom = margin; > } else { > return -EINVAL; > } This will conflict quite a bit with Noralf's series to extract the modeset code from fb helpers. Cross review might be a good idea. -Daniel > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index dfe7f2304b35..44d9885dd401 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -903,6 +903,7 @@ struct drm_cmdline_mode { > int xres, yres; > int bpp; > int refresh; > + int overscan_right, overscan_top, overscan_left, overscan_bottom; > bool rb; > bool interlace; > bool cvt; > -- > git-series 0.9.1 > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel