From patchwork Tue Mar 26 13:19:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10871035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE58A48C0 for ; Tue, 26 Mar 2019 13:20:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB2FE29087 for ; Tue, 26 Mar 2019 13:20:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9919028FC9; Tue, 26 Mar 2019 13:20:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 955B428FB5 for ; Tue, 26 Mar 2019 13:20:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D76E56E041; Tue, 26 Mar 2019 13:20:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 01C6D6E045 for ; Tue, 26 Mar 2019 13:20:15 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id p20so10246702eds.6 for ; Tue, 26 Mar 2019 06:20:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XbQEara1/oKAvGCmK3TwlFj44GrDr5e0qht7fMyMnfE=; b=O0D3aX3Dp6zg5MOcQdihoevRHM6ft97EQQ1sryVPsOs1ERMpedv+xliH5rIgpq1/Jr OIzG9sdyqCdzpEW7ModR81N23m11LXWoagAxDowaXYDH2bKxZMlMlTqgHEKj1eWK5KXT hpTFvOezjXDGeL9WT1AQOAMWfZl9UgiFyZTVqK9RmsblaIsMTwTKCAnfi4pG5J8hVQlO 2EkRTLN2vs0cfQOnWMhovxPa9q+cwH9TFnFOWQkwX609RJ6ANmo2Y+jABmgxY0psGQPE hhPVMjx4N3BjLrJbC0TMOvXF4bVX+WuOahwvERga0j91HDPU5Kg5oj+uGHGgSmlOWqSD Y1mQ== X-Gm-Message-State: APjAAAX4R9+fEZ7sptDdUAlcmHIAoiJzQrcPwqpjVS+lR+Uq83mDftQQ p9Zs05e3o3VYq8bNATP+ttZfTNJPCwY= X-Google-Smtp-Source: APXvYqwuXE8+kB4lB19PzJuQ+UaOEfTBTI9glP4ojSgTirf0UdnAa0V6DruOybb0B/iIaeEPTH7Qtw== X-Received: by 2002:a17:906:a18:: with SMTP id w24mr17491395ejf.94.1553606414409; Tue, 26 Mar 2019 06:20:14 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id d10sm3668547ejh.66.2019.03.26.06.20.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 06:20:13 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 01/21] drm/fb-helper: Add fill_info() functions Date: Tue, 26 Mar 2019 14:19:48 +0100 Message-Id: <20190326132008.11781-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XbQEara1/oKAvGCmK3TwlFj44GrDr5e0qht7fMyMnfE=; b=U/v1sSriLKxuO4288NwyDIccaxlHMBQaY7rpUTdp3bcDbq//ijl0N2rPkC2iysSMg+ Tytlub1wn20+IHLB3pLQSgoy8IHE13/NM2snCJ4wynMZvFfnJjno5SbLofi1AnBANX2y 7mXCuUHZNIHSqttdGHdbLDxcyos3nKuu/ryAg= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The fbdev split between fix and var information is kinda pointless for drm drivers since everything is fixed: The fbdev emulation doesn't support changing modes at all. Create a new simplified helper and use it in the generic fbdev helper code. Follow-up patches will beef it up more and roll it out to all drivers. v2: We need to keep sizes, since they might not match the fb dimesions (Noralf) Cc: Noralf Trønnes Signed-off-by: Daniel Vetter Reviewed-by: Noralf Trønnes --- drivers/gpu/drm/drm_fb_helper.c | 30 ++++++++++++++++++++++++++++-- include/drm/drm_fb_helper.h | 3 +++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index c3d6a8c78a51..b89d177228e2 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2105,6 +2105,33 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe } EXPORT_SYMBOL(drm_fb_helper_fill_var); +/** + * drm_fb_helper_fill_info - initializes fbdev information + * @info: fbdev instance to set up + * @fb_helper: fb helper instance to use as template + * @sizes: describes fbdev size and scanout surface size + * + * + * Sets up the variable and fixed fbdev metainformation from the given fb helper + * instance and the drm framebuffer allocated in &drm_fb_helper.fb. + * + * Drivers should call this (or their equivalent setup code) from their + * &drm_fb_helper_funcs.fb_probe callback after having allocated the fbdev + * backing storage framebuffer. + */ +void drm_fb_helper_fill_info(struct fb_info *info, + struct drm_fb_helper *fb_helper, + struct drm_fb_helper_surface_size *sizes) +{ + struct drm_framebuffer *fb = fb_helper->fb; + + drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth); + drm_fb_helper_fill_var(info, fb_helper, + sizes->fb_width, sizes->fb_height); + +} +EXPORT_SYMBOL(drm_fb_helper_fill_info); + static int drm_fb_helper_probe_connector_modes(struct drm_fb_helper *fb_helper, uint32_t maxX, uint32_t maxY) @@ -3165,8 +3192,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper, #endif strcpy(fbi->fix.id, "DRM emulated"); - drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth); - drm_fb_helper_fill_var(fbi, fb_helper, sizes->fb_width, sizes->fb_height); + drm_fb_helper_fill_info(fbi, fb_helper, sizes); if (fb->funcs->dirty) { struct fb_ops *fbops; diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 286d58efed5d..9ef72f20662d 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -293,6 +293,9 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe uint32_t fb_width, uint32_t fb_height); void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, uint32_t depth); +void drm_fb_helper_fill_info(struct fb_info *info, + struct drm_fb_helper *fb_helper, + struct drm_fb_helper_surface_size *sizes); void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper);