Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5347160ybh; Wed, 7 Aug 2019 04:42:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiy5SvL2OIrtDM4Rl8rQY/aCcj7/AsoL1+4ExlnyZNC0O62fD+Wf3e+hAi1vGhH49GLq9M X-Received: by 2002:a17:90a:9488:: with SMTP id s8mr8218191pjo.2.1565178120370; Wed, 07 Aug 2019 04:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565178120; cv=none; d=google.com; s=arc-20160816; b=VrEjybjKFxhkfntRS0VcZlbIbr0ce5Fh9S2IDIIn2b9gaCAUugCFtZBvsI7/xahiIs xptIfF/enRVQ2fybKtJPt/4+ruDVLqx32p4NIIs8KL0yrv9Xic+jGL3YeqJ7LU5bq48c 2tf8e3s4PbdL3lSQ05b+ybp8r6rWJDQHsIkA3gCxgstC6I2GoXz3Vs6vi9ZmnUJ0w6cq ulMkGq2Hci/QjPVU8My7oPg8Occnu4qL+9Q8ZQJN7ZRFPXylMld0gj5RB1tkTRhLK3+V pjM+vAJl37I64qw9Ej8gfoVmKsI7WoHorrlyBp5GS270Wgmg0q1Wbie2s4GbWr5Pqpuf L3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=u29YZUSF8gmWkdHKDYGSBVYcnPuAF9Z+Z15UNCjQBh4=; b=JqvwYSZQf5l4HYkxWJtCUC5ezb06JRDkbd2tNcwMBfc6EsJrVKw9dkHUvRqUPG0kwf flLkgRQ4jD/F9xy3bXv5ryf7kLfWiIRYlQ++J9TVzAK9uHx6dONlyOnqKzHds0yrhVxF RgSMu7m1Dlggm89JswKSb0p3y034oNH7OxTixQE5sfMnCAAgxOCV/15ssPXCadLHd+jY AQb0hkp2tjb7RcVbYhy3oGSAL/9uf8dYPcIKK6AQ6XGDkZwacQLX6vUNsO8PM6gu19PO +sOJbMbVpDBQV5O3nElxHP6Sixfad0E0s/sD5Bf0m2q/91Pbqjbpvpc476MgvPXaSCIS IDKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=iYQBlMMi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si43334255plb.35.2019.08.07.04.41.44; Wed, 07 Aug 2019 04:42:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=iYQBlMMi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728558AbfHGLk3 (ORCPT + 99 others); Wed, 7 Aug 2019 07:40:29 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36030 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726873AbfHGLk2 (ORCPT ); Wed, 7 Aug 2019 07:40:28 -0400 Received: by mail-ot1-f68.google.com with SMTP id r6so102918341oti.3 for ; Wed, 07 Aug 2019 04:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u29YZUSF8gmWkdHKDYGSBVYcnPuAF9Z+Z15UNCjQBh4=; b=iYQBlMMi7h2rWOIbCa0SK9ioKSJCm+YmQyXG61XP56+485S8fAX4FvlL+H942DNVYo DFZRw8kyejuPYyd2V5djtNNKwvVPvKGQjeeAhrgYj6dzyDVPHjUgX0lfnIe/7ijxi8o3 8Ju0JeK7qHlU6SrPbsgwEaMYQxJHv7xQGIGa4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u29YZUSF8gmWkdHKDYGSBVYcnPuAF9Z+Z15UNCjQBh4=; b=TnyX38xCQCuwBkY86uf8JCFEt5+AKjawIp2aM2W5cSMqMyl9nrCpErOlsjkgpl0b+D Ng7+/01Kx2qGWoXXKBI+fFQ5KebNaFNSQbwE8OQyuUZha3w7S+0WPFQS1w5sW60h8C1T wcSHQ5vnIBHm8v6hiCWI9dLQlI6wMUZNhRagP5+/V37o4XIqfMiBLZTa96h40Nn8ZRBm sevmLsLBLvXLc0YSit1zHawVjhimXHY4kOWtEsaipaYro3hwy5Twd5SBTCdELyMOexi5 Kty5wVRjS6JiNf46g959LF0bj8B2Uv0RWP1cz29tKg2gXEQT6QwKOHpb4/42mk9AKGtT 3lAw== X-Gm-Message-State: APjAAAWJKtR3m3Ck2Mena6SZsdYg+6G5llP8GQy1pgLogM1M3Pv3VBmA xEwEQdBiy05k1Bv+fl18pg8nQhl459roQz4RuVRsnc0Rz5mppg== X-Received: by 2002:a05:6808:118:: with SMTP id b24mr5059229oie.128.1565178027368; Wed, 07 Aug 2019 04:40:27 -0700 (PDT) MIME-Version: 1.0 References: <20190806133454.8254-1-kraxel@redhat.com> <20190806133454.8254-2-kraxel@redhat.com> <20190806135426.GA7444@phenom.ffwll.local> <20190807072654.arqvx37p4yxhegcu@sirius.home.kraxel.org> <20190807103649.aedmac63eop6ktlk@sirius.home.kraxel.org> In-Reply-To: <20190807103649.aedmac63eop6ktlk@sirius.home.kraxel.org> From: Daniel Vetter Date: Wed, 7 Aug 2019 13:40:15 +0200 Message-ID: Subject: Re: [PATCH 1/3] drm: add gem ttm helpers To: Gerd Hoffmann Cc: dri-devel , Thomas Zimmermann , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 7, 2019 at 12:36 PM Gerd Hoffmann wrote: > > Hi, > > > > > Same for this, you're just upcasting to ttm_bo and then downcasting to > > > > gem_bo again ... I think just a series to roll out the existing gem > > > > helpers everywhere should work? > > > > > > I don't think so. drm_gem_dumb_map_offset() calls > > > drm_gem_create_mmap_offset(), which I think is not correct for ttm > > > objects because ttm_bo_init() handles vma_node initialization. > > > > More code to unify first? This should work exactly the same way for > > all gem based drivers I think ... Only tricky bit is making sure > > vmwgfx keeps working correctly. > > Yea. Unifying on the gem way of doing things isn't going to work very > well. We would have to keep the current way of doing things in the ttm > code, wrapped into "if (ttm_bo_uses_embedded_gem_object()) { ... }", to > not break vmwgfx. > > So adding gem ttm helpers (where gem+ttm drivers can opt-in) looked like > the better way of handling this to me ... Ok I looked again, and your ttm version seems to exactly match drm_gem_dumb_map_offset(), which we almost called drm_gem_map_offset(). And could do that again by undoing that revert. So I'm not seeing how a generic version for this stuff here wouldn't also work for ttm ... Ofc if vmwgfx does something else they can keep their own specific dumb map_offset implementation. What am I missing? -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch