Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp390156rwn; Thu, 8 Sep 2022 03:17:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR73VZEf7kQd7yvvdrVoeUz30hhd5CERBEjiOW8hk1bjutMLqGkKui7M3xLYm/VSLmYJ4fcq X-Received: by 2002:a05:6a00:1390:b0:540:b6b6:e978 with SMTP id t16-20020a056a00139000b00540b6b6e978mr710938pfg.8.1662632232573; Thu, 08 Sep 2022 03:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662632232; cv=none; d=google.com; s=arc-20160816; b=aTFuLkSNn3Abhgy03qpYxUiPoicgIMHEBuxSlnD2REKAdRrRXgY/9nWcDLGvSZ1pnq +lv7sc3GyWdRlFiVv+OKVK/Qc3CtRW7hqdGFrCt/2jVpHbqKYccRdGKkzQPdzRRgbnsO 3LIv47S63Rk1T8w81lGNmig+i+fMVpchgtoTcCaft69DY7XD4DYKhtEQTrlUNn5t3Exg ptdJQYtrk/Q69py7xCz3GnYFVqbCsihshUyNMMiXYw+2YDSvBMYr0FBZs67wkos3mK7Q gqZljv0eBG8BXIl69bWYb4pVFEQrM+et4KVKdah0KVaOB6pOf39UYwps+Q+blCznCGZk c9VA== 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=Cx50lc81+Z2nMKWe4ODzX64f5+EKiSouaE6Ruy8+SJg=; b=ZlDjx/aCA8nc6jU5VwS1hZxb6JzErrfrxsBkalej8FK3Ft5CGf/sOpagmLNMPK+9W1 liY/y7sMibit2ITIlCyfQS9zmDScrXDB9XUfhCclCw9mLIsM+5oMYBZ/N+CP1QCQKY6z g960YEGoDkxrUqnk2kNfUNobCUTIUHdyIxxsRKpd1cchHQV/WVo6R4JdlBWz3oBKBfPA e80GqKDvVuo8BYBZiD2+FjWjohsz8n9UsHJLvpK+MhGPgr8Dm0giqG48KVycQGWUQYuc jutOPN+GedhU6C8imPAwqvPxy+NWzwec9HK3FjFKTwDdppUPU/FTgbZ6pC82K9fVxtVe caYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=dT3Zmgc2; 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 j6-20020a170902758600b0016ed87fd1efsi14511740pll.467.2022.09.08.03.17.00; Thu, 08 Sep 2022 03:17:12 -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=dT3Zmgc2; 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 S231492AbiIHJvz (ORCPT + 99 others); Thu, 8 Sep 2022 05:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbiIHJvZ (ORCPT ); Thu, 8 Sep 2022 05:51:25 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0466112E71 for ; Thu, 8 Sep 2022 02:51:21 -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 0F10F1F941; Thu, 8 Sep 2022 09:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662630680; 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=Cx50lc81+Z2nMKWe4ODzX64f5+EKiSouaE6Ruy8+SJg=; b=dT3Zmgc2wZvFrSnbSc2Q5x2yvVKxljiNiuyAig2IGCvfsvrZmHKjaC6Q+nUxgkaly33oVz exkMYYjzdY//m5GN80DwKG+jPKBj/QwSd+kOqovV0qkHr0jQwFNH1XFXSStxyMVRLq2AIf CSbT3d+koQG1nK6672lpR2Qeewh3tms= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662630680; 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=Cx50lc81+Z2nMKWe4ODzX64f5+EKiSouaE6Ruy8+SJg=; b=WUONBtN52/2H5YCZYKTVoAlXcFooWYXYcIrrzejuIh1kPVpm0lb6mA6buh0DsI3j7rSabF mjo9w44W0ouO2/CQ== 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 DB77B13A6D; Thu, 8 Sep 2022 09:51:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MOXTNBe7GWNrUgAAMHmgww (envelope-from ); Thu, 08 Sep 2022 09:51:19 +0000 From: Takashi Iwai To: Thomas Zimmermann Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/12] drm/udl: Drop unneeded alignment Date: Thu, 8 Sep 2022 11:51:10 +0200 Message-Id: <20220908095115.23396-8-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220908095115.23396-1-tiwai@suse.de> References: <20220908095115.23396-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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. Acked-by: Thomas Zimmermann Signed-off-by: Takashi Iwai --- drivers/gpu/drm/udl/udl_modeset.c | 28 +-------------------- drivers/gpu/drm/udl/udl_transfer.c | 40 ------------------------------ 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c index cbdda2d8b882..c9b837ac26a7 100644 --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -242,28 +242,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) @@ -281,11 +259,7 @@ static int udl_handle_damage(struct drm_framebuffer *fb, 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)) - return -EINVAL; + drm_rect_init(&clip, x, y, width, height); ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); if (ret) 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