From patchwork Wed Feb 19 17:56:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11392253 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6394417EF for ; Wed, 19 Feb 2020 17:56:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4104A24656 for ; Wed, 19 Feb 2020 17:56:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NjWYkMhO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4104A24656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ABD16E844; Wed, 19 Feb 2020 17:56:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9F2A6E844 for ; Wed, 19 Feb 2020 17:56:47 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id u12so456674pgb.10 for ; Wed, 19 Feb 2020 09:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nRm5pCWJ5SqgcYDjnqqphKFQ5kdEr3Yh1XennvVMnrY=; b=NjWYkMhOakoWjuh2oCI5lX0YEriBVrKKS8DlSsDWNzfgapeoXPEDZZcXg88+4TRwZt V4PiOz+tcpa13KymkuQNQs2kPB3lBamlqvAYos6N51M0EueIAkRFLi6a9A1CLeOoRzPg dibnLl3PFpnh1GxUZFrYjhpNU9qrx2xgBwT/c= 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:mime-version :content-transfer-encoding; bh=nRm5pCWJ5SqgcYDjnqqphKFQ5kdEr3Yh1XennvVMnrY=; b=YHMAD58DN9KY+0ODZ2NIVFhTTsMDR7o7pE8ioyhFEBnM57DmRIMOalZMLlDLcKeWnt ngspys4g+mmQyM373hB5UJXyM7wyI0ICNvpm5cOM5oyUvgcnNtH0eMfNJ5FT29I4k0AI z4BhIf4Idb9QzMGT/UUNBKpMBz/zjA0vqLr1NTDHJ8q9lvFWa68bwNWw9bPllBU0THZv qdHhKPy3m97Xfo24c5k/36mY9nzYIqdSgEvFbN4lqv4hqnrWmuRGmh4XWaQtGu+y4wQ1 cT0BMZYAvOywVt7WQ/KjdkYCY5MWetFncD1e3iLIsxEePKOM7k1uFtGTKwR4Uk4uK3nv S0Gg== X-Gm-Message-State: APjAAAXh9OzCIsjZA8k3qwEt9SK8/h/jY3y73KGamWj2wV/hW5Pea+XD hxy8RnKW7HADUan6TxXl0stO6r+XLN4= X-Google-Smtp-Source: APXvYqzjFBzpaZaGrJ79ZR3zlZCtHQ5W4fNrSUOMpVkEISnsbeBVOgEJ4fI7NtqyTUXsQfHuVvlffQ== X-Received: by 2002:a63:df02:: with SMTP id u2mr27487119pgg.403.1582135007077; Wed, 19 Feb 2020 09:56:47 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id b6sm286930pfg.17.2020.02.19.09.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Feb 2020 09:56:46 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/5 v5] drm/virtio: use consistent names for drm_files Date: Wed, 19 Feb 2020 09:56:36 -0800 Message-Id: <20200219175640.809-1-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , kraxel@redhat.com, jbates@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Minor cleanup, change: - file_priv--> file, - drm_file --> file. Signed-off-by: Gurchetan Singh Reviewed-by: Emil Velikov --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index bbc31aef51f1..baad7e1c9505 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -34,12 +34,12 @@ #include "virtgpu_drv.h" static int virtio_gpu_map_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) + struct drm_file *file) { struct virtio_gpu_device *vgdev = dev->dev_private; struct drm_virtgpu_map *virtio_gpu_map = data; - return virtio_gpu_mode_dumb_mmap(file_priv, vgdev->ddev, + return virtio_gpu_mode_dumb_mmap(file, vgdev->ddev, virtio_gpu_map->handle, &virtio_gpu_map->offset); } @@ -51,11 +51,11 @@ static int virtio_gpu_map_ioctl(struct drm_device *dev, void *data, * VIRTIO_GPUReleaseInfo struct (first XXX bytes) */ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, - struct drm_file *drm_file) + struct drm_file *file) { struct drm_virtgpu_execbuffer *exbuf = data; struct virtio_gpu_device *vgdev = dev->dev_private; - struct virtio_gpu_fpriv *vfpriv = drm_file->driver_priv; + struct virtio_gpu_fpriv *vfpriv = file->driver_priv; struct virtio_gpu_fence *out_fence; int ret; uint32_t *bo_handles = NULL; @@ -116,7 +116,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, goto out_unused_fd; } - buflist = virtio_gpu_array_from_handles(drm_file, bo_handles, + buflist = virtio_gpu_array_from_handles(file, bo_handles, exbuf->num_bo_handles); if (!buflist) { ret = -ENOENT; @@ -178,7 +178,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, } static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) + struct drm_file *file) { struct virtio_gpu_device *vgdev = dev->dev_private; struct drm_virtgpu_getparam *param = data; @@ -201,7 +201,7 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data, } static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) + struct drm_file *file) { struct virtio_gpu_device *vgdev = dev->dev_private; struct drm_virtgpu_resource_create *rc = data; @@ -252,7 +252,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, return ret; obj = &qobj->base.base; - ret = drm_gem_handle_create(file_priv, obj, &handle); + ret = drm_gem_handle_create(file, obj, &handle); if (ret) { drm_gem_object_release(obj); return ret; @@ -265,13 +265,13 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, } static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) + struct drm_file *file) { struct drm_virtgpu_resource_info *ri = data; struct drm_gem_object *gobj = NULL; struct virtio_gpu_object *qobj = NULL; - gobj = drm_gem_object_lookup(file_priv, ri->bo_handle); + gobj = drm_gem_object_lookup(file, ri->bo_handle); if (gobj == NULL) return -ENOENT; From patchwork Wed Feb 19 17:56:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11392255 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E5D514E3 for ; Wed, 19 Feb 2020 17:56:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CD1E24656 for ; Wed, 19 Feb 2020 17:56:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iOjI668e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CD1E24656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7663C6E84E; Wed, 19 Feb 2020 17:56:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 29FE36E84E for ; Wed, 19 Feb 2020 17:56:51 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id y1so370092plp.7 for ; Wed, 19 Feb 2020 09:56:51 -0800 (PST) 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=YdtSg4I83FV4TfRtEYBqKUl/YbqEjTde4tXPeXzE12E=; b=iOjI668eDqzIEG4CxpP73G/TrWGvCykxQSKLLbdpxpr6RgiRbNe26NUDKIAnDDxE+M KPbAeWn7e+R0tmGUZYhfQD1oLpywOmoO64RLdTmLDP5HCZHiWkh/z5XDMwRHz0PRi5VY xi3JIwxqw38DZgrp+f8w4aIU/KYLAhdgprbtI= 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=YdtSg4I83FV4TfRtEYBqKUl/YbqEjTde4tXPeXzE12E=; b=JlBRJCpUM4fJE61ShzD8ZPCOLb3XFunsvz5zfBFJ7FiAj9flYpwy5v6AJAaL2Sa9s8 NH0OijeXuF2It7UFwvrFP8ThBCO4oenVXGXWVet9qj/Y227+3ejenZtGfBxARdfKKXG9 Kw2MMoG97Bq8n+3Pn7Go8NQnB8Rm7URPm+WuCOO1F16elhuHGiH/OQfZmHLyoTTI5sEE ZpQm2ImAvN5bknOTjmQLcR8aiTYDszQvtC/f/ip/Boh0zTQve91AEKuLzy0QVtl6koGf 013gnDd7fQva6SBh3TBeeucgucwebbCZvW/2+gSBA5Bzu6Wuy+fK5/5qVS6wXu8mzWMA msmQ== X-Gm-Message-State: APjAAAWwaNb6tN/jSDCySKiUrtamdg3G6wfJx+nVpWYtDlbbLXj4IjDM qkDKevv5TJFQDbNVChdeS9XqJEDtpmg= X-Google-Smtp-Source: APXvYqxh5vw0XZmA8O4m67WxsrY2MlMyFIFszu/r7DWqpOJXTeF0kMR+NpY8sJZ69UxzuDJC+3swQQ== X-Received: by 2002:a17:90a:b009:: with SMTP id x9mr10253925pjq.124.1582135010381; Wed, 19 Feb 2020 09:56:50 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id b6sm286930pfg.17.2020.02.19.09.56.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Feb 2020 09:56:49 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/5 v5] drm/virtio: factor out context create hyercall Date: Wed, 19 Feb 2020 09:56:37 -0800 Message-Id: <20200219175640.809-2-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219175640.809-1-gurchetansingh@chromium.org> References: <20200219175640.809-1-gurchetansingh@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , kraxel@redhat.com, jbates@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We currently create an OpenGL context when opening the DRM fd if 3D is available. We may need other context types (VK,..) in the future, and the plan is to have explicit initialization for that. For explicit initialization to work, we need to factor out virtio_gpu_create_context from driver initialization. v2: Move context handle initialization too (@olv) Signed-off-by: Gurchetan Singh Reviewed-by: Emil Velikov --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 17 +++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 26 ++++++-------------------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 2f6c4ccbfd14..72c1d9b59dfe 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -214,6 +214,8 @@ struct virtio_gpu_fpriv { /* virtio_ioctl.c */ #define DRM_VIRTIO_NUM_IOCTLS 10 extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS]; +void virtio_gpu_create_context(struct drm_device *dev, + struct drm_file *file); /* virtio_kms.c */ int virtio_gpu_init(struct drm_device *dev); diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index baad7e1c9505..de04f80f737d 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -33,6 +33,23 @@ #include "virtgpu_drv.h" +void virtio_gpu_create_context(struct drm_device *dev, + struct drm_file *file) +{ + struct virtio_gpu_device *vgdev = dev->dev_private; + struct virtio_gpu_fpriv *vfpriv = file->driver_priv; + char dbgname[TASK_COMM_LEN]; + + /* can't create contexts without 3d renderer */ + if (!vgdev->has_virgl_3d) + return; + + get_task_comm(dbgname, current); + virtio_gpu_cmd_context_create(vgdev, vfpriv->ctx_id, + strlen(dbgname), dbgname); + virtio_gpu_notify(vgdev); +} + static int virtio_gpu_map_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index ad3b673f5796..f7e3712502ca 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -52,19 +52,6 @@ static void virtio_gpu_config_changed_work_func(struct work_struct *work) events_clear, &events_clear); } -static int virtio_gpu_context_create(struct virtio_gpu_device *vgdev, - uint32_t nlen, const char *name) -{ - int handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL); - - if (handle < 0) - return handle; - handle += 1; - virtio_gpu_cmd_context_create(vgdev, handle, nlen, name); - virtio_gpu_notify(vgdev); - return handle; -} - static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev, uint32_t ctx_id) { @@ -260,8 +247,7 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) { struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_fpriv *vfpriv; - int id; - char dbgname[TASK_COMM_LEN]; + int handle; /* can't create contexts without 3d renderer */ if (!vgdev->has_virgl_3d) @@ -272,15 +258,15 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) if (!vfpriv) return -ENOMEM; - get_task_comm(dbgname, current); - id = virtio_gpu_context_create(vgdev, strlen(dbgname), dbgname); - if (id < 0) { + handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL); + if (handle < 0) { kfree(vfpriv); - return id; + return handle; } - vfpriv->ctx_id = id; + vfpriv->ctx_id = handle + 1; file->driver_priv = vfpriv; + virtio_gpu_create_context(dev, file); return 0; } From patchwork Wed Feb 19 17:56:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11392257 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8306617EF for ; Wed, 19 Feb 2020 17:56:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61D7824656 for ; Wed, 19 Feb 2020 17:56:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S/c52A3a" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61D7824656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 115526E850; Wed, 19 Feb 2020 17:56:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94CDF6EC63 for ; Wed, 19 Feb 2020 17:56:53 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id 2so420107pfg.12 for ; Wed, 19 Feb 2020 09:56:53 -0800 (PST) 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=LS8qmGyVh5Fd+keBmVNR9chtGvlexGyC6FGXOnZ78ks=; b=S/c52A3aon46BEARNoSaEjcPS60T8GBkmOpaZ2hbCGea3yHP8c7DTZxnQdZiElTcUe vtsFe07RDUphYLph1Nbdp8CWatxhHwMMXD8bI3E/rkyiNoGTwnIai/QDpp10wcI+G3I4 WH1xQnS1PGrNiczB01aKPGhHNS05vSFXTymKw= 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=LS8qmGyVh5Fd+keBmVNR9chtGvlexGyC6FGXOnZ78ks=; b=pTrBqfe/KcjEaIlQFcjlccIH28adoATFRKzQtjUBdKtnI38A+DVwwYwrptfLUXBAvq ZZ/bPNqz4BY5uITqpVc7O0EERY7kjCqMAQfnMyrbikNuLxl9wzE5uiqMDVWK6SMrIl/5 /hOQw8HPT0amVnXb9AGKPYXOVgvlYnDoz4vip6iLpnJ4QcN9lJwLBM9JBgY+H/pOMAm0 wy9TVQBNALc3gdajoKDxs8OJmJy1ieG7iJWbS98hjvxAWA9wwmm24JliCAvxM93/9o+g thlhbKWysJEolIzSPUwcQi7RzzLvfx7k841cITQAVG3Y2/IJV11wZpUo9LeLJATk7wVc wLfw== X-Gm-Message-State: APjAAAUlP++rfjZYZS/MW8L4zbhxAcdkk0Za7kNAmFnVkcxFofVVpnsM x4l7hH8rINbwy4yIKcvRVk6bUK5h6Yw= X-Google-Smtp-Source: APXvYqyAiN4Hf2M9eQZrDEZoP8AWafzlduVzc3MEmyCaqoSHUbQFPLqwzEB8OxGjf6cvDazw2xKGsQ== X-Received: by 2002:a63:1555:: with SMTP id 21mr2481985pgv.348.1582135012908; Wed, 19 Feb 2020 09:56:52 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id b6sm286930pfg.17.2020.02.19.09.56.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Feb 2020 09:56:52 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/5 v5] drm/virtio: track whether or not a context has been initiated Date: Wed, 19 Feb 2020 09:56:38 -0800 Message-Id: <20200219175640.809-3-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219175640.809-1-gurchetansingh@chromium.org> References: <20200219175640.809-1-gurchetansingh@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , kraxel@redhat.com, jbates@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use an atomic variable to track whether a context has been initiated. v5: Fix possible race and sleep via mutex (@olv) Signed-off-by: Gurchetan Singh Reviewed-by: Emil Velikov Reviewed-by: Chia-I Wu --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 ++++++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 72c1d9b59dfe..0596d9618554 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -209,6 +209,8 @@ struct virtio_gpu_device { struct virtio_gpu_fpriv { uint32_t ctx_id; + bool context_initiated; + struct mutex context_lock; }; /* virtio_ioctl.c */ diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index de04f80f737d..c1a6cb4ec375 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -44,10 +44,18 @@ void virtio_gpu_create_context(struct drm_device *dev, if (!vgdev->has_virgl_3d) return; + mutex_lock(&vfpriv->context_lock); + if (vfpriv->context_initiated) + goto out_unlock; + get_task_comm(dbgname, current); virtio_gpu_cmd_context_create(vgdev, vfpriv->ctx_id, strlen(dbgname), dbgname); virtio_gpu_notify(vgdev); + vfpriv->context_initiated = true; + +out_unlock: + mutex_unlock(&vfpriv->context_lock); } static int virtio_gpu_map_ioctl(struct drm_device *dev, void *data, diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index f7e3712502ca..424729cb81d1 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -258,6 +258,8 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) if (!vfpriv) return -ENOMEM; + mutex_init(&vfpriv->context_lock); + handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL); if (handle < 0) { kfree(vfpriv); @@ -281,6 +283,7 @@ void virtio_gpu_driver_postclose(struct drm_device *dev, struct drm_file *file) vfpriv = file->driver_priv; virtio_gpu_context_destroy(vgdev, vfpriv->ctx_id); + mutex_destroy(&vfpriv->context_lock); kfree(vfpriv); file->driver_priv = NULL; } From patchwork Wed Feb 19 17:56:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11392259 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2649814E3 for ; Wed, 19 Feb 2020 17:57:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04B8124656 for ; Wed, 19 Feb 2020 17:57:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WniLRnDH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04B8124656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EFF346EC63; Wed, 19 Feb 2020 17:56:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB9DC6E850 for ; Wed, 19 Feb 2020 17:56:55 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id 2so420168pfg.12 for ; Wed, 19 Feb 2020 09:56:55 -0800 (PST) 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=vdiR20VC6vkGJDAO7FccoI0GxIBtkf3Z1Z674w/ao6Y=; b=WniLRnDH+Gv1Cp4FvsmUSnkhLC8h6uptFQB6u/chSHq7p1DQsikEoXpR6gxk9Cj/yh nn7+qkt8zajwlkZTguX9esSA5PkMeTxvLO0wij6/869m62S/w1LyseznJTolWzUmw6xx 5YBgjBlHABPEDdk3+hFJ3ql5CGIukt/Ic99NI= 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=vdiR20VC6vkGJDAO7FccoI0GxIBtkf3Z1Z674w/ao6Y=; b=UxZv+RVLQLLA1Rh5LD/WVvPnRaJ/Djg8PdcrvbnZj5OmROqrGklKJzN/Xr00wvHDdV epzkFE83ESVEEoJ8Kl5QzxyJ5h1XhdBCosVPdRrlCCM2v+md9DiP4xfImw73v8H+26/U RRdcU9mfx+4hcteelQuLfVVWH/cvTb1HfbqkV8Ou6n3wGmHebjE0XJEBLLUG3JwOblf1 WSz+HLfImQbkesMcnuyfzVVOjrfTVKH01BK0eShfAxOax3DmemR3KCQvmNjXLpFivLYR 0aMeEpG8wqINWLtTxu1T/psLQQ7Mqsdy2I2+Fn1m091nBHY/PgKJJNKrEiAQXblDHIC2 SzwQ== X-Gm-Message-State: APjAAAXMRMuBKRK/BwYV8zDg8lfRl7C/nLAfULNCvx9vOGuFd0aW+Z4m 7JQQNhyfjq7xmsbxkQxQBpZgIWh0+/k= X-Google-Smtp-Source: APXvYqyY1q9RH3SKpWegQOudR5LSF1Ee7ZGcJGnomT2/Vl1baeZqJ1za5OPW1ODZHI4CbZiqa2HV2w== X-Received: by 2002:a63:6607:: with SMTP id a7mr29929940pgc.310.1582135014905; Wed, 19 Feb 2020 09:56:54 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id b6sm286930pfg.17.2020.02.19.09.56.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Feb 2020 09:56:54 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/5 v5] drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl Date: Wed, 19 Feb 2020 09:56:39 -0800 Message-Id: <20200219175640.809-4-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219175640.809-1-gurchetansingh@chromium.org> References: <20200219175640.809-1-gurchetansingh@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , kraxel@redhat.com, jbates@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" For old userspace, initialization will still be implicit. For backwards compatibility, enqueue virtio_gpu_cmd_context_create after the first 3D ioctl. v3: staticify virtio_gpu_create_context remove notify to batch vm-exit Signed-off-by: Gurchetan Singh Reviewed-by: Emil Velikov --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 10 +++++++--- drivers/gpu/drm/virtio/virtgpu_kms.c | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 0596d9618554..9fdc3b4cef48 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -216,8 +216,6 @@ struct virtio_gpu_fpriv { /* virtio_ioctl.c */ #define DRM_VIRTIO_NUM_IOCTLS 10 extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS]; -void virtio_gpu_create_context(struct drm_device *dev, - struct drm_file *file); /* virtio_kms.c */ int virtio_gpu_init(struct drm_device *dev); diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index c1a6cb4ec375..2c182922ec78 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -33,8 +33,8 @@ #include "virtgpu_drv.h" -void virtio_gpu_create_context(struct drm_device *dev, - struct drm_file *file) +static void virtio_gpu_create_context(struct drm_device *dev, + struct drm_file *file) { struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_fpriv *vfpriv = file->driver_priv; @@ -51,7 +51,6 @@ void virtio_gpu_create_context(struct drm_device *dev, get_task_comm(dbgname, current); virtio_gpu_cmd_context_create(vgdev, vfpriv->ctx_id, strlen(dbgname), dbgname); - virtio_gpu_notify(vgdev); vfpriv->context_initiated = true; out_unlock: @@ -99,6 +98,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, exbuf->fence_fd = -1; + virtio_gpu_create_context(dev, file); if (exbuf->flags & VIRTGPU_EXECBUF_FENCE_FD_IN) { struct dma_fence *in_fence; @@ -250,6 +250,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, return -EINVAL; } + virtio_gpu_create_context(dev, file); params.format = rc->format; params.width = rc->width; params.height = rc->height; @@ -323,6 +324,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev, if (vgdev->has_virgl_3d == false) return -ENOSYS; + virtio_gpu_create_context(dev, file); objs = virtio_gpu_array_from_handles(file, &args->bo_handle, 1); if (objs == NULL) return -ENOENT; @@ -371,6 +373,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, args->box.w, args->box.h, args->box.x, args->box.y, objs, NULL); } else { + virtio_gpu_create_context(dev, file); ret = virtio_gpu_array_lock_resv(objs); if (ret != 0) goto err_put_free; @@ -471,6 +474,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, spin_unlock(&vgdev->display_info_lock); /* not in cache - need to talk to hw */ + virtio_gpu_create_context(dev, file); virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, &cache_ent); virtio_gpu_notify(vgdev); diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index 424729cb81d1..023a030ca7b9 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -268,7 +268,6 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) vfpriv->ctx_id = handle + 1; file->driver_priv = vfpriv; - virtio_gpu_create_context(dev, file); return 0; } From patchwork Wed Feb 19 17:56:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 11392261 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9758414E3 for ; Wed, 19 Feb 2020 17:57:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75DB024656 for ; Wed, 19 Feb 2020 17:57:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KO8v/tmM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75DB024656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21C706EC67; Wed, 19 Feb 2020 17:57:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64CC36EC63 for ; Wed, 19 Feb 2020 17:56:57 +0000 (UTC) Received: by mail-pj1-x1044.google.com with SMTP id ep11so385176pjb.2 for ; Wed, 19 Feb 2020 09:56:57 -0800 (PST) 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=/JEnLcAtGIG219i09XqvTRNx8kXp3LRiom3JHmmcaKE=; b=KO8v/tmMVMykzr0OvT2E/OfoZUWCqBNEXSs4WIj0c5OUB5I8kJnkfPMJUg26LUu0ly 6wPRN/5r5M0dIumNjOAB47sXYJc8t9EtchfA90bEdIe90x1Q/OPKEsD3JqeWGg4PfwSM fixulgSOA7iH/W6ytmlhC/RmK8BwmlSlnzolA= 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=/JEnLcAtGIG219i09XqvTRNx8kXp3LRiom3JHmmcaKE=; b=tjzMimUal5JXKJjwYlyHL3ZUqiX85i6AJdctzAKjxo9qTZWRo15yRk3nR+3FlIlN/r B1HrvUm/NU5WsGZZNxt9L5ngqPQJOxGT3SthoMy585gmEj5L7TY66EXjU6r9AFuKsiqm N1JMOEi+HvwTQbTC7JaoJuwxODTzLNNSDSZhlVywvmxdskFtyOADyJZJ1o4CgP0eDZFq 0tcc/PFnFdtMUZUlJGpAo7pDaI0UH9xdKIlc7xhNVnyI1/iV+GXbG7wt5BJMiMT0iWic 5xqeLrfAWX4pBU8SNuQpBnF29zA/CFVXErrybaW9y7o7xWA28avgY/xdx0sgnMbNLyUL Psnw== X-Gm-Message-State: APjAAAWLWrRcBKMyR+2O83tt7Os8Jg13xxVCAtfHhqdi1IW+DAoWjbOB iEHXL4CznpFRE9GLC0PhO9SWFN+UyRE= X-Google-Smtp-Source: APXvYqw3UwaGkqnYvPWkE9xBKLXHt+SvvC1QeGxDc4maQJnK7lua5z0EW1Ec6ArtRo5RGlD1mXzKcQ== X-Received: by 2002:a17:902:61:: with SMTP id 88mr26861113pla.17.1582135016620; Wed, 19 Feb 2020 09:56:56 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:202:201:bc97:5740:52a7:6875]) by smtp.gmail.com with ESMTPSA id b6sm286930pfg.17.2020.02.19.09.56.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Feb 2020 09:56:56 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/5 v5] drm/virtio: add virtio_gpu_context_type Date: Wed, 19 Feb 2020 09:56:40 -0800 Message-Id: <20200219175640.809-5-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219175640.809-1-gurchetansingh@chromium.org> References: <20200219175640.809-1-gurchetansingh@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , kraxel@redhat.com, jbates@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We'll have to do something like this eventually, and this conveys we want a Virgl context by default. Signed-off-by: Gurchetan Singh Reviewed-by: Emil Velikov --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 2c182922ec78..c3358eedd3ab 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -33,8 +33,14 @@ #include "virtgpu_drv.h" +/* TODO: add more context types */ +enum virtio_gpu_context_type { + virtio_gpu_virgl_context, +}; + static void virtio_gpu_create_context(struct drm_device *dev, - struct drm_file *file) + struct drm_file *file, + enum virtio_gpu_context_type type) { struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_fpriv *vfpriv = file->driver_priv; @@ -44,6 +50,11 @@ static void virtio_gpu_create_context(struct drm_device *dev, if (!vgdev->has_virgl_3d) return; + if (type != virtio_gpu_virgl_context) { + DRM_ERROR("Unsupported context type: %u\n", type); + return; + } + mutex_lock(&vfpriv->context_lock); if (vfpriv->context_initiated) goto out_unlock; @@ -98,7 +109,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, exbuf->fence_fd = -1; - virtio_gpu_create_context(dev, file); + virtio_gpu_create_context(dev, file, virtio_gpu_virgl_context); if (exbuf->flags & VIRTGPU_EXECBUF_FENCE_FD_IN) { struct dma_fence *in_fence; @@ -250,7 +261,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data, return -EINVAL; } - virtio_gpu_create_context(dev, file); + virtio_gpu_create_context(dev, file, virtio_gpu_virgl_context); params.format = rc->format; params.width = rc->width; params.height = rc->height; @@ -324,7 +335,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev, if (vgdev->has_virgl_3d == false) return -ENOSYS; - virtio_gpu_create_context(dev, file); + virtio_gpu_create_context(dev, file, virtio_gpu_virgl_context); objs = virtio_gpu_array_from_handles(file, &args->bo_handle, 1); if (objs == NULL) return -ENOENT; @@ -373,7 +384,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data, args->box.w, args->box.h, args->box.x, args->box.y, objs, NULL); } else { - virtio_gpu_create_context(dev, file); + virtio_gpu_create_context(dev, file, virtio_gpu_virgl_context); ret = virtio_gpu_array_lock_resv(objs); if (ret != 0) goto err_put_free; @@ -474,7 +485,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, spin_unlock(&vgdev->display_info_lock); /* not in cache - need to talk to hw */ - virtio_gpu_create_context(dev, file); + virtio_gpu_create_context(dev, file, virtio_gpu_virgl_context); virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, &cache_ent); virtio_gpu_notify(vgdev);