Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3791883rwb; Tue, 16 Aug 2022 08:50:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5UQ8bNO5zWf18vKEE1gIQ8PsJ0RkA+3IBrTvvwCRGjjh0KlwrcPOHAWSIvqeJOIn0c8HTk X-Received: by 2002:a17:907:a056:b0:730:ce15:842d with SMTP id gz22-20020a170907a05600b00730ce15842dmr13935443ejc.275.1660665035036; Tue, 16 Aug 2022 08:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660665035; cv=none; d=google.com; s=arc-20160816; b=Cn9IHx0ENt7ZfUm1V7hqxJTGsqXDnjPJht0HeXddMppBsFc0gdPKCjSZebsC2pz74E bNPJP2OaA7HszviL0pSc3HXFUoLHDN/xVqO3f2u34XfU6U78tV1mcbIYQw2qF80cv7m/ 0CiBRQGT6XQF5IT0VRAxK5JXQ/C8wJ5cuxSGZFELpE14UWcOX+j9pYbEIak699enWQRp 4fX6cysStAQT8IGM/Fi8Vw9LKUpihzvX1oW2uWcbbwILOhnjHXbsJ2d2zSxgvNWdU4fN oqp9Lbrxu2DCu3ERwNa2Hr+/TSgFlhvtKHlezmeezzfBwhZ9HB/QbwgBwwoW+SW2+Z2F z0lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=rYLO+2ovCBU6LBaOJYk4335PMzQB/KhrFHjCLJrSpSY=; b=tH1C2bFr8AE36FeMy1y1/353bPz9znoVeQEMydMTh3yiSrH1lk8LjSj6Dy4kug+s3X 2ch34teMKbIkbhC4t+jl6pcdmVB0c824i2naE5+8c/Ze7YX7S95TLtLkskCqRGJZr54Z 9QbUHhoBw1n21jcteLgVoygE7IVTqj2ht1ftB/O+wVHXqpdvwHNQGiDXGpWSSRe09Evw UXWKlFQTg+yQwQvidY5647krumIeS7sR6Y3E9YNGuM9yGwvxTkzbpAXWkUN8zAPHOPmO mJkPk2M6Ts6CjmX3strtfWLIoDXfaD3Fy0VTEktvfF0kvtcQcQ7QMLgXaLqfOJJ7ALg7 UI+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lsIC8+Kk; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz11-20020a1709077d8b00b00730a65e581asi10341456ejc.750.2022.08.16.08.50.08; Tue, 16 Aug 2022 08:50:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lsIC8+Kk; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236152AbiHPPiw (ORCPT + 99 others); Tue, 16 Aug 2022 11:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235638AbiHPPiG (ORCPT ); Tue, 16 Aug 2022 11:38:06 -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 C9FB181B06 for ; Tue, 16 Aug 2022 08:37:04 -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 6F9E81FEA0; Tue, 16 Aug 2022 15:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660664223; 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=rYLO+2ovCBU6LBaOJYk4335PMzQB/KhrFHjCLJrSpSY=; b=lsIC8+KkUuj3mADiu6sWTRLPcGAVXq8+r6jupIBkwDo2Ycob8CAX/WHOc6JurvtUe4d72e B9JwwHB+YufyaCJQHSYzvfDUUrjDpa+W8QDGoTvlhUUY8DiAG5hwOnJCsevsa7gojXHURQ 0wd7U2PnzRnJZeU/jm/P+PaHp8Xk0Hk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660664223; 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=rYLO+2ovCBU6LBaOJYk4335PMzQB/KhrFHjCLJrSpSY=; b=nML4vRv8srV2okbamDJq8C5Gh0DSQ3doSjxJfTzSrr468Prl8a4imSZEfX5i8cDyQByG2l RZt2to8T4TYvIeDg== 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 494DB13B1A; Tue, 16 Aug 2022 15:37:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CGI+EZ+5+2LKJAAAMHmgww (envelope-from ); Tue, 16 Aug 2022 15:37:03 +0000 From: Takashi Iwai To: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/12] drm/udl: Drop unneeded alignment Date: Tue, 16 Aug 2022 17:36:51 +0200 Message-Id: <20220816153655.27526-9-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220816153655.27526-1-tiwai@suse.de> References: <20220816153655.27526-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The alignment of damaged area was needed for the original udlfb driver that tried to trim the superfluous copies between front and backend buffers and handle data in long int. It's not the case for udl DRM driver, hence we can omit the whole unneeded alignment, as well as the dead code. Signed-off-by: Takashi Iwai --- drivers/gpu/drm/udl/udl_modeset.c | 34 ++++++------------------- drivers/gpu/drm/udl/udl_transfer.c | 40 ------------------------------ 2 files changed, 8 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c index c34d564773a3..bca31c890108 100644 --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -243,28 +243,6 @@ static long udl_log_cpp(unsigned int cpp) return __ffs(cpp); } -static int udl_aligned_damage_clip(struct drm_rect *clip, int x, int y, - int width, int height) -{ - int x1, x2; - - if (WARN_ON_ONCE(x < 0) || - WARN_ON_ONCE(y < 0) || - WARN_ON_ONCE(width < 0) || - WARN_ON_ONCE(height < 0)) - return -EINVAL; - - x1 = ALIGN_DOWN(x, sizeof(unsigned long)); - x2 = ALIGN(width + (x - x1), sizeof(unsigned long)) + x1; - - clip->x1 = x1; - clip->y1 = y; - clip->x2 = x2; - clip->y2 = y + height; - - return 0; -} - static int udl_handle_damage(struct drm_framebuffer *fb, const struct iosys_map *map, int x, int y, int width, int height) @@ -277,15 +255,19 @@ static int udl_handle_damage(struct drm_framebuffer *fb, struct drm_rect clip; int log_bpp; + if (width <= 0 || height <= 0) + return 0; + ret = udl_log_cpp(fb->format->cpp[0]); if (ret < 0) return ret; log_bpp = ret; - ret = udl_aligned_damage_clip(&clip, x, y, width, height); - if (ret) - return ret; - else if ((clip.x2 > fb->width) || (clip.y2 > fb->height)) + clip.x1 = x; + clip.y1 = y; + clip.x2 = x + width; + clip.y2 = y + height; + if (clip.x2 > fb->width || clip.y2 > fb->height) return -EINVAL; ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); diff --git a/drivers/gpu/drm/udl/udl_transfer.c b/drivers/gpu/drm/udl/udl_transfer.c index 176ef2a6a731..a431208dda85 100644 --- a/drivers/gpu/drm/udl/udl_transfer.c +++ b/drivers/gpu/drm/udl/udl_transfer.c @@ -25,46 +25,6 @@ #define MIN_RAW_PIX_BYTES 2 #define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES) -/* - * Trims identical data from front and back of line - * Sets new front buffer address and width - * And returns byte count of identical pixels - * Assumes CPU natural alignment (unsigned long) - * for back and front buffer ptrs and width - */ -#if 0 -static int udl_trim_hline(const u8 *bback, const u8 **bfront, int *width_bytes) -{ - int j, k; - const unsigned long *back = (const unsigned long *) bback; - const unsigned long *front = (const unsigned long *) *bfront; - const int width = *width_bytes / sizeof(unsigned long); - int identical = width; - int start = width; - int end = width; - - for (j = 0; j < width; j++) { - if (back[j] != front[j]) { - start = j; - break; - } - } - - for (k = width - 1; k > j; k--) { - if (back[k] != front[k]) { - end = k+1; - break; - } - } - - identical = start + (width - end); - *bfront = (u8 *) &front[start]; - *width_bytes = (end - start) * sizeof(unsigned long); - - return identical * sizeof(unsigned long); -} -#endif - static inline u16 pixel32_to_be16(const uint32_t pixel) { return (((pixel >> 3) & 0x001f) | -- 2.35.3