Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2177111rwb; Sun, 14 Aug 2022 23:37:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR76z7P/xAoYBL0a+91FKToYf/jT1BfciP7iGYabXJMsMo8xnrGpjjUBmzGX/lOof/6TMBE/ X-Received: by 2002:a17:90b:3812:b0:1f6:7f5:4c3 with SMTP id mq18-20020a17090b381200b001f607f504c3mr17211392pjb.223.1660545439422; Sun, 14 Aug 2022 23:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660545439; cv=none; d=google.com; s=arc-20160816; b=thKstCkEaYwg6utnwJ9PbPMIzYcJ/eodc7MzrPgcKBtug5j2A3Ta8q2jhHLJ97nSg+ tavGGV0ef0qCgMUshLJcacnEzMRoDXbM2QtcGOS9NNLg5DoI3Sp6Z4SwSfbTpLsq/q3T f+7GjjG+HK8xxeHdsdtSFhjytWUpD5A9dp1Bc26JUSHA8JciwJA+KFoI0pLnBbIEG7qa haEaXf4cvRRz/j4UYmTwDOvRZiueKl4Z1lYF3wTfrX1s2OK9rLpgVu6SP8cPRUu9X5Kh D+kbvwtttpJWwWOLPRDnUppzo3uwovGjEaItlmex61ibzQEiNgx6lU7iT9gobAauy8Bb l5KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=g6xD4nL/8TaKP3Oc8FoGSHeffZNL83IBED3zRKVGQAg=; b=gUoXy2URQtRKfDINJnDwwKHpLKZDy370zHV/DywKwNNP73i7X3ragnQPkg9f1V7H+t oerz7IsA/Kg0bag2D6bgAi3YQ0TzG1C1yFktInQMavfQ7iqW1FS7+TbFfV6WRXY/Tsmy vRoA5ch1w1+zR/XsUhtS+twU4ZN/o4fQeavx2m0oodM5xjh9K+Fpsg5m4+T0cRpIdHhm 16nECVk06sRl+je55g2TuJZVm20PjUCo9lfsrlMQdoohrtIDsChGtkzyeDlw6E550ReD ySmcQlcChx7PlEnthMvRXkekv4kV34xQo6Mn1Gy3x52WpziPPzBLEZFoQ83Tsrbj+TZA iG5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iQsGt7d2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a056a00244a00b0052d1a02e317si10048689pfj.129.2022.08.14.23.37.08; Sun, 14 Aug 2022 23:37: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=@gmail.com header.s=20210112 header.b=iQsGt7d2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbiHOGYE (ORCPT + 99 others); Mon, 15 Aug 2022 02:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiHOGXg (ORCPT ); Mon, 15 Aug 2022 02:23:36 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 777C0193C2; Sun, 14 Aug 2022 23:23:34 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id qn6so11925182ejc.11; Sun, 14 Aug 2022 23:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc; bh=g6xD4nL/8TaKP3Oc8FoGSHeffZNL83IBED3zRKVGQAg=; b=iQsGt7d2MVUBuZSkGPZ/w5qO2/pn1fzc4aWxHBNEIbM7xzGmz0EXG3AEcktGZxO7My mihhuQi7dotX1/Zcs3AohuIUNNB55Gw2xCu8xDkHGPPL4H+ElATE3539AyQtHG4ppO68 wbE5IELWiFYaW7EAy/+0za41PEVPTeOjuUEcX9VdEO1zsETJXH2Kd4NHuJeJx04NuMTd DlPgH0sgt/BhtXWkorwdfqCH/4YSKYCj4ED+9uFNRWbAMPL9CTJdzGWoKj3MfDNhiOAN ymAMZxoTuukhWq82ROeDw6EbeQHqqEg8hBZxvypEcJwvf8hA1TM+YP72/CCwAPq+HnTa oEeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc; bh=g6xD4nL/8TaKP3Oc8FoGSHeffZNL83IBED3zRKVGQAg=; b=C9z/LPIvYUteaYnFtmmBTk5x+DI0QeUxGX0IUnby2CENlRO7hKM9QXiUtHA24/GQKG o3g4mK1+hMXuiiIc1MalXa1khZ1cnM4UjsxNiAerwgCxfV0OTt6E6EQlLseLOnjNbB11 VhP2ISYTVllL071i12DX0gdBKt2O7ZYnUepnj2FcwdbGwAwBpEh8j+lkkc7qOTIiGAVW aLNQwA6TmQ8nlpx44qHAjkMBSoBOkajAqTPqumtMvIcMEsRQRTOgmXDhSDUwocY+756P FBRCeZZKDQfUim1HFcjnLCvzhGbiDVwHQ4u/kmZj6LAxXYpevdK5zDFkccboaqP6GxZq 82UA== X-Gm-Message-State: ACgBeo06KHARrTXW+MIHr5gBY57errOn9hKti+txjb8je9WXwc9zMbW7 CGhEniUi2Fanuy0WhL3Ki1k= X-Received: by 2002:a17:906:8a44:b0:730:9d18:17b5 with SMTP id gx4-20020a1709068a4400b007309d1817b5mr9417763ejc.378.1660544612813; Sun, 14 Aug 2022 23:23:32 -0700 (PDT) Received: from [192.168.1.10] ([46.249.74.23]) by smtp.googlemail.com with ESMTPSA id u4-20020a50eac4000000b0043ba7df7a42sm6022349edp.26.2022.08.14.23.23.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Aug 2022 23:23:32 -0700 (PDT) Subject: Re: [PATCH 3/3] drm: omapdrm: Do no allocate non-scanout GEMs through DMM/TILER To: Yongqin Liu Cc: Tomi Valkeinen , tomba@kernel.org, airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, merlijn@wizzup.org, tony@atomide.com, "Bajjuri, Praneeth" , Sumit Semwal References: <1642587791-13222-1-git-send-email-ivo.g.dimitrov.75@gmail.com> <1642587791-13222-4-git-send-email-ivo.g.dimitrov.75@gmail.com> <5b6d3e7f-c638-fdc7-5080-44d34abed610@ideasonboard.com> From: Ivaylo Dimitrov Message-ID: <4128aed0-211a-d12a-6a86-deb4457d39f7@gmail.com> Date: Mon, 15 Aug 2022 09:23:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 Hi Liu, On 14.08.22 г. 17:27 ч., Yongqin Liu wrote: > Hi, IvayIo > > Thanks very much for the reply! > > On Sat, 13 Aug 2022 at 14:58, Ivaylo Dimitrov > wrote: >> >> Hi Liu, >> >> On 12.08.22 г. 7:35 ч., Yongqin Liu wrote: >>> Hi, Ivaylo, Tomi >>> >>> We have one X15 Android AOSP master build, it could not have the home >>> screen displayed >>> on the hdmi monitor connected with this change, with the following >>> message printed on the serial console >>> [ 607.404205] omapdrm omapdrm.0: Failed to setup plane plane-0 >>> [ 607.410522] omapdrm omapdrm.0: Failed to setup plane plane-1 >>> [ 607.416381] omapdrm omapdrm.0: Failed to setup plane plane-2 >>> [ 607.422088] omapdrm omapdrm.0: Failed to setup plane plane-3 >>> >>> # for details, please check the link here: http://ix.io/47m1 >>> >>> It will work with home screen displayed on the hdmi monitor if this >>> change is reverted. >>> >>> Is this the broken problem you talked about here? >>> >>> And could you please give some suggestions on how to have the x15 >>> Android build work with this change? >>> >> >> Make sure scanout (i.e. those to be displayed) buffers are actually >> allocated as such - OMAP_BO_SCANOUT flag must be set when calling >> omap_bo_new(). > > I am not familiar with this area, I am sorry if I asked quite silly questions:( > I googled omap_bo_new, and found it's a function of libdrm here[1], is > it what you meant here? > Yes, calling this function from userspace ends in kernel code the $subject patch is part of. > If it's the omap_bo_new that we should pass OMAP_BO_SCANOUT when it is called, > then is it the correct way to update omap_bo_new to add the OMAP_BO_SCANOUT flag > before it calls omap_bo_new_impl? > omap_bo_new() is fine and does not need any updates/fixes, it is the code that uses it (whoever it is, I am not familiar with the userspace you are using) that shall pass correct flags (third parameter) when calling it. BTW you shall really find who and how uses OMAP BO API, in theory it might use ioctls directly and not call omap_bo_xxx functions. strace would be your friend there. or gdb, or whatever tools are used on android. Or put some printfs() in omap_bo_new() that output the PID of the calling process, etc. > And another question is that, since the userspace(libdrm) will be used > to work with different kernel versions, > like the old 4.14, 4.19, etc, do you think there will be problem to > pass OMAP_BO_SCANOUT > from the userspace side with the old kernels(which does not have this change)? > does this change need to be backported to the old kernel versions? There should not be any issue. The changes could be backported if one hits the issues this $series is fixing, but there is no need. > > And the last question is that, omap_bo_new might be called by some > property binaries what not everyone > could get the source to update, for such case what's your suggestions? > Hard to say without knowing what that library would be. When I hit issues with closed blobs, sometimes I reverse-engineer them to fix the issue, example: https://github.com/maemo-leste/sgx-ddk-um/tree/master/dbm This is REed libdbm from sgx-ddk-um 1.17.4948957, that is responsible for allocating BOs (what omap_bo_new() does) but it uses DUMB buffers API, instead of OMAP BO API. I guess you are using some older version of sgx-ddk-um, so you may fix in similar way. Or binary patch. Regards, Ivo > [1]: https://gitlab.freedesktop.org/mesa/drm/-/blob/main/omap/omap_drm.c#L227 > > Thanks, > Yongqin Liu >>> On Thu, 17 Feb 2022 at 23:29, Ivaylo Dimitrov >>> wrote: >>>> >>>> >>>> >>>> On 17.02.22 г. 14:46 ч., Tomi Valkeinen wrote: >>>>> Hi, >>>>> >>>>> On 19/01/2022 12:23, Ivaylo Dimitrov wrote: >>>>>> On devices with DMM, all allocations are done through either DMM or >>>>>> TILER. >>>>>> DMM/TILER being a limited resource means that such allocations will start >>>>>> to fail before actual free memory is exhausted. What is even worse is >>>>>> that >>>>>> with time DMM/TILER space gets fragmented to the point that even if we >>>>>> have >>>>>> enough free DMM/TILER space and free memory, allocation fails because >>>>>> there >>>>>> is no big enough free block in DMM/TILER space. >>>>>> >>>>>> Such failures can be easily observed with OMAP xorg DDX, for example - >>>>>> starting few GUI applications (so buffers for their windows are >>>>>> allocated) >>>>>> and then rotating landscape<->portrait while closing and opening new >>>>>> windows soon results in allocation failures. >>>>>> >>>>>> Fix that by mapping buffers through DMM/TILER only when really needed, >>>>>> like, for scanout buffers. >>>>> >>>>> Doesn't this break users that get a buffer from omapdrm and expect it to >>>>> be contiguous? >>>>> >>>> >>>> If you mean dumb buffer, then no, this does not break users as dumb >>>> buffers are allocated as scanout: >>>> >>>> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/omapdrm/omap_gem.c#L603 >>>> >>>> If you mean omap_bo allocated buffers, then if users want >>>> linear(scanout) buffer, then they request it explicitly by passing >>>> OMAP_BO_SCANOUT. >>>> >>>> Ivo >>> >>> >>> > > >