From patchwork Mon Aug 28 13:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367965 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD262C83F1A for ; Mon, 28 Aug 2023 13:22:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231586AbjH1NWF (ORCPT ); Mon, 28 Aug 2023 09:22:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbjH1NVj (ORCPT ); Mon, 28 Aug 2023 09:21:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B1F127; Mon, 28 Aug 2023 06:21:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 49E73219E8; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8GJmmvfwBrAhX80vy9z3XmR9U1soXnui0Gq8I5hETh4=; b=aDMxuHdYAtgtwCiMpngP+xUirP9sNewsDx8jCjryGF6r0cFnKlB94mf39dB2lvs/L+JrSo axsSbB3YDAA9PdU44E1dzxlrfERqsPEgVBRY6K2xAafehOPxQzpjWiTut3klsGTPH7ip1Q nBhkHkgRgpuksq9UIYIzTW6TuyMnpY8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8GJmmvfwBrAhX80vy9z3XmR9U1soXnui0Gq8I5hETh4=; b=g5flVod5dpKEV8gcf7hYE67LzXQdJojcSfCoxLxYnB7FGltw2ct6Assa4LVWJEe6PqZWU9 GsvXxvvuUoYKARCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 11C4513A11; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +JVuA1+f7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:35 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann , Steve Glendinning Subject: [PATCH 1/8] fbdev/smscufx: Use fb_ops helpers for deferred I/O Date: Mon, 28 Aug 2023 15:14:17 +0200 Message-ID: <20230828132131.29295-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Generate callback functions for struct fb_ops with the fbdev macro FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to the generated functions with fbdev initializer macros. Signed-off-by: Thomas Zimmermann Cc: Steve Glendinning Acked-by: Javier Martinez Canillas --- drivers/video/fbdev/smscufx.c | 85 +++++++++-------------------------- 1 file changed, 22 insertions(+), 63 deletions(-) diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c index 387d18706fec..90a77d19b236 100644 --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -894,64 +894,6 @@ static int ufx_handle_damage(struct ufx_data *dev, int x, int y, return 0; } -/* Path triggered by usermode clients who write to filesystem - * e.g. cat filename > /dev/fb1 - * Not used by X Windows or text-mode console. But useful for testing. - * Slow because of extra copy and we must assume all pixels dirty. */ -static ssize_t ufx_ops_write(struct fb_info *info, const char __user *buf, - size_t count, loff_t *ppos) -{ - ssize_t result; - struct ufx_data *dev = info->par; - u32 offset = (u32) *ppos; - - result = fb_sys_write(info, buf, count, ppos); - - if (result > 0) { - int start = max((int)(offset / info->fix.line_length), 0); - int lines = min((u32)((result / info->fix.line_length) + 1), - (u32)info->var.yres); - - ufx_handle_damage(dev, 0, start, info->var.xres, lines); - } - - return result; -} - -static void ufx_ops_copyarea(struct fb_info *info, - const struct fb_copyarea *area) -{ - - struct ufx_data *dev = info->par; - - sys_copyarea(info, area); - - ufx_handle_damage(dev, area->dx, area->dy, - area->width, area->height); -} - -static void ufx_ops_imageblit(struct fb_info *info, - const struct fb_image *image) -{ - struct ufx_data *dev = info->par; - - sys_imageblit(info, image); - - ufx_handle_damage(dev, image->dx, image->dy, - image->width, image->height); -} - -static void ufx_ops_fillrect(struct fb_info *info, - const struct fb_fillrect *rect) -{ - struct ufx_data *dev = info->par; - - sys_fillrect(info, rect); - - ufx_handle_damage(dev, rect->dx, rect->dy, rect->width, - rect->height); -} - /* NOTE: fb_defio.c is holding info->fbdefio.mutex * Touching ANY framebuffer memory that triggers a page fault * in fb_defio will cause a deadlock, when it also tries to @@ -1279,14 +1221,31 @@ static int ufx_ops_blank(int blank_mode, struct fb_info *info) return 0; } +static void ufx_ops_damage_range(struct fb_info *info, off_t off, size_t len) +{ + struct ufx_data *dev = info->par; + int start = max((int)(off / info->fix.line_length), 0); + int lines = min((u32)((len / info->fix.line_length) + 1), (u32)info->var.yres); + + ufx_handle_damage(dev, 0, start, info->var.xres, lines); +} + +static void ufx_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height) +{ + struct ufx_data *dev = info->par; + + ufx_handle_damage(dev, x, y, width, height); +} + +FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(ufx_ops, + ufx_ops_damage_range, + ufx_ops_damage_area) + static const struct fb_ops ufx_ops = { .owner = THIS_MODULE, - .fb_read = fb_sys_read, - .fb_write = ufx_ops_write, + __FB_DEFAULT_DEFERRED_OPS_RDWR(ufx_ops), .fb_setcolreg = ufx_ops_setcolreg, - .fb_fillrect = ufx_ops_fillrect, - .fb_copyarea = ufx_ops_copyarea, - .fb_imageblit = ufx_ops_imageblit, + __FB_DEFAULT_DEFERRED_OPS_DRAW(ufx_ops), .fb_mmap = ufx_ops_mmap, .fb_ioctl = ufx_ops_ioctl, .fb_open = ufx_ops_open, From patchwork Mon Aug 28 13:14:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367964 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84097C83F16 for ; Mon, 28 Aug 2023 13:22:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231390AbjH1NWD (ORCPT ); Mon, 28 Aug 2023 09:22:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231641AbjH1NVj (ORCPT ); Mon, 28 Aug 2023 09:21:39 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEF18128; Mon, 28 Aug 2023 06:21:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8A6E21FD60; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SEjIfU5qkBkLS6zCELI50VsWPShlN/pL6jvMkczxRoU=; b=LT2rFmi1XWFhXlVBekdYnBO4HjgbLNLN27jqTKW3v6l05aOeqA5R5TpJ2vC7zXWBJw2Gt1 qlKVa9noO6GN9/Pc8zIfE+vPsiQXMqpdUE0IL3ipJWGkEOw7ElJnWhmGWBxzN1P5r82mjH UUvpntqPuA+PV61KXCBWyrpJ732HHKI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SEjIfU5qkBkLS6zCELI50VsWPShlN/pL6jvMkczxRoU=; b=Q6E7Oj5b9gd6mmeJUJYGRCsRKQFlT8CC+/Ap3Hu7rBLJJfdk5NNwxZOX+tN4ezXjugxNWZ GUKWv3LadH1XexBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4F09013A1C; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EKZkEl+f7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:35 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann , Bernie Thompson Subject: [PATCH 2/8] fbdev/udlfb: Use fb_ops helpers for deferred I/O Date: Mon, 28 Aug 2023 15:14:18 +0200 Message-ID: <20230828132131.29295-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Generate callback functions for struct fb_ops with the fbdev macro FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to the generated functions with fbdev initializer macros. Signed-off-by: Thomas Zimmermann Cc: Bernie Thompson Acked-by: Javier Martinez Canillas --- drivers/video/fbdev/udlfb.c | 89 +++++++++---------------------------- 1 file changed, 22 insertions(+), 67 deletions(-) diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index b70762ead13c..2460ff4ac86b 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -715,68 +715,6 @@ static void dlfb_offload_damage(struct dlfb_data *dlfb, int x, int y, int width, schedule_work(&dlfb->damage_work); } -/* - * Path triggered by usermode clients who write to filesystem - * e.g. cat filename > /dev/fb1 - * Not used by X Windows or text-mode console. But useful for testing. - * Slow because of extra copy and we must assume all pixels dirty. - */ -static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf, - size_t count, loff_t *ppos) -{ - ssize_t result; - struct dlfb_data *dlfb = info->par; - u32 offset = (u32) *ppos; - - result = fb_sys_write(info, buf, count, ppos); - - if (result > 0) { - int start = max((int)(offset / info->fix.line_length), 0); - int lines = min((u32)((result / info->fix.line_length) + 1), - (u32)info->var.yres); - - dlfb_handle_damage(dlfb, 0, start, info->var.xres, - lines); - } - - return result; -} - -/* hardware has native COPY command (see libdlo), but not worth it for fbcon */ -static void dlfb_ops_copyarea(struct fb_info *info, - const struct fb_copyarea *area) -{ - - struct dlfb_data *dlfb = info->par; - - sys_copyarea(info, area); - - dlfb_offload_damage(dlfb, area->dx, area->dy, - area->width, area->height); -} - -static void dlfb_ops_imageblit(struct fb_info *info, - const struct fb_image *image) -{ - struct dlfb_data *dlfb = info->par; - - sys_imageblit(info, image); - - dlfb_offload_damage(dlfb, image->dx, image->dy, - image->width, image->height); -} - -static void dlfb_ops_fillrect(struct fb_info *info, - const struct fb_fillrect *rect) -{ - struct dlfb_data *dlfb = info->par; - - sys_fillrect(info, rect); - - dlfb_offload_damage(dlfb, rect->dx, rect->dy, rect->width, - rect->height); -} - /* * NOTE: fb_defio.c is holding info->fbdefio.mutex * Touching ANY framebuffer memory that triggers a page fault @@ -1186,14 +1124,31 @@ static int dlfb_ops_blank(int blank_mode, struct fb_info *info) return 0; } +static void dlfb_ops_damage_range(struct fb_info *info, off_t off, size_t len) +{ + struct dlfb_data *dlfb = info->par; + int start = max((int)(off / info->fix.line_length), 0); + int lines = min((u32)((len / info->fix.line_length) + 1), (u32)info->var.yres); + + dlfb_handle_damage(dlfb, 0, start, info->var.xres, lines); +} + +static void dlfb_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height) +{ + struct dlfb_data *dlfb = info->par; + + dlfb_offload_damage(dlfb, x, y, width, height); +} + +FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(dlfb_ops, + dlfb_ops_damage_range, + dlfb_ops_damage_area) + static const struct fb_ops dlfb_ops = { .owner = THIS_MODULE, - .fb_read = fb_sys_read, - .fb_write = dlfb_ops_write, + __FB_DEFAULT_DEFERRED_OPS_RDWR(dlfb_ops), .fb_setcolreg = dlfb_ops_setcolreg, - .fb_fillrect = dlfb_ops_fillrect, - .fb_copyarea = dlfb_ops_copyarea, - .fb_imageblit = dlfb_ops_imageblit, + __FB_DEFAULT_DEFERRED_OPS_DRAW(dlfb_ops), .fb_mmap = dlfb_ops_mmap, .fb_ioctl = dlfb_ops_ioctl, .fb_open = dlfb_ops_open, From patchwork Mon Aug 28 13:14:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367968 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACCFEC83F24 for ; Mon, 28 Aug 2023 13:22:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231601AbjH1NWG (ORCPT ); Mon, 28 Aug 2023 09:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbjH1NVm (ORCPT ); Mon, 28 Aug 2023 09:21:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33CBD130; Mon, 28 Aug 2023 06:21:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C42601FD69; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NML8iokhOzgcRUuPruaBldkgErx0VDUQPo56b5aaTOQ=; b=kwuJ2Oe4vJFUSEopXOctZfhG5lFgxIJv3guXKfU9q+3aBJbYw1bTpWHwMt1T2TQPQsqCX4 mEpvdyIHuEE0JbIKc+8OmI5qFEqq7s3Mb/N4CuUWvGMEBZmitc8wWpnQOjAvuLPPssR0sB 7tjrcQPZfN+wdpDjKRIdLts8Fhgzzh0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228895; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NML8iokhOzgcRUuPruaBldkgErx0VDUQPo56b5aaTOQ=; b=7agvQZb3zEebD56+O+FjRInFJ/aN/5SlHCxXknurvmqDBNgafHfl7aoSqutH5Emq1EVKcS gp3M/YTEhDQCkuBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8F95F13A11; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uB4WIl+f7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:35 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 3/8] fbdev: Add Kconfig macro FB_IOMEM_HELPERS_DEFERRED Date: Mon, 28 Aug 2023 15:14:19 +0200 Message-ID: <20230828132131.29295-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The new Kconfig macro FB_IOMEM_HELPERS_DEFERRED selects fbdev's helpers for device I/O memory and deferred I/O. Drivers should use it if they perform damage updates on device I/O memory. Signed-off-by: Thomas Zimmermann Acked-by: Javier Martinez Canillas --- drivers/video/fbdev/core/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/fbdev/core/Kconfig b/drivers/video/fbdev/core/Kconfig index baf7e852c75b..e80d6429f76a 100644 --- a/drivers/video/fbdev/core/Kconfig +++ b/drivers/video/fbdev/core/Kconfig @@ -151,6 +151,12 @@ config FB_IOMEM_HELPERS select FB_CFB_FILLRECT select FB_CFB_IMAGEBLIT +config FB_IOMEM_HELPERS_DEFERRED + bool + depends on FB_CORE + select FB_DEFERRED_IO + select FB_IOMEM_HELPERS + config FB_SYSMEM_HELPERS bool depends on FB_CORE From patchwork Mon Aug 28 13:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367966 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E91EBC83F1C for ; Mon, 28 Aug 2023 13:22:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231559AbjH1NWE (ORCPT ); Mon, 28 Aug 2023 09:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231652AbjH1NVl (ORCPT ); Mon, 28 Aug 2023 09:21:41 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62236126; Mon, 28 Aug 2023 06:21:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1CF611FD6A; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=np2n/3f7wv/S/kDMs5Rr9B6sjnw66d5OMm93AjkRpsU=; b=QTVm6bOR3zmH+CIzbHsZ6TD4HZJv9H1pvQNI3uu5Azh9W7cFKXR8V7ttRK5YIPYwk4R17h 8oL3RkBAlZt5Vwv8hQaXQsP8+1LFyCU8foIDzkvYxxcom7O5hvft6BeWGq6COER8t/TJ8/ HK4aNy59hCXaWBCnqN6ikoCLy8DPNqo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=np2n/3f7wv/S/kDMs5Rr9B6sjnw66d5OMm93AjkRpsU=; b=oruP81rNuoPU/F8cTR/cz+qD79elKgaUAaF+BY+nIMhTDgxnF2ERlZjC8W6iCkAwLp9qAZ 65P1RRo+4yPipcCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CA19E13A1C; Mon, 28 Aug 2023 13:21:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YPtpMF+f7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:35 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui Subject: [PATCH 4/8] fbdev/hyperv_fb: Use fb_ops helpers for deferred I/O Date: Mon, 28 Aug 2023 15:14:20 +0200 Message-ID: <20230828132131.29295-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Generate callback functions for struct fb_ops with the fbdev macro FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(). Initialize struct fb_ops to the generated functions with fbdev initializer macros. The hyperv_fb driver is incomplete in its handling of deferred I/O and damage framebuffers. Write operations do no trigger damage handling. Fixing this is beyond the scope of this patch. Signed-off-by: Thomas Zimmermann Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Wei Liu Cc: Dexuan Cui Acked-by: Javier Martinez Canillas --- drivers/video/fbdev/Kconfig | 5 +--- drivers/video/fbdev/hyperv_fb.c | 48 ++++++++++----------------------- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 79b1e4e542e7..4455bfd57f0e 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -1905,11 +1905,8 @@ config FB_BROADSHEET config FB_HYPERV tristate "Microsoft Hyper-V Synthetic Video support" depends on FB && HYPERV - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - select FB_DEFERRED_IO select DMA_CMA if HAVE_DMA_CONTIGUOUS && CMA + select FB_IOMEM_HELPERS_DEFERRED select VIDEO_NOMODESET help This framebuffer driver supports Microsoft Hyper-V Synthetic Video. diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index b9965cbdd764..2e27c6bd8044 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -848,58 +848,38 @@ static int hvfb_blank(int blank, struct fb_info *info) return 1; /* get fb_blank to set the colormap to all black */ } -static void hvfb_cfb_fillrect(struct fb_info *p, - const struct fb_fillrect *rect) +static void hvfb_ops_damage_range(struct fb_info *info, off_t off, size_t len) { - struct hvfb_par *par = p->par; - - cfb_fillrect(p, rect); - if (par->synchronous_fb) - synthvid_update(p, 0, 0, INT_MAX, INT_MAX); - else - hvfb_ondemand_refresh_throttle(par, rect->dx, rect->dy, - rect->width, rect->height); + /* TODO: implement damage handling */ } -static void hvfb_cfb_copyarea(struct fb_info *p, - const struct fb_copyarea *area) +static void hvfb_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height) { - struct hvfb_par *par = p->par; + struct hvfb_par *par = info->par; - cfb_copyarea(p, area); if (par->synchronous_fb) - synthvid_update(p, 0, 0, INT_MAX, INT_MAX); + synthvid_update(info, 0, 0, INT_MAX, INT_MAX); else - hvfb_ondemand_refresh_throttle(par, area->dx, area->dy, - area->width, area->height); + hvfb_ondemand_refresh_throttle(par, x, y, width, height); } -static void hvfb_cfb_imageblit(struct fb_info *p, - const struct fb_image *image) -{ - struct hvfb_par *par = p->par; - - cfb_imageblit(p, image); - if (par->synchronous_fb) - synthvid_update(p, 0, 0, INT_MAX, INT_MAX); - else - hvfb_ondemand_refresh_throttle(par, image->dx, image->dy, - image->width, image->height); -} +/* + * TODO: GEN1 codepaths allocate from system or DMA-able memory. Fix the + * driver to use the _SYSMEM_ or _DMAMEM_ helpers in these cases. + */ +FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(hvfb_ops, + hvfb_ops_damage_range, + hvfb_ops_damage_area) static const struct fb_ops hvfb_ops = { .owner = THIS_MODULE, + FB_DEFAULT_DEFERRED_OPS(hvfb_ops), .fb_check_var = hvfb_check_var, .fb_set_par = hvfb_set_par, .fb_setcolreg = hvfb_setcolreg, - .fb_fillrect = hvfb_cfb_fillrect, - .fb_copyarea = hvfb_cfb_copyarea, - .fb_imageblit = hvfb_cfb_imageblit, .fb_blank = hvfb_blank, - .fb_mmap = fb_deferred_io_mmap, }; - /* Get options from kernel paramenter "video=" */ static void hvfb_get_option(struct fb_info *info) { From patchwork Mon Aug 28 13:14:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367967 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27288C83F1D for ; Mon, 28 Aug 2023 13:22:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbjH1NWG (ORCPT ); Mon, 28 Aug 2023 09:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbjH1NVm (ORCPT ); Mon, 28 Aug 2023 09:21:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B707D136; Mon, 28 Aug 2023 06:21:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6667B1FD6D; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N7Lw+QhQ4Al8+1I8ENOsw8wL0K5X8107kywRgj14vEI=; b=OTgIpYJ4OV6W1joLQhKuxJmBgxSv98ly1fK/pGxhNJpoLd2XHu2VsPfpnxVfU70NmZ41v/ Wks20C/wJ9uwjBakWfuM/8/eGD7FEju5FXzw1odNPHLwWvmx6aLxKdmNwmziVvrkVMkiLV EWgWhkbPbTzjt5pYLVnZfbsJf3ukkAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N7Lw+QhQ4Al8+1I8ENOsw8wL0K5X8107kywRgj14vEI=; b=bxRXfEO1QsEEQHqAfr5ySvBc4rP+ed04NLhtZUXYn3fGVSbvgvn3WUVurKR4RIuKWm//IO cdwNDKwl0/ppbADA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2076413A11; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EBkCB2Cf7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:36 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann , Jiri Kosina , Benjamin Tissoires Subject: [PATCH 5/8] hid: Remove trailing whitespace Date: Mon, 28 Aug 2023 15:14:21 +0200 Message-ID: <20230828132131.29295-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Fix coding style in Kconfig. No functional changes. Signed-off-by: Thomas Zimmermann Cc: Jiri Kosina Cc: Benjamin Tissoires Acked-by: Javier Martinez Canillas --- drivers/hid/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index e11c1c803676..b50054a41c10 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -1037,7 +1037,7 @@ config HID_SONY * Guitar Hero PS3 and PC guitar dongles config SONY_FF - bool "Sony PS2/3/4 accessories force feedback support" + bool "Sony PS2/3/4 accessories force feedback support" depends on HID_SONY select INPUT_FF_MEMLESS help From patchwork Mon Aug 28 13:14:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367969 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F753C83F23 for ; Mon, 28 Aug 2023 13:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbjH1NWI (ORCPT ); Mon, 28 Aug 2023 09:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbjH1NVm (ORCPT ); Mon, 28 Aug 2023 09:21:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3705013E; Mon, 28 Aug 2023 06:21:38 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C0EEF1FD6E; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ldw1MdaRpEpS7svygzNDrqBtCJfAtQHJJvySgzI7rd0=; b=bcNT1BK9I1tD98v3xdWzr0bMmjekx6ajdgM5vXUCRtjaKZztqQ7k1nK70+SpIt+MLG65IK HYwm56YO7FlLJn9NZyZXvk5Eu5buoljh51svd5F/sV9X55WLC9M5DokQhaRMGojzLKL39G G/uY2g0gnB0ZoJsbLcOOE/f8i5hhBH8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ldw1MdaRpEpS7svygzNDrqBtCJfAtQHJJvySgzI7rd0=; b=GbOqHAoa1Omaq6Uq6ROcQ8XZwpHs3Pr4RkEfZQ9zoUWDXiqMCHwOAK1exQoNUuzU066jK6 MD68OPa6h1u3enDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6B05213A1C; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gDQ8GWCf7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:36 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann , Jiri Kosina , Benjamin Tissoires , =?utf-8?q?Bruno_Pr?= =?utf-8?q?=C3=A9mont?= Subject: [PATCH 6/8] hid/picolcd: Use fb_ops helpers for deferred I/O Date: Mon, 28 Aug 2023 15:14:22 +0200 Message-ID: <20230828132131.29295-7-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Generate callback functions for struct fb_ops with the fbdev macro FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to the generated functions with an fbdev initializer macro. Signed-off-by: Thomas Zimmermann Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: "Bruno Prémont" Acked-by: Javier Martinez Canillas --- drivers/hid/Kconfig | 6 +-- drivers/hid/hid-picolcd_fb.c | 73 ++++++++++-------------------------- 2 files changed, 20 insertions(+), 59 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index b50054a41c10..dbf632bb7e26 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -871,11 +871,7 @@ config HID_PICOLCD_FB default !EXPERT depends on HID_PICOLCD depends on HID_PICOLCD=FB || FB=y - select FB_DEFERRED_IO - select FB_SYS_FILLRECT - select FB_SYS_COPYAREA - select FB_SYS_IMAGEBLIT - select FB_SYS_FOPS + select FB_SYSMEM_HELPERS_DEFERRED help Provide access to PicoLCD's 256x64 monochrome display via a framebuffer device. diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c index d726aaafb146..a4dccdcda26f 100644 --- a/drivers/hid/hid-picolcd_fb.c +++ b/drivers/hid/hid-picolcd_fb.c @@ -283,54 +283,6 @@ static void picolcd_fb_update(struct fb_info *info) mutex_unlock(&info->lock); } -/* Stub to call the system default and update the image on the picoLCD */ -static void picolcd_fb_fillrect(struct fb_info *info, - const struct fb_fillrect *rect) -{ - if (!info->par) - return; - sys_fillrect(info, rect); - - schedule_delayed_work(&info->deferred_work, 0); -} - -/* Stub to call the system default and update the image on the picoLCD */ -static void picolcd_fb_copyarea(struct fb_info *info, - const struct fb_copyarea *area) -{ - if (!info->par) - return; - sys_copyarea(info, area); - - schedule_delayed_work(&info->deferred_work, 0); -} - -/* Stub to call the system default and update the image on the picoLCD */ -static void picolcd_fb_imageblit(struct fb_info *info, const struct fb_image *image) -{ - if (!info->par) - return; - sys_imageblit(info, image); - - schedule_delayed_work(&info->deferred_work, 0); -} - -/* - * this is the slow path from userspace. they can seek and write to - * the fb. it's inefficient to do anything less than a full screen draw - */ -static ssize_t picolcd_fb_write(struct fb_info *info, const char __user *buf, - size_t count, loff_t *ppos) -{ - ssize_t ret; - if (!info->par) - return -ENODEV; - ret = fb_sys_write(info, buf, count, ppos); - if (ret >= 0) - schedule_delayed_work(&info->deferred_work, 0); - return ret; -} - static int picolcd_fb_blank(int blank, struct fb_info *info) { /* We let fb notification do this for us via lcd/backlight device */ @@ -417,18 +369,31 @@ static int picolcd_set_par(struct fb_info *info) return 0; } +static void picolcdfb_ops_damage_range(struct fb_info *info, off_t off, size_t len) +{ + if (!info->par) + return; + schedule_delayed_work(&info->deferred_work, 0); +} + +static void picolcdfb_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height) +{ + if (!info->par) + return; + schedule_delayed_work(&info->deferred_work, 0); +} + +FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(picolcdfb_ops, + picolcdfb_ops_damage_range, + picolcdfb_ops_damage_area) + static const struct fb_ops picolcdfb_ops = { .owner = THIS_MODULE, + FB_DEFAULT_DEFERRED_OPS(picolcdfb_ops), .fb_destroy = picolcd_fb_destroy, - .fb_read = fb_sys_read, - .fb_write = picolcd_fb_write, .fb_blank = picolcd_fb_blank, - .fb_fillrect = picolcd_fb_fillrect, - .fb_copyarea = picolcd_fb_copyarea, - .fb_imageblit = picolcd_fb_imageblit, .fb_check_var = picolcd_fb_check_var, .fb_set_par = picolcd_set_par, - .fb_mmap = fb_deferred_io_mmap, }; From patchwork Mon Aug 28 13:14:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED2D4C83F29 for ; Mon, 28 Aug 2023 13:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbjH1NWL (ORCPT ); Mon, 28 Aug 2023 09:22:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbjH1NVn (ORCPT ); Mon, 28 Aug 2023 09:21:43 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 406C512F; Mon, 28 Aug 2023 06:21:38 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E9FC2219FE; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KI96naemxlxXOb2TMpUxPDXZOCd9FJdycJdBrcM4B1w=; b=ikwGbibopFdXYekQhWmJu/fSNg+HTM0euU5ABmkG4VDbU+63C9ev5kJKMjctsqSYKQeWhd yFTRsuJ3voIE2Oft6qymCO0seCDhjAH5JUq+VCWQ1oohtmgXW9XRxpr/i+mTGZ7FMMk8YT ErfLfBXdB6iRB34HBfYx6jEEDix2UPs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KI96naemxlxXOb2TMpUxPDXZOCd9FJdycJdBrcM4B1w=; b=pHuSdlTaTYkBgK4bRyXSM9DqZ6g+bFWWFc14KaIrKYUuDIfg5kyPRRSmhUHou6cku8VLVZ 97BjJcqOJZ3cNNAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B4ED513A11; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AEcBK2Cf7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:36 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 7/8] staging/fbtft: Initialize fb_op struct as static const Date: Mon, 28 Aug 2023 15:14:23 +0200 Message-ID: <20230828132131.29295-8-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Replace dynamic allocation of the fb_ops instance with static allocation. Initialize the fields at module-load time. The owner field changes to THIS_MODULE, as in all other fbdev drivers. Signed-off-by: Thomas Zimmermann Acked-by: Greg Kroah-Hartman Acked-by: Javier Martinez Canillas --- drivers/staging/fbtft/fbtft-core.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index eac1d570f437..e4a77a4e7be6 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -473,6 +473,18 @@ static int fbtft_fb_blank(int blank, struct fb_info *info) return ret; } +static const struct fb_ops fbtft_ops = { + .owner = THIS_MODULE; + .fb_read = fb_sys_read; + .fb_write = fbtft_fb_write; + .fb_fillrect = fbtft_fb_fillrect; + .fb_copyarea = fbtft_fb_copyarea; + .fb_imageblit = fbtft_fb_imageblit; + .fb_setcolreg = fbtft_fb_setcolreg; + .fb_blank = fbtft_fb_blank; + .fb_mmap = fb_deferred_io_mmap; +}; + static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src) { if (src->write) @@ -521,7 +533,6 @@ static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src) * Creates a new frame buffer info structure. * * Also creates and populates the following structures: - * info->fbops * info->fbdefio * info->pseudo_palette * par->fbtftops @@ -536,7 +547,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, { struct fb_info *info; struct fbtft_par *par; - struct fb_ops *fbops = NULL; struct fb_deferred_io *fbdefio = NULL; u8 *vmem = NULL; void *txbuf = NULL; @@ -611,10 +621,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, if (!vmem) goto alloc_fail; - fbops = devm_kzalloc(dev, sizeof(struct fb_ops), GFP_KERNEL); - if (!fbops) - goto alloc_fail; - fbdefio = devm_kzalloc(dev, sizeof(struct fb_deferred_io), GFP_KERNEL); if (!fbdefio) goto alloc_fail; @@ -638,19 +644,9 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, goto alloc_fail; info->screen_buffer = vmem; - info->fbops = fbops; + info->fbops = &fbtft_ops; info->fbdefio = fbdefio; - fbops->owner = dev->driver->owner; - fbops->fb_read = fb_sys_read; - fbops->fb_write = fbtft_fb_write; - fbops->fb_fillrect = fbtft_fb_fillrect; - fbops->fb_copyarea = fbtft_fb_copyarea; - fbops->fb_imageblit = fbtft_fb_imageblit; - fbops->fb_setcolreg = fbtft_fb_setcolreg; - fbops->fb_blank = fbtft_fb_blank; - fbops->fb_mmap = fb_deferred_io_mmap; - fbdefio->delay = HZ / fps; fbdefio->sort_pagereflist = true; fbdefio->deferred_io = fbtft_deferred_io; From patchwork Mon Aug 28 13:14:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13367971 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33CF6C83F27 for ; Mon, 28 Aug 2023 13:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231635AbjH1NWJ (ORCPT ); Mon, 28 Aug 2023 09:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbjH1NVn (ORCPT ); Mon, 28 Aug 2023 09:21:43 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B66127; Mon, 28 Aug 2023 06:21:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2FD1E1FD70; Mon, 28 Aug 2023 13:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693228897; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sgOkmwaDCdX79FmTrsLWYaG//CQZqP82TAKVwlCr3kE=; b=yJIeQCFZ5kxm42rvYFBC2mg/Agu2SjPDBWMbH0l+pt46A9w1JxMIjPqRIwRnm9GKjKl7Ri 5rRDptoQdRHk8aWVia5LWVCZWq2alkQ10cD4YurQoJsIe/cutOpGN7YYJvaufHd1HWpjEw Zj0tUAy8aonb3ZsAmPzFj0ME1ih+noE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693228897; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sgOkmwaDCdX79FmTrsLWYaG//CQZqP82TAKVwlCr3kE=; b=xMEU56P0grfJ7Jfc/22p7IuYcN+j9uk08jxvGCNY90JIoMIR7PcXh6pGJGTfbLp8Eziya8 pa2Z/xXPO21yrKDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EF36F13A1C; Mon, 28 Aug 2023 13:21:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iN98OWCf7GTyOAAAMHmgww (envelope-from ); Mon, 28 Aug 2023 13:21:36 +0000 From: Thomas Zimmermann To: deller@gmx.de, daniel@ffwll.ch, sam@ravnborg.org, javierm@redhat.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 8/8] staging/fbtft: Use fb_ops helpers for deferred I/O Date: Mon, 28 Aug 2023 15:14:24 +0200 Message-ID: <20230828132131.29295-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230828132131.29295-1-tzimmermann@suse.de> References: <20230828132131.29295-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Generate callback functions for struct fb_ops with the fbdev macro FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(). Initialize struct fb_ops to the generated functions with an fbdev initializer macro. Signed-off-by: Thomas Zimmermann Acked-by: Greg Kroah-Hartman Acked-by: Javier Martinez Canillas --- drivers/staging/fbtft/Kconfig | 6 +-- drivers/staging/fbtft/fbtft-core.c | 87 ++++++++---------------------- 2 files changed, 24 insertions(+), 69 deletions(-) diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index 5dda3c65a38e..77ab44362f16 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -4,12 +4,8 @@ menuconfig FB_TFT depends on FB && SPI depends on FB_DEVICE depends on GPIOLIB || COMPILE_TEST - select FB_SYS_FILLRECT - select FB_SYS_COPYAREA - select FB_SYS_IMAGEBLIT - select FB_SYS_FOPS - select FB_DEFERRED_IO select FB_BACKLIGHT + select FB_SYSMEM_HELPERS_DEFERRED config FB_TFT_AGM1264K_FL tristate "FB driver for the AGM1264K-FL LCD display" diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index e4a77a4e7be6..3626f429b002 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -357,61 +357,6 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflis dirty_lines_start, dirty_lines_end); } -static void fbtft_fb_fillrect(struct fb_info *info, - const struct fb_fillrect *rect) -{ - struct fbtft_par *par = info->par; - - dev_dbg(info->dev, - "%s: dx=%d, dy=%d, width=%d, height=%d\n", - __func__, rect->dx, rect->dy, rect->width, rect->height); - sys_fillrect(info, rect); - - par->fbtftops.mkdirty(info, rect->dy, rect->height); -} - -static void fbtft_fb_copyarea(struct fb_info *info, - const struct fb_copyarea *area) -{ - struct fbtft_par *par = info->par; - - dev_dbg(info->dev, - "%s: dx=%d, dy=%d, width=%d, height=%d\n", - __func__, area->dx, area->dy, area->width, area->height); - sys_copyarea(info, area); - - par->fbtftops.mkdirty(info, area->dy, area->height); -} - -static void fbtft_fb_imageblit(struct fb_info *info, - const struct fb_image *image) -{ - struct fbtft_par *par = info->par; - - dev_dbg(info->dev, - "%s: dx=%d, dy=%d, width=%d, height=%d\n", - __func__, image->dx, image->dy, image->width, image->height); - sys_imageblit(info, image); - - par->fbtftops.mkdirty(info, image->dy, image->height); -} - -static ssize_t fbtft_fb_write(struct fb_info *info, const char __user *buf, - size_t count, loff_t *ppos) -{ - struct fbtft_par *par = info->par; - ssize_t res; - - dev_dbg(info->dev, - "%s: count=%zd, ppos=%llu\n", __func__, count, *ppos); - res = fb_sys_write(info, buf, count, ppos); - - /* TODO: only mark changed area update all for now */ - par->fbtftops.mkdirty(info, -1, 0); - - return res; -} - /* from pxafb.c */ static unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf) { @@ -473,16 +418,30 @@ static int fbtft_fb_blank(int blank, struct fb_info *info) return ret; } +static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len) +{ + struct fbtft_par *par = info->par; + + /* TODO: only mark changed area update all for now */ + par->fbtftops.mkdirty(info, -1, 0); +} + +static void fbtft_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height) +{ + struct fbtft_par *par = info->par; + + par->fbtftops.mkdirty(info, y, height); +} + +FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(fbtft_ops, + fbtft_ops_damage_range, + fbtft_ops_damage_area) + static const struct fb_ops fbtft_ops = { - .owner = THIS_MODULE; - .fb_read = fb_sys_read; - .fb_write = fbtft_fb_write; - .fb_fillrect = fbtft_fb_fillrect; - .fb_copyarea = fbtft_fb_copyarea; - .fb_imageblit = fbtft_fb_imageblit; - .fb_setcolreg = fbtft_fb_setcolreg; - .fb_blank = fbtft_fb_blank; - .fb_mmap = fb_deferred_io_mmap; + .owner = THIS_MODULE, + FB_DEFAULT_DEFERRED_OPS(fbtft_ops), + .fb_setcolreg = fbtft_fb_setcolreg, + .fb_blank = fbtft_fb_blank, }; static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)