Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp419417rwl; Wed, 29 Mar 2023 03:59:28 -0700 (PDT) X-Google-Smtp-Source: AKy350aEKvCRDdl9Q+rkEAYrGWFVBCKiTWe226z0Z701Fspp8+3wJxqxmQZWJ8fr6JF/1czKqJbA X-Received: by 2002:a17:90b:4a0b:b0:23b:4439:4179 with SMTP id kk11-20020a17090b4a0b00b0023b44394179mr20423872pjb.28.1680087567827; Wed, 29 Mar 2023 03:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680087567; cv=none; d=google.com; s=arc-20160816; b=VzDrWM09IA63KoQ1jEWtJnE5JP43Z+PTf0gZ2Oxedxm+7pxGnxKde/GLRleZsQTWxN PjjA8UDaG+WmZ8SuT3ptRhYHMLe/+RyjPt/EOG2CWI09jT2QSIoliInhitTXpLaVuqsF 07Cd+N47cySOmx/yhU91D8E7vRIcQeLiaIspu4+Mf15G7F6TS6XOKaDqtUfAGKA2B4VG jQkbZgDE9zFSipeQcnXn0qMaJ6uChVniwAlYNCy0L1LMRHeCgbumup1sbiL6pLxCrrba a20sJ9vhvnPRcS/P4uC9jTiFfFMh72O7MmMFn3MldazX7+TN02yM+mIVr96/at/g23Lg rlfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:hmm_source_type:hmm_attache_num :hmm_source_ip; bh=PPwd/M3eswLtTioUrcRQ35FlrLpaFE6L21rZq3tkOac=; b=R7MdQdqltLAvBzTRcAPmei0x4KLZhpGSzTlfbFTpB7GAD0VWWijdCxbN5xu/xY08BZ YMn7WbxCAHJTrSQBnWz8RIf1qRcTjjwwFu0Ea6elRPLHcmQRydIr5N9VDmqIfWw5ysTe DS8M5yH3E9J9Zz6HifcjaQwzfkMZwjGaPMjVZ0wpnu3hFHYFuIMmViqUgxyfIasA+qZL wjQFzTDI0KuoLnRBlz8dBLig8ED0HoEWih2nG7vEKnIcNJrl6vxqkVOBNopZrEXKhigk 6HKVjUSw7IyFiys6B+s8IdRUnuIHagjk/WIHF6mGYbLkxxTEF/Uh4trHImr9UXGyZl23 19Sg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a17090a64ce00b0023409b3983fsi1270495pjm.99.2023.03.29.03.59.16; Wed, 29 Mar 2023 03:59:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbjC2Ksf (ORCPT + 99 others); Wed, 29 Mar 2023 06:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbjC2Ksd (ORCPT ); Wed, 29 Mar 2023 06:48:33 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F3C731BF0 for ; Wed, 29 Mar 2023 03:48:30 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.41:48250.1027552899 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id DF30A10029C; Wed, 29 Mar 2023 18:48:28 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-7b48884fd-ljp89 with ESMTP id 29ed5fd3609e43b184df0070a4571f07 for tzimmermann@suse.de; Wed, 29 Mar 2023 18:48:29 CST X-Transaction-ID: 29ed5fd3609e43b184df0070a4571f07 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn Message-ID: Date: Wed, 29 Mar 2023 18:48:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] drm/fbdev-generic: optimize out a redundant assignment clause To: Thomas Zimmermann , Sui Jingfeng <15330273260@189.cn>, Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , liyi , Lucas De Marchi Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20230325074636.136833-1-15330273260@189.cn> Content-Language: en-US From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FROM_LOCAL_DIGITS,FROM_LOCAL_HEX,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS autolearn=no 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 2023/3/29 17:04, Thomas Zimmermann wrote: > (cc'ing Lucas) > > Hi > > Am 25.03.23 um 08:46 schrieb Sui Jingfeng: >>   The assignment already done in drm_client_buffer_vmap(), >>   just trival clean, no functional change. >> >> Signed-off-by: Sui Jingfeng <15330273260@189.cn> >> --- >>   drivers/gpu/drm/drm_fbdev_generic.c | 5 ++--- >>   1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c >> b/drivers/gpu/drm/drm_fbdev_generic.c >> index 4d6325e91565..1da48e71c7f1 100644 >> --- a/drivers/gpu/drm/drm_fbdev_generic.c >> +++ b/drivers/gpu/drm/drm_fbdev_generic.c >> @@ -282,7 +282,7 @@ static int drm_fbdev_damage_blit(struct >> drm_fb_helper *fb_helper, >>                    struct drm_clip_rect *clip) >>   { >>       struct drm_client_buffer *buffer = fb_helper->buffer; >> -    struct iosys_map map, dst; >> +    struct iosys_map map; >>       int ret; >>         /* >> @@ -302,8 +302,7 @@ static int drm_fbdev_damage_blit(struct >> drm_fb_helper *fb_helper, >>       if (ret) >>           goto out; >>   -    dst = map; >> -    drm_fbdev_damage_blit_real(fb_helper, clip, &dst); >> +    drm_fbdev_damage_blit_real(fb_helper, clip, &map); > > I see what you're doing and it's probably correct in this case. > > But there's a larger issue with this iosys interfaces. Sometimes the > address has to be modified (see calls of iosys_map_incr()). That can > prevent incorrect uses of the mapping in other places, especially in > unmap code. > > I think it would make sense to consider a separate structure for the > I/O location. The buffer as a whole would still be represented by > struct iosys_map.  And that new structure, let's call it struct > iosys_ptr, would point to an actual location within the buffer's > memory range. A few locations and helpers would need changes, but > there are not so many callers that it's an issue.  This would also > allow for a few debugging tests that ensure that iosys_ptr always > operates within the bounds of an iosys_map. > > I've long considered this idea, but there was no pressure to work on > it. Maybe now. > Ok. that's fine then. > Best regards > Thomas > >>         drm_client_buffer_vunmap(buffer); >