Hi,
Here is another version of the patch due to recent makefile changes. This
time I also included the copyright-statement used for the other parts of
the module.

regards
Andreas Pokorny

On Mon, Mar 6, 2017 at 4:09 PM, Michael Thayer <[email protected]>
wrote:

> Hello Andreas,
>
> I haven not yet tried applying this, but it looks reasonable.  Could you
> please confirm that you are submitting the patch under the MIT licence?
>
> Thanks.
> Regards
> Michael
>
>
> 03.03.2017 13:16, Andreas Pokorny wrote:
>
>> Hi,
>> I have attached an SVN diff patch that will add dmabuf fd support to
>> vboxvideo. This allows running mirserver and clients or unity8 in
>> particular in virtual box.
>>
>>
>> regards
>> Andreas Pokorny
>>
>>
>> _______________________________________________
>> vbox-dev mailing list
>> [email protected]
>> https://www.virtualbox.org/mailman/listinfo/vbox-dev
>>
>>
> --
> Michael Thayer | VirtualBox engineer
> ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt
>
> ORACLE Deutschland B.V. & Co. KG
> Hauptverwaltung: Riesstraße 25, D-80992 München
> Registergericht: Amtsgericht München, HRA 95603
>
> Komplementärin: ORACLE Deutschland Verwaltung B.V.
> Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der
> Handelskammer Midden-Nederland, Nr. 30143697
> Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
> _______________________________________________
> vbox-dev mailing list
> [email protected]
> https://www.virtualbox.org/mailman/listinfo/vbox-dev
>
Index: src/VBox/Additions/linux/drm/Makefile.module.kms
===================================================================
--- src/VBox/Additions/linux/drm/Makefile.module.kms	(revision 66114)
+++ src/VBox/Additions/linux/drm/Makefile.module.kms	(working copy)
@@ -36,7 +36,7 @@
 
 MOD_OBJS   = HGSMIBase.o HGSMICommon.o HGSMIMemAlloc.o \
              Modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \
-             vbox_mode.o vbox_ttm.o VBVABase.o
+             vbox_mode.o vbox_ttm.o VBVABase.o vbox_prime.c
 
 MOD_CFLAGS = -Wno-declaration-after-statement -fshort-wchar -fno-pie
 MOD_INCL   = $(addprefix -I$(KBUILD_EXTMOD),/ /include)
Index: src/VBox/Additions/linux/drm/vbox_drv.c
===================================================================
--- src/VBox/Additions/linux/drm/vbox_drv.c	(revision 66114)
+++ src/VBox/Additions/linux/drm/vbox_drv.c	(working copy)
@@ -272,7 +272,7 @@
 
 static struct drm_driver driver =
 {
-    .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
+    .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_PRIME,
     .dev_priv_size = 0,
 
     .load = vbox_driver_load,
@@ -301,6 +301,17 @@
 #else
     .dumb_destroy = drm_gem_dumb_destroy,
 #endif
+    .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+    .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
+    .gem_prime_export = drm_gem_prime_export,
+    .gem_prime_import = drm_gem_prime_import,
+    .gem_prime_pin = vbox_gem_prime_pin,
+    .gem_prime_unpin = vbox_gem_prime_unpin,
+    .gem_prime_get_sg_table = vbox_gem_prime_get_sg_table,
+    .gem_prime_import_sg_table = vbox_gem_prime_import_sg_table,
+    .gem_prime_vmap = vbox_gem_prime_vmap,
+    .gem_prime_vunmap = vbox_gem_prime_vunmap,
+    .gem_prime_mmap = vbox_gem_prime_mmap,
 
 };
 
Index: src/VBox/Additions/linux/drm/vbox_drv.h
===================================================================
--- src/VBox/Additions/linux/drm/vbox_drv.h	(revision 66114)
+++ src/VBox/Additions/linux/drm/vbox_drv.h	(working copy)
@@ -320,6 +320,18 @@
 int vbox_bo_push_sysram(struct vbox_bo *bo);
 int vbox_mmap(struct file *filp, struct vm_area_struct *vma);
 
+/*vbox_prime*/
+int vbox_gem_prime_pin(struct drm_gem_object *obj);
+void vbox_gem_prime_unpin(struct drm_gem_object *obj);
+struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj);
+struct drm_gem_object *vbox_gem_prime_import_sg_table(
+        struct drm_device *dev, struct dma_buf_attachment *attach,
+        struct sg_table *table);
+void *vbox_gem_prime_vmap(struct drm_gem_object *obj);
+void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
+int vbox_gem_prime_mmap(struct drm_gem_object *obj,
+        struct vm_area_struct *area);
+
 /* vbox_irq.c */
 int vbox_irq_init(struct vbox_private *vbox);
 void vbox_irq_fini(struct vbox_private *vbox);
Index: src/VBox/Additions/linux/drm/vbox_prime.c
===================================================================
--- src/VBox/Additions/linux/drm/vbox_prime.c	(nonexistent)
+++ src/VBox/Additions/linux/drm/vbox_prime.c	(working copy)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2017 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+
+ * Copyright 2017 Canonical
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Andreas Pokorny
+ */
+
+#include "vbox_drv.h"
+
+/* Based on qxl_prime.c:
+ * Empty Implementations as there should not be any other driver for a virtual
+ * device that might share buffers with vboxvideo */
+
+int vbox_gem_prime_pin(struct drm_gem_object *obj)
+{
+    WARN_ONCE(1, "not implemented");
+    return -ENOSYS;
+}
+
+void vbox_gem_prime_unpin(struct drm_gem_object *obj)
+{
+    WARN_ONCE(1, "not implemented");
+}
+
+
+struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj)
+{
+    WARN_ONCE(1, "not implemented");
+    return ERR_PTR(-ENOSYS);
+}
+
+struct drm_gem_object *vbox_gem_prime_import_sg_table(
+        struct drm_device *dev, struct dma_buf_attachment *attach,
+        struct sg_table *table)
+{
+    WARN_ONCE(1, "not implemented");
+    return ERR_PTR(-ENOSYS);
+}
+
+void *vbox_gem_prime_vmap(struct drm_gem_object *obj)
+{
+    WARN_ONCE(1, "not implemented");
+    return ERR_PTR(-ENOSYS);
+}
+
+void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
+{
+    WARN_ONCE(1, "not implemented");
+}
+
+int vbox_gem_prime_mmap(struct drm_gem_object *obj,
+        struct vm_area_struct *area)
+{
+    WARN_ONCE(1, "not implemented");
+    return -ENOSYS;
+}
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to