From mboxrd@z Thu Jan 1 00:00:00 1970 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 EB781ECAAD3 for ; Mon, 5 Sep 2022 12:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229888AbiIEMvE (ORCPT ); Mon, 5 Sep 2022 08:51:04 -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 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