Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp789602rwl; Wed, 5 Apr 2023 07:46:11 -0700 (PDT) X-Google-Smtp-Source: AKy350by3Z6gObVG4Kg+u6u7+SJFkuzETt9/jTKt0kwUj9fAffxnGyp5Fq+dv5miphOktM69yYqR X-Received: by 2002:a17:903:41c1:b0:19f:2dff:21a2 with SMTP id u1-20020a17090341c100b0019f2dff21a2mr7133674ple.64.1680705971122; Wed, 05 Apr 2023 07:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680705971; cv=none; d=google.com; s=arc-20160816; b=hFPZNCC5HZ9+8B+U5BrajH1pKHKXxWxhP39WqlEqc8aSFVj76FIwq4hweBrNlxYPE/ PR444GAPkp1QRCkFASkG//6rL3r23hYuvTTuZDoHvngx0S31olFiUYnNoBr2TXGHMWZN zSPAyYdwED+bptXuoEAUJ3hiD3o+tWX3OTSD61Y4QYasIF5GPx52qbbgf5Lpbfoj3wyH YrxdwwkeLweaeEG8/4NvM6hPh5CVV4zQDQZbW+dRcB4U9SKU7VfU0+cikgqsWPkoUKTT 5ADTDWGID19duyB2U8yXkOy5zE8+9gMqYqA/8lRvoqqg3ADnQ5dtZz58oxtfqSvmnkKF l1Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9lLnJ1+P3Iu2mYgt/o+7cyTWl5Q1ydZ9Nz1cnrQ5Nmc=; b=j5i6NYGN+gwB6qZQsyUWuUKbujVCVK9luC0RRHZa1salBqutJZr6zSTMyt6pb7kMk8 ea0Kid+hjV0AHBbBptIM0EurIt+SQ3l5yhUgA3QWB32dVW3t1RfPJu/gelG4xbvMW24J VRd7T4W7ffBwth31mmbrCQUFZmmdKdmBCb33tLIDH5aKxVErK5e5RX19RBVW8pxGYBzY ImyY6OV6iYeIcj7YxYiv0rF05PpX+bNNF5IDEYkQPDK8zdJbdev88RaXOfVULwEtgLGg +fD7SbpPx6i+xwxEoa/bRK5z7CK3DvLNTO7kCjnBqiKl5gCvrQzTFSkM7BMBKUwblUUu w5GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=UJzXtPPw; 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 b16-20020a170903229000b001a051676302si12925959plh.494.2023.04.05.07.45.59; Wed, 05 Apr 2023 07:46:11 -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=@ffwll.ch header.s=google header.b=UJzXtPPw; 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 S238400AbjDEOoU (ORCPT + 99 others); Wed, 5 Apr 2023 10:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237141AbjDEOoS (ORCPT ); Wed, 5 Apr 2023 10:44:18 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D5EAFB for ; Wed, 5 Apr 2023 07:44:17 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-4fd1f2a0f82so63910a12.1 for ; Wed, 05 Apr 2023 07:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1680705855; x=1683297855; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=9lLnJ1+P3Iu2mYgt/o+7cyTWl5Q1ydZ9Nz1cnrQ5Nmc=; b=UJzXtPPwq73Eu+NmBlgfXI9JxlVitZ4kXrO0pETGtZxMEVTi1y5WaveTdET9Z1qul9 Rq1swKdnVflb+zz6G7f5yZdKkLbBRw/SLhrRIHaGaQOz0gUUHsYs1b1srMn29K4/4HYD j+tBSrvp2UABDduixiEjXDgqUUDvyx/FKcfCE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680705855; x=1683297855; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9lLnJ1+P3Iu2mYgt/o+7cyTWl5Q1ydZ9Nz1cnrQ5Nmc=; b=pfBMiOwtpjy0TDz3UhvyxA2SRsEQ8vdkoJrwZHZ0rB7txhkKvUAGCG5zjZVZ2vgnrP 33dw9SQsd2ArsAQMtWkDUGjGFAqePl6fvZIkgVo6tVfotcJqIE6yqKsrGhEz6O7ga00I eh4UYAwECh1kgaVO5wZD5aKSNTR3XCpf1rZkn9qOSBbgum+ElRDAWqiWw1lc2+ox1aIj Ugj+NS4gdJW+OsgArw9WrcKCNienDhz1Y8azL/OWINqr4sfnmXLinXO7qkMUx+yD6J6q ihEOr0Yv2ZRE5cWysMOT8OyCeAKMxY14tLtyx4ID44347iQ1IVn4TvQCKFgwrN6P9qOX ncxw== X-Gm-Message-State: AAQBX9cCWizto5cW/mRWuIcWEWeJnnun/2zOIYQBYVQwP1I6FPJtamT0 etGFQmeuWQfRqzMtkt1wnTR7xQ== X-Received: by 2002:a05:6402:268e:b0:502:ffd:74a1 with SMTP id w14-20020a056402268e00b005020ffd74a1mr2119026edd.2.1680705855694; Wed, 05 Apr 2023 07:44:15 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-33.fiber7.init7.net. [212.51.149.33]) by smtp.gmail.com with ESMTPSA id l2-20020a50c102000000b004fa012332ecsm7403362edf.1.2023.04.05.07.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:44:15 -0700 (PDT) Date: Wed, 5 Apr 2023 16:44:13 +0200 From: Daniel Vetter To: Asahi Lina Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Luben Tuikov , Jarkko Sakkinen , Dave Hansen , Alyssa Rosenzweig , Karol Herbst , Ella Stanforth , Faith Ekstrand , Mary , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-sgx@vger.kernel.org, asahi@lists.linux.dev Subject: Re: [PATCH RFC 18/18] drm/asahi: Add the Asahi driver for Apple AGX GPUs Message-ID: Mail-Followup-To: Asahi Lina , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Luben Tuikov , Jarkko Sakkinen , Dave Hansen , Alyssa Rosenzweig , Karol Herbst , Ella Stanforth , Faith Ekstrand , Mary , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-sgx@vger.kernel.org, asahi@lists.linux.dev References: <20230307-rust-drm-v1-0-917ff5bc80a8@asahilina.net> <20230307-rust-drm-v1-18-917ff5bc80a8@asahilina.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230307-rust-drm-v1-18-917ff5bc80a8@asahilina.net> X-Operating-System: Linux phenom 6.1.0-7-amd64 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Tue, Mar 07, 2023 at 11:25:43PM +0900, Asahi Lina wrote: > +/// Look up a GEM object handle for a `File` and return an `ObjectRef` for it. > +pub(crate) fn lookup_handle(file: &DrmFile, handle: u32) -> Result { > + Ok(ObjectRef::new(shmem::Object::lookup_handle(file, handle)?)) > +} So maybe my expectations for rust typing is a bit too much, but I kinda expected this to be fully generic: - trait Driver (drm_driver) knows the driver's object type - a generic create_handle function could ensure that for drm_file (which is always for a specific drm_device and hence Driver) can ensure at the type level that you only put the right objects into the drm_file - a generic lookup_handle function on the drm_file knows the Driver trait and so can give you back the right type right away. Why the wrapping, what do I miss? -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch