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 10584C6FD1D for ; Thu, 30 Mar 2023 08:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbjC3I31 (ORCPT ); Thu, 30 Mar 2023 04:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbjC3I3T (ORCPT ); Thu, 30 Mar 2023 04:29:19 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 27EDF1987 for ; Thu, 30 Mar 2023 01:29:17 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.43:33410.296234587 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.43]) by 189.cn (HERMES) with SMTP id 427711002EE; Thu, 30 Mar 2023 16:29:14 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-7b48884fd-tj646 with ESMTP id 2236815573ed4aa9a8a2226bd7b1ced1 for tzimmermann@suse.de; Thu, 30 Mar 2023 16:29:16 CST X-Transaction-ID: 2236815573ed4aa9a8a2226bd7b1ced1 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn Message-ID: <9f690167-cdfa-7581-9493-1a66ea42a247@189.cn> Date: Thu, 30 Mar 2023 16:29:13 +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 Content-Language: en-US To: Thomas Zimmermann , Lucas De Marchi Cc: David Airlie , liyi , linux-kernel@vger.kernel.org, Sui Jingfeng <15330273260@189.cn>, dri-devel@lists.freedesktop.org References: <20230325074636.136833-1-15330273260@189.cn> <20230330041726.w7boceq7ljymvfq2@ldmartin-desk2> From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/3/30 14:57, Thomas Zimmermann wrote: > Hi > > Am 30.03.23 um 06:17 schrieb Lucas De Marchi: >> On Wed, Mar 29, 2023 at 11:04:17AM +0200, 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. >> >> using a initializer for the cases it's needed IMO would make these kind >> of problems go away, because then the intent is explicit >> >>> >>> 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 >> >> sounds fine to me, but I'd have to take a deeper look later (or when >> someone writes the patch).  It seems we'd replicate almost the entire >> API to just accomodate the 2 structs.  And the different types will lead >> to confusion when one or the other should be used > > I think we can split the current interface onto two categories: > mapping and I/O. The former would use iosys_map and the latter would > use iosys_ptr. And we'd need a helper that turns gets a ptr for a > given map. > > If I find the tine, I'll probably type up a patch. > This sound fine and interesting. I don't have enough time to do this,  as I'm focus on developing driver for my company's hardware. But I  will keep an eye on it, see what interesting will be happen. Becuase the fbdev related code  will also be used on my company's ls7a1000 and ls7a2000 platform. It is useful and interesting,  Our device  at least  can functional as a big frame buffer and more than framebuffer. The bandwidth for VRAM write is very high(when write combine is open). at least 10+ times batter than aspeed bmc. glxgear on ls3a5000@2.5ghz+ls7a1000 can run above 1000+fps. while with the aspeed bmc it is just 100+ fps all so. > Best regards > Thomas > >> >> thanks >> Lucas De Marchi >> >>> 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. >>> >>> Best regards >>> Thomas >>> >>>>      drm_client_buffer_vunmap(buffer); >>> >>> -- >>> Thomas Zimmermann >>> Graphics Driver Developer >>> SUSE Software Solutions Germany GmbH >>> Maxfeldstr. 5, 90409 Nürnberg, Germany >>> (HRB 36809, AG Nürnberg) >>> Geschäftsführer: Ivo Totev >> >> >> >