Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp448970ybh; Wed, 11 Mar 2020 04:21:10 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvkODjAX9x0UjjNx4erwSdMLbav0aUy5NCgi/POuNHrvn6l7AlUrFwPhM1GF7i3DYGD7AOk X-Received: by 2002:a4a:7ac8:: with SMTP id a191mr221848ooc.30.1583925670590; Wed, 11 Mar 2020 04:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583925670; cv=none; d=google.com; s=arc-20160816; b=HJEBJKchUcEGK7teJTcY0Vr8V9i1Hsz/3bzdaznS3eSflKJOGLIVS5Udgz3y1254hx /yZ21t2lxdeZgGMkD8/ylXp7TAI0f2JQC+r7I5N4jT/A1BsB3hN/oVIwd34KHZc41iS2 BQ/0HY/EsNzU5KlD4IIyiGgFcV3NwCjs/TSqxWsI++6+cWLlmW99rbph1pwVIOiG7I4y cvsF/4CETrQIz0jRZ8ZKHIcwTKbSDMUBoSd+wWzYzSIMWyUSDf6seu1+vHhsmlwYuqOa +LpvsuDwCfZvoc4oiIvYsvLj++BVIydcEvLtEu+/fJaF5liNQRUHqeZ04xnnbRLhMSUm dFTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HbNivqIBs4pO6i4JqhZUJefImajxMHo9WsbKwRa5KuU=; b=WG60qLP2KpgInt26WDqt0aRlwASDT/5EC+13o/9X62iZWG2T2Rm4JrlY1ylL8zsklj tjOGDhm25zTaIPiXsiZGIuFKlUBRa43k4aTrsLqIMNkkkEwtk/f+ZLpsxDVeG6+AoV/W yflnsxC0pWD4O2Bq/jV5OVArZ49wHhHI35mtJMFKuUEjSCv7Es1QB7V8/TsI8X8ZcKbb /5mwiLK3zsuPIFQrmkcvK+exxlpfwUXp9//X6DrcZuMiZXoiWhSSZYfit4dJXMYdMrfS YwCgdUYMwdJ8WVj/Sv1LFML4l/tobbkWx7le6HfIDFqixuYWonbW8Fx0LGvBjNp9cEu+ HRcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BLZlM4Vs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si963713otc.153.2020.03.11.04.20.58; Wed, 11 Mar 2020 04:21:10 -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=@chromium.org header.s=google header.b=BLZlM4Vs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbgCKLUa (ORCPT + 99 others); Wed, 11 Mar 2020 07:20:30 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:37591 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729139AbgCKLU3 (ORCPT ); Wed, 11 Mar 2020 07:20:29 -0400 Received: by mail-pj1-f67.google.com with SMTP id ca13so873041pjb.2 for ; Wed, 11 Mar 2020 04:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HbNivqIBs4pO6i4JqhZUJefImajxMHo9WsbKwRa5KuU=; b=BLZlM4VsvKYHd4VLsroG9x3pc9BkKgFIdNxhZjBjjm/+j1sEDSnWY3afVjyUu7R6PM bisd04NTMJZyGDEK6+/B/pplIvIEPM5REXLbhgmATI7bvqLjrR1V4s3Oo7De/j21DCt2 p3alVM4+Krbfjf5UHngcmpJiWwKY/s217aLkA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HbNivqIBs4pO6i4JqhZUJefImajxMHo9WsbKwRa5KuU=; b=n91kqKNVdqUXkXn+ZcNl5QvAVRWy5VWE+sPizL8kP7mdjRgnlJT5Pq+MDhKUFOf6sT hCVlG/mwspIfvMJccVk8r4EAHDyx/utnaniUHa4L3tjCJ6dxdclrA0akBwXT+K34MMv3 qDvkLdjiRr30A16wt0xzKw4NawhCMGU4VRp2txFD60IJvQSetbdG28jMG0kluIXXOHd4 BipxIdKINF1uDf0FyGH8tJJTt5CANBo8uYCM1fYWC8018XUhdUzqq8091EObF4qgKUEu sdubRjDbAG/yCZkYZcBEdCHGQlBF5Qoc2mq8DF4oBF1Wc7ZfTUOKYTacb/aIab9jpDdR pCUg== X-Gm-Message-State: ANhLgQ0DSUSzIkHll/o0LM7weAfBpCW7vQLO2KynPC3cYR0S04Dt7ILH LYIoakF5CHZ+4TqWOmpFqhOw3A== X-Received: by 2002:a17:902:aa44:: with SMTP id c4mr2543611plr.73.1583925628333; Wed, 11 Mar 2020 04:20:28 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:30f2:7a9c:387e:6c7]) by smtp.gmail.com with ESMTPSA id i72sm23110641pgd.88.2020.03.11.04.20.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Mar 2020 04:20:27 -0700 (PDT) From: David Stevens To: Gerd Hoffmann , David Airlie Cc: Daniel Vetter , "Michael S . Tsirkin" , Jason Wang , Sumit Semwal , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Stevens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, virtio-dev@lists.oasis-open.org Subject: [PATCH v3 2/4] drm/prime: add support for virtio exported objects Date: Wed, 11 Mar 2020 20:20:02 +0900 Message-Id: <20200311112004.47138-3-stevensd@chromium.org> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog In-Reply-To: <20200311112004.47138-1-stevensd@chromium.org> References: <20200311112004.47138-1-stevensd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change exposes dma-buf's get_uuid callback to PRIME drivers. Signed-off-by: David Stevens --- drivers/gpu/drm/drm_prime.c | 23 +++++++++++++++++++++++ include/drm/drm_drv.h | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 86d9b0e45c8c..50fed8497d3c 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -779,6 +779,28 @@ int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma) } EXPORT_SYMBOL(drm_gem_dmabuf_mmap); +/** + * drm_gem_dmabuf_get_uuid - dma_buf get_uuid implementation for GEM + * @dma_buf: buffer to query + * @uuid: uuid outparam + * + * Queries the buffer's virtio UUID. This can be used as the + * &dma_buf_ops.get_uuid callback. Calls into &drm_driver.gem_prime_get_uuid. + * + * Returns 0 on success or a negative error code on failure. + */ +int drm_gem_dmabuf_get_uuid(struct dma_buf *dma_buf, uuid_t *uuid) +{ + struct drm_gem_object *obj = dma_buf->priv; + struct drm_device *dev = obj->dev; + + if (!dev->driver->gem_prime_get_uuid) + return -ENODEV; + + return dev->driver->gem_prime_get_uuid(obj, uuid); +} +EXPORT_SYMBOL(drm_gem_dmabuf_get_uuid); + static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { .cache_sgt_mapping = true, .attach = drm_gem_map_attach, @@ -789,6 +811,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { .mmap = drm_gem_dmabuf_mmap, .vmap = drm_gem_dmabuf_vmap, .vunmap = drm_gem_dmabuf_vunmap, + .get_uuid = drm_gem_dmabuf_get_uuid, }; /** diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 77685ed7aa65..61e3ff341844 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -29,6 +29,7 @@ #include #include +#include #include @@ -639,6 +640,15 @@ struct drm_driver { int (*gem_prime_mmap)(struct drm_gem_object *obj, struct vm_area_struct *vma); + /** + * @gem_prime_get_uuid + * + * get_uuid hook for GEM drivers. Retrieves the virtio uuid of the + * given GEM buffer. + */ + int (*gem_prime_get_uuid)(struct drm_gem_object *obj, + uuid_t *uuid); + /** * @dumb_create: * -- 2.25.1.481.gfbce0eb801-goog