From patchwork Mon Mar 10 06:57:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zsolt Kajtar X-Patchwork-Id: 14009320 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 2F9F3C282DE for ; Mon, 10 Mar 2025 07:03:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A38A610E179; Mon, 10 Mar 2025 07:03:58 +0000 (UTC) Received: from c64.rulez.org (c64.rulez.org [79.139.58.36]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB82A10E179 for ; Mon, 10 Mar 2025 07:03:55 +0000 (UTC) Received: by c64.rulez.org (Postfix, from userid 1000) id 242EC100CF; Mon, 10 Mar 2025 08:03:51 +0100 (CET) From: Zsolt Kajtar To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: deller@gmx.de, Zsolt Kajtar Subject: [PATCH] Remove fb_draw.h includes Date: Mon, 10 Mar 2025 07:57:45 +0100 Message-Id: <20250310065745.17623-1-soci@c64.rulez.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This is related to the fbcon packed pixel drawing refactoring. There I missed that fb_draw.h was included from two unexpected places. That shouldn't be like that. This patch removes the dependency. Signed-off-by: Zsolt Kajtar --- drivers/video/fbdev/aty/mach64_cursor.c | 7 +++++- drivers/video/fbdev/wmt_ge_rops.c | 30 +++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/aty/mach64_cursor.c b/drivers/video/fbdev/aty/mach64_cursor.c index 971355c2c..e826cb7dd 100644 --- a/drivers/video/fbdev/aty/mach64_cursor.c +++ b/drivers/video/fbdev/aty/mach64_cursor.c @@ -6,7 +6,6 @@ #include #include #include -#include "../core/fb_draw.h" #include @@ -57,6 +56,12 @@ * definitation and CUR_VERT_POSN must be saturated to zero. */ +/* compose pixels based on mask */ +static inline unsigned long comp(unsigned long set, unsigned long unset, unsigned long mask) +{ + return ((set ^ unset) & mask) ^ unset; +} + /* * Hardware Cursor support. */ diff --git a/drivers/video/fbdev/wmt_ge_rops.c b/drivers/video/fbdev/wmt_ge_rops.c index 69106299a..92fbb3f3a 100644 --- a/drivers/video/fbdev/wmt_ge_rops.c +++ b/drivers/video/fbdev/wmt_ge_rops.c @@ -12,7 +12,6 @@ #include #include -#include "core/fb_draw.h" #include "wmt_ge_rops.h" #define GE_COMMAND_OFF 0x00 @@ -41,6 +40,33 @@ static void __iomem *regbase; +/* from the spec it seems more like depth than bits per pixel */ +static inline unsigned long pixel_to_pat(u32 depth, u32 pixel, struct fb_info *p) +{ + switch (depth) { + case 1: + return ~0ul*pixel; + case 2: + return ~0ul/3*pixel; + case 4: + return ~0ul/15*pixel; + case 8: + return ~0ul/255*pixel; + case 12: + case 15: + case 16: + return ~0ul/0xffff*pixel; + case 18: + case 24: + return 0x1000001ul*pixel; + case 32: + return pixel; + default: + fb_warn_once(p, "%s: unsupported pixelformat %d\n", __func__, depth); + return 0; + } +} + void wmt_ge_fillrect(struct fb_info *p, const struct fb_fillrect *rect) { unsigned long fg, pat; @@ -54,7 +80,7 @@ void wmt_ge_fillrect(struct fb_info *p, const struct fb_fillrect *rect) else fg = rect->color; - pat = pixel_to_pat(p->var.bits_per_pixel, fg); + pat = pixel_to_pat(p->var.bits_per_pixel, fg, p); if (p->fbops->fb_sync) p->fbops->fb_sync(p);