Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3055090rwb; Mon, 5 Sep 2022 05:57:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR77bRJHpRjc8hBxyRAKjMh4YdogoytTLWRFJ3f8Mwz42jc++2nzN7Z4sSojxiI1raapZG9A X-Received: by 2002:a17:90b:1652:b0:1fd:eca8:d2be with SMTP id il18-20020a17090b165200b001fdeca8d2bemr19600033pjb.79.1662382639175; Mon, 05 Sep 2022 05:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662382639; cv=none; d=google.com; s=arc-20160816; b=rK2Qw+3YXtb92NiwNv9wr6T3Fs/jd0dRRShoYtF8aA6uZNJdpIZD9TUTvV2x0+ku5j gJi9SppLCady1Azpw3sPJFJbu3l0dXUpy3Fq8M9faO+X1To0VqUyIE48XmtgD87+0Uml U5rGU8fy9qwtowZt409HBqBTeXRueCyU6XBWPA1L3mzO1PSv/gfmdUQgQzQAZMDtMFen FtS+osSLGKjENpEWZkg30FJX1uMSfOqbpPxj1A5feF8czKamYr+kZAmDyRUAYXUFjP+7 H7/j3lM8DeA9Rgn6wKGs7gf3Z7bLfrIwRVMAC2pGiuEl8iuJjs6uiytNmYfIX1Qnd7nG w5/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=k71P9I+tFuuKSlkWA9UOEi0aMlk2h1NjsEhUbbnSDWQ=; b=fnljl2o0Ombnxmkpi52pmixCmHLbywWMbeK6+Vfi1hVvqHuHL7sbqCdcpkn4P0SUAo dnZwIunEkzbt7C5GnUfAD1z534MR0iNA7bgKMOyDUtwdjtuW13JF8GZsW54gk86saA4B rsswXyMEOLcVKS7DIwwghHGntV/zCfL0WliRVvWwMg0xguSUQnRkM5/BGxGg3GTPlbS8 cEhNzylTcun1wWkMUqV0b8TWQQhwcnfwem8tcPyWjdYs3M7yW0LT6Ah3IpUsKzYLtkis Dk+MfRvUlbAuNZRkWTC3Q3zcJ2l4plRyG692Q77x+A5g5vw40raFWJDLVa0Q1ojXo8jB VbJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=fy4i7muY; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=H4NNiE1E; 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 67-20020a630046000000b0043410e2d9basi6490800pga.258.2022.09.05.05.57.07; Mon, 05 Sep 2022 05:57:19 -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=fy4i7muY; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=H4NNiE1E; 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 S237632AbiIEMvC (ORCPT + 99 others); Mon, 5 Sep 2022 08:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237068AbiIEMum (ORCPT ); Mon, 5 Sep 2022 08:50:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 932D026D7 for ; Mon, 5 Sep 2022 05:50:40 -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 D95BA5D021; Mon, 5 Sep 2022 12:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662382238; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k71P9I+tFuuKSlkWA9UOEi0aMlk2h1NjsEhUbbnSDWQ=; b=fy4i7muYl/orzPk2EjHQRwSP0UOcANLzwVwMS4BbSzwBwPXqgpBC3Nfinwcc6a0ZKVA0Cw 0u6n6heWMcA9XCISitZXA5ZwFhM+y1r7CNu4UN8Yvs4x5XAElRUck0X0gWsna8FpEnjfV5 YdYVjU9nRgV2f0sknZBTHIruthGtqh8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662382238; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k71P9I+tFuuKSlkWA9UOEi0aMlk2h1NjsEhUbbnSDWQ=; b=H4NNiE1EJklb5XEWK7I450nlDyO/jRl4twyhXZMxIQboc3XiIhp8mfZOmueuwYlfA1MrjF JtwtcJJV9ekevvDw== 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 B9F8013A66; Mon, 5 Sep 2022 12:50:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AGyXLJ7wFWMcDgAAMHmgww (envelope-from ); Mon, 05 Sep 2022 12:50:38 +0000 Date: Mon, 05 Sep 2022 14:50:38 +0200 Message-ID: <87leqyj881.wl-tiwai@suse.de> From: Takashi Iwai To: Thomas Zimmermann Cc: Takashi Iwai , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/12] drm/udl: Drop unneeded alignment In-Reply-To: <05f4a358-70df-18f4-1672-f02c9eebe98f@suse.de> References: <20220816153655.27526-1-tiwai@suse.de> <20220816153655.27526-9-tiwai@suse.de> <05f4a358-70df-18f4-1672-f02c9eebe98f@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII 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 On Mon, 05 Sep 2022 10:40:58 +0200, Thomas Zimmermann wrote: > > Hi > > Am 16.08.22 um 17:36 schrieb Takashi Iwai: > > 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; > > + > > That shouldn't happen. > > > 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; > > drm_rect_init() please. > > > + if (clip.x2 > fb->width || clip.y2 > fb->height) > > That's another thing that should not happen. The damage clips in the > plane state is what you what to copy. The DRM helpers ensure that > these various plane, fb and clip coordinates add up. OK, then we can drop those clip size checks completely. Will do that in v2 patch. thanks, Takashi