drm/vboxvideo: Move vboxvideo driver out of staging
Subsystems (4)
cover drm/vboxvideo: Move vboxvideo driver out of staging
Hi All,
Here is a patch wich adds a copy of the vboxvideo driver from staging (as it will look like after the cleanup series I just posted).
The purpose of posting this as a copy rather then a patch just moving the files is to give the DRM maintainers a chance to do a review before it gets merged. With would not be possible with a patch with only file renames in there.
I can post a patch doing the actual move / rename once the DRM maintainers are happy with the code in staging.
About a patch doing the actual move, Greg, any tips on how to merge that since it will be touching 2 trees and your staging tree will have the last round of cleanups I presume.
Regards,
Hans
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/vboxvideo: Move vboxvideo driver out of staging
Now that it has been converted to use atomic-modesetting and all other known issues have addressed too, the vboxvideo driver can be moved out of staging.
---
Note this commit only adds the driver to drivers/gpu/drm, it disables, but does not remove the old version in staging yet. I've done that this way since Daniel has indicated that he wanted to do a full review of the driver and if I just move the files the patch will not be very useful for reviewing.
--- MAINTAINERS | 6 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/vboxvideo/Kconfig | 15 + drivers/gpu/drm/vboxvideo/Makefile | 8 + drivers/gpu/drm/vboxvideo/hgsmi_base.c | 207 +++++ drivers/gpu/drm/vboxvideo/hgsmi_ch_setup.h | 32 + drivers/gpu/drm/vboxvideo/hgsmi_channels.h | 34 + drivers/gpu/drm/vboxvideo/hgsmi_defs.h | 73 ++ drivers/gpu/drm/vboxvideo/modesetting.c | 123 +++ drivers/gpu/drm/vboxvideo/vbox_drv.c | 280 ++++++ drivers/gpu/drm/vboxvideo/vbox_drv.h | 284 ++++++ drivers/gpu/drm/vboxvideo/vbox_fb.c | 166 ++++ drivers/gpu/drm/vboxvideo/vbox_hgsmi.c | 95 ++ drivers/gpu/drm/vboxvideo/vbox_irq.c | 177 ++++ drivers/gpu/drm/vboxvideo/vbox_main.c | 361 ++++++++ drivers/gpu/drm/vboxvideo/vbox_mode.c | 954 ++++++++++++++++++++ drivers/gpu/drm/vboxvideo/vbox_prime.c | 56 ++ drivers/gpu/drm/vboxvideo/vbox_ttm.c | 451 +++++++++ drivers/gpu/drm/vboxvideo/vboxvideo.h | 442 +++++++++ drivers/gpu/drm/vboxvideo/vboxvideo_guest.h | 61 ++ drivers/gpu/drm/vboxvideo/vboxvideo_vbe.h | 54 ++ drivers/gpu/drm/vboxvideo/vbva_base.c | 214 +++++ drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - 25 files changed, 4096 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/vboxvideo/Kconfig create mode 100644 drivers/gpu/drm/vboxvideo/Makefile create mode 100644 drivers/gpu/drm/vboxvideo/hgsmi_base.c create mode 100644 drivers/gpu/drm/vboxvideo/hgsmi_ch_setup.h create mode 100644 drivers/gpu/drm/vboxvideo/hgsmi_channels.h create mode 100644 drivers/gpu/drm/vboxvideo/hgsmi_defs.h create mode 100644 drivers/gpu/drm/vboxvideo/modesetting.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_drv.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_drv.h create mode 100644 drivers/gpu/drm/vboxvideo/vbox_fb.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_hgsmi.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_irq.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_main.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_mode.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_prime.c create mode 100644 drivers/gpu/drm/vboxvideo/vbox_ttm.c create mode 100644 drivers/gpu/drm/vboxvideo/vboxvideo.h create mode 100644 drivers/gpu/drm/vboxvideo/vboxvideo_guest.h create mode 100644 drivers/gpu/drm/vboxvideo/vboxvideo_vbe.h create mode 100644 drivers/gpu/drm/vboxvideo/vbva_base.c
MAINTAINERS +6 -0
@@ -15606,6 +15606,12 @@ S: Maintained F: drivers/virtio/virtio_input.c F: include/uapi/linux/virtio_input.h +VIRTUAL BOX DRM DRIVER +M: Hans de Goede <[email protected]> +L: [email protected] +S: Maintained +F: drivers/gpu/drm/vboxvideo/ + VIRTUAL BOX GUEST DEVICE DRIVER M: Hans de Goede <[email protected]> M: Arnd Bergmann <[email protected]>
drivers/gpu/drm/Kconfig +2 -0
@@ -315,6 +315,8 @@ source "drivers/gpu/drm/tve200/Kconfig" source "drivers/gpu/drm/xen/Kconfig" +source "drivers/gpu/drm/vboxvideo/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
@@ -107,3 +107,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ obj-$(CONFIG_DRM_PL111) += pl111/ obj-$(CONFIG_DRM_TVE200) += tve200/ obj-$(CONFIG_DRM_XEN) += xen/ +obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo/
drivers/gpu/drm/vboxvideo/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +config DRM_VBOXVIDEO + tristate "Virtual Box Graphics Card" + depends on DRM && X86 && PCI + select DRM_KMS_HELPER + select DRM_TTM + select GENERIC_ALLOCATOR + help + This is a KMS driver for the virtual Graphics Card used in + Virtual Box virtual machines. + + Although it is possible to build this driver built-in to the + kernel, it is advised to build it as a module, so that it can + be updated independently of the kernel. Select M to build this + driver as a module and add support for these devices via drm/kms + interfaces.
drivers/gpu/drm/vboxvideo/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +ccflags-y := -Iinclude/drm + +vboxvideo-y := hgsmi_base.o modesetting.o vbva_base.o \ + vbox_drv.o vbox_fb.o vbox_hgsmi.o vbox_irq.o vbox_main.o \ + vbox_mode.o vbox_prime.o vbox_ttm.o + +obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo.o
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +207 -0
207 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/hgsmi_ch_setup.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright (C) 2006-2017 Oracle Corporation */ + +#ifndef __HGSMI_CH_SETUP_H__ +#define __HGSMI_CH_SETUP_H__ + +/* +* Tell the host the location of hgsmi_host_flags structure, where the host +* can write information about pending buffers, etc, and which can be quickly +* polled by the guest without a need to port IO. +*/ +#define HGSMI_CC_HOST_FLAGS_LOCATION 0 + +struct hgsmi_buffer_location { +u32 buf_location; +u32 buf_len; +} __packed; + +/* HGSMI setup and configuration data structures. */ + +#define HGSMIHOSTFLAGS_COMMANDS_PENDING 0x01u +#define HGSMIHOSTFLAGS_IRQ 0x02u +#define HGSMIHOSTFLAGS_VSYNC 0x10u +#define HGSMIHOSTFLAGS_HOTPLUG 0x20u +#define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES 0x40u + +struct hgsmi_host_flags { +u32 host_flags; +u32 reserved[3 ]; +} __packed; + +#endif
drivers/gpu/drm/vboxvideo/hgsmi_channels.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright (C) 2006-2017 Oracle Corporation */ + +#ifndef __HGSMI_CHANNELS_H__ +#define __HGSMI_CHANNELS_H__ + +/* +* Each channel has an 8 bit identifier. There are a number of predefined +* (hardcoded) channels. +* +* HGSMI_CH_HGSMI channel can be used to map a string channel identifier +* to a free 16 bit numerical value. values are allocated in range +* [HGSMI_CH_STRING_FIRST;HGSMI_CH_STRING_LAST]. +*/ + +/* A reserved channel value */ +#define HGSMI_CH_RESERVED 0x00 +/* HGCMI: setup and configuration */ +#define HGSMI_CH_HGSMI 0x01 +/* Graphics: VBVA */ +#define HGSMI_CH_VBVA 0x02 +/* Graphics: Seamless with a single guest region */ +#define HGSMI_CH_SEAMLESS 0x03 +/* Graphics: Seamless with separate host windows */ +#define HGSMI_CH_SEAMLESS2 0x04 +/* Graphics: OpenGL HW acceleration */ +#define HGSMI_CH_OPENGL 0x05 + +/* The first channel index to be used for string mappings (inclusive) */ +#define HGSMI_CH_STRING_FIRST 0x20 +/* The last channel index for string mappings (inclusive) */ +#define HGSMI_CH_STRING_LAST 0xff + +#endif
drivers/gpu/drm/vboxvideo/hgsmi_defs.h new file +73 -0
73 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/modesetting.c new file +123 -0
123 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +280 -0
280 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_drv.h new file +284 -0
284 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +166 -0
166 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_hgsmi.c new file +95 -0
95 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_irq.c new file +177 -0
177 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_main.c new file +361 -0
361 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_mode.c new file +954 -0
954 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_prime.c new file +56 -0
56 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbox_ttm.c new file +451 -0
111 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vboxvideo.h new file +442 -0
442 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vboxvideo_guest.h new file +61 -0
61 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vboxvideo_vbe.h new file +54 -0
54 lines not on this page · raw message
drivers/gpu/drm/vboxvideo/vbva_base.c new file +214 -0
214 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.19.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Part of the diff is not shown here. View the raw message.
Hi Hans.
Just a bunch of random observations that I hope you find use of.
Sam
Quoted 18 lines
drivers/gpu/drm/Kconfig +2
-0@@ -315,6 +315,8 @@ source "drivers/gpu/drm/tve200/Kconfig" source "drivers/gpu/drm/xen/Kconfig" +source "drivers/gpu/drm/vboxvideo/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACYdrivers/gpu/drm/Makefile +0
-0
drivers/gpu/drm/Makefile obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ · line 110
Quoted 4 lines
drivers/gpu/drm/Makefile +1
-0@@ -107,3 +107,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ obj-$(CONFIG_DRM_PL111) += pl111/ obj-$(CONFIG_DRM_TVE200) += tve200/ obj-$(CONFIG_DRM_XEN) += xen/ +obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo/
Is it the most logical place to add this in the end? You are asking for merge problems if you do so, but then the drm drivers does not seem to follow any good order so this may be fine.
drivers/gpu/drm/Makefile line 2
Quoted 4 lines
+++ b/drivers/gpu/drm/vboxvideo/Makefile
drivers/gpu/drm/Makefile +2
-0@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +ccflags-y := -Iinclude/drm
This should not be required.
If required then fix the offending #include
Quoted 12 lines
drivers/gpu/drm/Makefile +6
-0+ +vboxvideo-y := hgsmi_base.o modesetting.o vbva_base.o \ + vbox_drv.o vbox_fb.o vbox_hgsmi.o vbox_irq.o vbox_main.o \ + vbox_mode.o vbox_prime.o vbox_ttm.o + +obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo.odrivers/gpu/drm/vboxvideo/hgsmi_base.c new file +0
-0
drivers/gpu/drm/vboxvideo/hgsmi_base.c line 2
Quoted 2 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +2
-0@@ -0,0 +1,207 @@ +// SPDX-License-Identifier: MIT +/* Copyright (C) 2006-2017 Oracle Corporation */
2018?
General comment for all files.
drivers/gpu/drm/vboxvideo/hgsmi_base.c line 5
Quoted 3 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +3
-0+union { +/* Opaque placeholder to make the union 8 bytes. */ +u8 header_data[8 ];
Further down you have 2 x u32, so the union is guaranteed to be 64 bits. So header_data is redundant.
Quoted 16 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +6
-0+ +/* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */ +struct { +u32 reserved1;/* A reserved field, initialize to 0. */ +u32 reserved2;/* A reserved field, initialize to 0. */ + } buffer;drivers/gpu/drm/vboxvideo/vbox_drv.c new file +4
-0@@ -0,0 +1,280 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright (C) 2013-2017 Oracle Corporation +* This file is based on ast_drv.c
drivers/gpu/drm/vboxvideo/vbox_drv.c line 14
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +10
-0+* Copyright 2012 Red Hat Inc. +* Authors: Dave Airlie <[email protected]> +* Michael Thayer <[email protected], +* Hans de Goede <[email protected]> +*/ +#include <linux/module.h> +#include <linux/console.h> +#include <linux/vt_kern.h> + +#include <drm/drmP.h>
We are trying to get rid of drmP - replace with more specific includes. Goes for all uses of drmP.h
drivers/gpu/drm/vboxvideo/vbox_drv.c line 29
Quoted 12 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +12
-0+ +static int vbox_modeset =-1 ; + +MODULE_PARM_DESC (modeset,"Disable/Enable modesetting" ); +module_param_named (modeset, vbox_modeset, int,0400 ); + +static struct drm_driver driver; + +static const struct pci_device_id pciidlist[] = { + {0x80ee ,0xbeef ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, + {0 ,0 ,0 }, +};
Use PCI_DEVICE()?
Quoted 59 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +59
-0+static int vbox_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) +{ +struct vbox_private *vbox; +int ret =0 ; + +if (!vbox_check_supported (VBE_DISPI_ID_HGSMI )) +return -ENODEV ; + + vbox =kzalloc (sizeof (*vbox),GFP_KERNEL ); +if (!vbox) +return -ENOMEM ; + + ret =drm_dev_init (&vbox->ddev, &driver, &pdev->dev); +if (ret) { +kfree (vbox); +return ret; + } + + vbox->ddev.pdev = pdev; + vbox->ddev.dev_private = vbox; +pci_set_drvdata (pdev, vbox); +mutex_init (&vbox->hw_mutex); + + ret =pci_enable_device (pdev); +if (ret) + goto err_dev_put; + + ret =vbox_hw_init (vbox); +if (ret) + goto err_pci_disable; + + ret =vbox_mm_init (vbox); +if (ret) + goto err_hw_fini; + + ret =vbox_mode_init (vbox); +if (ret) + goto err_mm_fini; + + ret =vbox_irq_init (vbox); +if (ret) + goto err_mode_fini; + + ret =drm_fb_helper_fbdev_setup (&vbox->ddev, &vbox->fb_helper, + &vbox_fb_helper_funcs,32 , + vbox->num_crtcs); +if (ret) + goto err_irq_fini; + + ret =drm_dev_register (&vbox->ddev,0 ); +if (ret) + goto err_fbdev_fini; + +return 0 ; + +err_fbdev_fini: +vbox_fbdev_fini (vbox); +err_irq_fini: +vbox_irq_fini (vbox);
drivers/gpu/drm/vboxvideo/vbox_drv.c line 104
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +10
-0+err_mode_fini: +vbox_mode_fini (vbox); +err_mm_fini: +vbox_mm_fini (vbox); +err_hw_fini: +vbox_hw_fini (vbox); +err_pci_disable: +pci_disable_device (pdev); +err_dev_put: +drm_dev_put (&vbox->ddev);
kfree(vbox) missing?
Quoted 49 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +49
-0+return ret; +} + + +static int vbox_pm_suspend (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); +int error; + + error =drm_mode_config_helper_suspend (&vbox->ddev); +if (error) +return error; + +pci_save_state (vbox->ddev.pdev); +pci_disable_device (vbox->ddev.pdev); +pci_set_power_state (vbox->ddev.pdev, PCI_D3hot); + +return 0 ; +} + +static int vbox_pm_resume (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +if (pci_enable_device (vbox->ddev.pdev)) +return -EIO ; + +return drm_mode_config_helper_resume (&vbox->ddev); +} + +static int vbox_pm_freeze (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +return drm_mode_config_helper_suspend (&vbox->ddev); +} + +static int vbox_pm_thaw (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +return drm_mode_config_helper_resume (&vbox->ddev); +} + +static int vbox_pm_poweroff (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +return drm_mode_config_helper_suspend (&vbox->ddev);
drivers/gpu/drm/vboxvideo/vbox_drv.c line 175
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +10
-0+} + +static const struct dev_pm_ops vbox_pm_ops = { + .suspend = vbox_pm_suspend, + .resume = vbox_pm_resume, + .freeze = vbox_pm_freeze, + .thaw = vbox_pm_thaw, + .poweroff = vbox_pm_poweroff, + .restore = vbox_pm_resume, +};
Should all this be inside #ifdef CONFIG_PM_SLEEP?
Quoted 9 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +9
-0+ +static struct pci_driver vbox_pci_driver = { + .name =DRIVER_NAME , + .id_table = pciidlist, + .probe = vbox_pci_probe, + .remove = vbox_pci_remove, + .driver.pm = &vbox_pm_ops, +}; +
drivers/gpu/drm/vboxvideo/vbox_drv.c line 194
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +10
-0+static const struct file_operations vbox_fops = { + .owner =THIS_MODULE , + .open = drm_open, + .release = drm_release, + .unlocked_ioctl = drm_ioctl, + .mmap = vbox_mmap, + .poll = drm_poll, +#ifdef CONFIG_COMPAT + .compat_ioctl = drm_compat_ioctl, +#endif
The ifdef is not needed. See drm_ioctl.h
drivers/gpu/drm/vboxvideo/vbox_drv.c line 278
Quoted 2 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +2
-0+ +MODULE_AUTHOR ("Oracle Corporation" );
Add yourself?
Quoted 14 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +2
-0+MODULE_DESCRIPTION (DRIVER_DESC ); +MODULE_LICENSE ("GPL and additional rights" );drivers/gpu/drm/vboxvideo/vbox_drv.h +9
-0+/* Must be first; or we must define our own release callback */ +struct drm_device ddev; +struct drm_fb_helper fb_helper; +struct vbox_framebuffer afb; + +u8 __iomem *guest_heap; +u8 __iomem *vbva_buffers; +struct gen_pool *guest_pool; +struct vbva_buf_ctx *vbva_info;
drivers/gpu/drm/vboxvideo/vbox_drv.h line 79
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +10
-0+bool any_pitch; +u32 num_crtcs; +/* Amount of available VRAM, including space used for buffers. */ +u32 full_vram_size; +/* Amount of available VRAM, not including space used for buffers. */ +u32 available_vram_size; +/* Array of structures for receiving mode hints. */ +struct vbva_modehint *last_mode_hints; + +int fb_mtrr;
This member is only used to:vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
+ pci_resource_len(dev->pdev, 0));
and laterarch_phys_wc_del(vbox->fb_mtrr);
And is not used for anything else.
Looks like some left-over that can be dropped.
Quoted 17 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +17
-0+ +struct { +struct drm_global_reference mem_global_ref; +struct ttm_bo_global_ref bo_global_ref; +struct ttm_bo_device bdev; + } ttm; + +struct mutex hw_mutex;/* protects modeset and accel/vbva accesses */ +/* +* We decide whether or not user-space supports display hot-plug +* depending on whether they react to a hot-plug event after the initial +* mode query. +*/ +bool initial_mode_queried; +struct work_struct hotplug_work; +u32 input_mapping_width; +u32 input_mapping_height;
drivers/gpu/drm/vboxvideo/vbox_drv.h line 106
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +10
-0+/* +* Is user-space using an X.Org-style layout of one large frame-buffer +* encompassing all screen ones or is the fbdev console active? +*/ +bool single_framebuffer; +u8 cursor_data[CURSOR_DATA_SIZE ]; +}; + +#undef CURSOR_PIXEL_COUNT +#undef CURSOR_DATA_SIZE
Why these and not the others?
Quoted 14 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +14
-0+*/ +u32 width; +u32 height; +u32 x; +u32 y; +}; + +struct vbox_encoder { +struct drm_encoder base; +}; + +#define to_vbox_crtc (x) container_of(x, struct vbox_crtc, base) +#define to_vbox_connector (x) container_of(x, struct vbox_connector, base) +#define to_vbox_encoder (x) container_of(x, struct vbox_encoder, base)
drivers/gpu/drm/vboxvideo/vbox_drv.h line 167
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +10
-0+#define to_vbox_framebuffer (x) container_of(x, struct vbox_framebuffer, base) + +bool vbox_check_supported (u16 id); +int vbox_hw_init (struct vbox_private *vbox); +void vbox_hw_fini (struct vbox_private *vbox); + +int vbox_mode_init (struct vbox_private *vbox); +void vbox_mode_fini (struct vbox_private *vbox); + +#define DRM_MODE_FB_CMD drm_mode_fb_cmd2
This define looks like letfover from something old. Drop it and spell out the type.
Quoted 43 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +37
-0@@ -0,0 +1,166 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright (C) 2013-2017 Oracle Corporation +* This file is based on ast_fb.c +* Copyright 2012 Red Hat Inc. +* Authors: Dave Airlie <[email protected]> +* Michael Thayer <[email protected], +*/ +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <linux/tty.h> +#include <linux/sysrq.h> +#include <linux/delay.h> +#include <linux/fb.h> +#include <linux/init.h> + +#include <drm/drmP.h> +#include <drm/drm_crtc.h> +#include <drm/drm_fb_helper.h> +#include <drm/drm_crtc_helper.h> + +#include "vbox_drv.h" +#include "vboxvideo.h" + +#ifdef CONFIG_DRM_KMS_FB_HELPER +static struct fb_deferred_io vbox_defio = { + .delay =HZ /30 , + .deferred_io = drm_fb_helper_deferred_io, +}; +#endif + +static struct fb_ops vboxfb_ops = { + .owner =THIS_MODULE , + .fb_check_var = drm_fb_helper_check_var,
drivers/gpu/drm/vboxvideo/vbox_fb.c line 47
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +10
-0+ .fb_set_par = drm_fb_helper_set_par, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, + .fb_pan_display = drm_fb_helper_pan_display, + .fb_blank = drm_fb_helper_blank, + .fb_setcmap = drm_fb_helper_setcmap, + .fb_debug_enter = drm_fb_helper_debug_enter, + .fb_debug_leave = drm_fb_helper_debug_leave, +};
Use DRM_FB_HELPER_DEFAULT_OPS?
Quoted 11 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +11
-0+ +static struct vbox_crtc *vbox_crtc_init (struct drm_device *dev,unsigned int i) +{ +struct vbox_private *vbox = + container_of(dev, struct vbox_private, ddev); +struct drm_plane *cursor =NULL ; +struct vbox_crtc *vbox_crtc; +struct drm_plane *primary; +u32 caps =0 ; +int ret; +
...
drivers/gpu/drm/vboxvideo/vbox_fb.c
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +5
-0+ primary =vbox_create_plane (vbox,1 << i,DRM_PLANE_TYPE_PRIMARY ); +if (IS_ERR (primary)) { + ret =PTR_ERR (primary); + goto free_mem; + }
primary is a pointer, so it is wrong to use PTR_ERR() on a pointer. This will just cast this to a long that again is casted to a pointer.
It would be simpler to declare ret a void * to PTR_ERR();
Quoted 26 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +26
-0+ +if ((caps &VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE )) { + cursor =vbox_create_plane (vbox,1 << i,DRM_PLANE_TYPE_CURSOR ); +if (IS_ERR (cursor)) { + ret =PTR_ERR (cursor); + goto clean_primary; + } + }else { +DRM_WARN ("VirtualBox host is too old, no cursor support\n" ); + } + + vbox_crtc->crtc_id = i; + + ret =drm_crtc_init_with_planes (dev, &vbox_crtc->base, primary, cursor, + &vbox_crtc_funcs,NULL ); +if (ret) + goto clean_cursor; + +drm_mode_crtc_set_gamma_size (&vbox_crtc->base,256 ); +drm_crtc_helper_add (&vbox_crtc->base, &vbox_crtc_helper_funcs); + +return vbox_crtc; + +clean_cursor: +if (cursor) { +drm_plane_cleanup (cursor);
drivers/gpu/drm/vboxvideo/vbox_fb.c
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +10
-0+kfree (cursor); + } +clean_primary: +drm_plane_cleanup (primary); +kfree (primary); +free_mem: +kfree (vbox_crtc); +return ERR_PTR (ret); +} +
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Thank you for the review.
Quoted 18 lines · Sam Ravnborg
Hi Hans.
Just a bunch of random observations that I hope you find use of.
Sam
Quoted 12 lines
drivers/gpu/drm/Kconfig +2
-0@@ -315,6 +315,8 @@ source "drivers/gpu/drm/tve200/Kconfig" source "drivers/gpu/drm/xen/Kconfig" +source "drivers/gpu/drm/vboxvideo/Kconfig" + # Keep legacy drivers last
Quoted 15 lines
drivers/gpu/drm/Makefile obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ · line 110
Quoted 10 lines
drivers/gpu/drm/Kconfig +0
-0menuconfig DRM_LEGACYdrivers/gpu/drm/Makefile +1
-0@@ -107,3 +107,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ obj-$(CONFIG_DRM_PL111) += pl111/ obj-$(CONFIG_DRM_TVE200) += tve200/ obj-$(CONFIG_DRM_XEN) += xen/ +obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo/Is it the most logical place to add this in the end? You are asking for merge problems if you do so, but then the drm drivers does not seem to follow any good order so this may be fine.
Right, just tagging the entry to the end seems to be what all new driver additions do, so I'm just following that example here.
Quoted 6 lines
drivers/gpu/drm/Makefile line 2
Quoted 4 lines
+++ b/drivers/gpu/drm/vboxvideo/Makefile
drivers/gpu/drm/Makefile +2
-0@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +ccflags-y := -Iinclude/drmThis should not be required.
If required then fix the offending #include
Fixed in the set of cleanup patches which I'm sending out after this email.
Note these cleanup patches apply to the staging version of the driver, I will do a new version of this patch after someone has found the time to do a more thorough review.
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/Makefile +6
-0+ +vboxvideo-y := hgsmi_base.o modesetting.o vbva_base.o \ + vbox_drv.o vbox_fb.o vbox_hgsmi.o vbox_irq.o vbox_main.o \ + vbox_mode.o vbox_prime.o vbox_ttm.o + +obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo.odrivers/gpu/drm/vboxvideo/hgsmi_base.c new file +0
-0
Quoted 8 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c line 2
Quoted 6 lines
index 000000000000..361d3193258e
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +2
-0@@ -0,0 +1,207 @@ +// SPDX-License-Identifier: MIT +/* Copyright (C) 2006-2017 Oracle Corporation */ 2018?
General comment for all files.
I do not work for Oracle, so its not up to me to extend the copyright claim.
Quoted 6 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c line 5
Quoted 4 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +3
-0+union { +/* Opaque placeholder to make the union 8 bytes. */ +u8 header_data[8 ];Further down you have 2 x u32, so the union is guaranteed to be 64 bits. So
header_datais redundant.
The header_data member is used in the code.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/vboxvideo/hgsmi_base.c new file +6
-0+ +/* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */ +struct { +u32 reserved1;/* A reserved field, initialize to 0. */ +u32 reserved2;/* A reserved field, initialize to 0. */ + } buffer;drivers/gpu/drm/vboxvideo/vbox_drv.c new file +8
-0@@ -0,0 +1,280 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright (C) 2013-2017 Oracle Corporation +* This file is based on ast_drv.c +* Copyright 2012 Red Hat Inc. +* Authors: Dave Airlie <[email protected]> +* Michael Thayer <[email protected], +* Hans de Goede <[email protected]>
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c line 14
Quoted 6 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +6
-0+*/ +#include <linux/module.h> +#include <linux/console.h> +#include <linux/vt_kern.h> + +#include <drm/drmP.h> We are trying to get rid of drmP - replace with more specific includes. Goes for all uses of
drmP.h
Fixed in the cleanup series.
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +5
-0+ +static int vbox_modeset =-1 ; + +MODULE_PARM_DESC (modeset,"Disable/Enable modesetting" ); +module_param_named (modeset, vbox_modeset, int,0400 );
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c line 29
Quoted 7 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +7
-0+ +static struct drm_driver driver; + +static const struct pci_device_id pciidlist[] = { + {0x80ee ,0xbeef ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, + {0 ,0 ,0 }, +};Use
PCI_DEVICE()?
Ack, fixed in the cleanup series.
Quoted 63 lines
Quoted 63 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +63
-0+static int vbox_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) +{ +struct vbox_private *vbox; +int ret =0 ; + +if (!vbox_check_supported (VBE_DISPI_ID_HGSMI )) +return -ENODEV ; + + vbox =kzalloc (sizeof (*vbox),GFP_KERNEL ); +if (!vbox) +return -ENOMEM ; + + ret =drm_dev_init (&vbox->ddev, &driver, &pdev->dev); +if (ret) { +kfree (vbox); +return ret; + } + + vbox->ddev.pdev = pdev; + vbox->ddev.dev_private = vbox; +pci_set_drvdata (pdev, vbox); +mutex_init (&vbox->hw_mutex); + + ret =pci_enable_device (pdev); +if (ret) + goto err_dev_put; + + ret =vbox_hw_init (vbox); +if (ret) + goto err_pci_disable; + + ret =vbox_mm_init (vbox); +if (ret) + goto err_hw_fini; + + ret =vbox_mode_init (vbox); +if (ret) + goto err_mm_fini; + + ret =vbox_irq_init (vbox); +if (ret) + goto err_mode_fini; + + ret =drm_fb_helper_fbdev_setup (&vbox->ddev, &vbox->fb_helper, + &vbox_fb_helper_funcs,32 , + vbox->num_crtcs); +if (ret) + goto err_irq_fini; + + ret =drm_dev_register (&vbox->ddev,0 ); +if (ret) + goto err_fbdev_fini; + +return 0 ; + +err_fbdev_fini: +vbox_fbdev_fini (vbox); +err_irq_fini: +vbox_irq_fini (vbox); +err_mode_fini: +vbox_mode_fini (vbox); +err_mm_fini: +vbox_mm_fini (vbox);
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c line 104
Quoted 6 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +6
-0+err_hw_fini: +vbox_hw_fini (vbox); +err_pci_disable: +pci_disable_device (pdev); +err_dev_put: +drm_dev_put (&vbox->ddev);kfree(vbox) missing?
No, we do not define a release callback in our drm_driver (ops) struct, so drm_dev_release() from drivers/gpu/drm/drm_drv.c, which gets called on the last drm_dev_put, will call kfree() on our embedded struct drm_device, also see the definition of the vbox_private struct, which has:
struct vbox_private {
/* Must be first; or we must define our own release callback */
struct drm_device ddev;This is a standard way of doing this for drm drivers.
Quoted 52 lines
Quoted 52 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +52
-0+return ret; +} + + +static int vbox_pm_suspend (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); +int error; + + error =drm_mode_config_helper_suspend (&vbox->ddev); +if (error) +return error; + +pci_save_state (vbox->ddev.pdev); +pci_disable_device (vbox->ddev.pdev); +pci_set_power_state (vbox->ddev.pdev, PCI_D3hot); + +return 0 ; +} + +static int vbox_pm_resume (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +if (pci_enable_device (vbox->ddev.pdev)) +return -EIO ; + +return drm_mode_config_helper_resume (&vbox->ddev); +} + +static int vbox_pm_freeze (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +return drm_mode_config_helper_suspend (&vbox->ddev); +} + +static int vbox_pm_thaw (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +return drm_mode_config_helper_resume (&vbox->ddev); +} + +static int vbox_pm_poweroff (struct device *dev) +{ +struct vbox_private *vbox =dev_get_drvdata (dev); + +return drm_mode_config_helper_suspend (&vbox->ddev); +} + +static const struct dev_pm_ops vbox_pm_ops = {
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c line 175
Quoted 7 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +7
-0+ .suspend = vbox_pm_suspend, + .resume = vbox_pm_resume, + .freeze = vbox_pm_freeze, + .thaw = vbox_pm_thaw, + .poweroff = vbox_pm_poweroff, + .restore = vbox_pm_resume, +};Should all this be inside #ifdef
CONFIG_PM_SLEEP?
Yes your right, will fix in the cleanup series.
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +13
-0+ +static struct pci_driver vbox_pci_driver = { + .name =DRIVER_NAME , + .id_table = pciidlist, + .probe = vbox_pci_probe, + .remove = vbox_pci_remove, + .driver.pm = &vbox_pm_ops, +}; + +static const struct file_operations vbox_fops = { + .owner =THIS_MODULE , + .open = drm_open, + .release = drm_release,
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c line 194
Quoted 6 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +6
-0+ .unlocked_ioctl = drm_ioctl, + .mmap = vbox_mmap, + .poll = drm_poll, +#ifdef CONFIG_COMPAT + .compat_ioctl = drm_compat_ioctl, +#endif The ifdef is not needed. See
drm_ioctl.h
Ack, fixed.
Quoted 3 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c line 278
Quoted 2 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +2
-0+ +MODULE_AUTHOR ("Oracle Corporation" );Add yourself?
Yes good idea, done.
Quoted 29 lines
Quoted 14 lines
drivers/gpu/drm/vboxvideo/vbox_drv.c new file +2
-0+MODULE_DESCRIPTION (DRIVER_DESC ); +MODULE_LICENSE ("GPL and additional rights" );drivers/gpu/drm/vboxvideo/vbox_drv.h +9
-0+/* Must be first; or we must define our own release callback */ +struct drm_device ddev; +struct drm_fb_helper fb_helper; +struct vbox_framebuffer afb; + +u8 __iomem *guest_heap; +u8 __iomem *vbva_buffers; +struct gen_pool *guest_pool; +struct vbva_buf_ctx *vbva_info;drivers/gpu/drm/vboxvideo/vbox_drv.h line 79
Quoted 10 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +10
-0+bool any_pitch; +u32 num_crtcs; +/* Amount of available VRAM, including space used for buffers. */ +u32 full_vram_size; +/* Amount of available VRAM, not including space used for buffers. */ +u32 available_vram_size; +/* Array of structures for receiving mode hints. */ +struct vbva_modehint *last_mode_hints; + +int fb_mtrr;This member is only used to:
vbox->fb_mtrr= arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
+pci_resource_len(dev->pdev, 0));
Quoted 5 lines
and later
arch_phys_wc_del(vbox->fb_mtrr);And is not used for anything else.
Looks like some left-over that can be dropped.
This sets up the MTRR registers to set the cache-policy for the video-mem to write-combined, see:
https://www.kernel.org/doc/htmldocs/kernel-api/API-arch-phys-wc-add.html
If you look under drivers/gpu/drm you will so more drivers doing this.
The return value not being used for anything but cleanup is normal.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +20
-0+ +struct { +struct drm_global_reference mem_global_ref; +struct ttm_bo_global_ref bo_global_ref; +struct ttm_bo_device bdev; + } ttm; + +struct mutex hw_mutex;/* protects modeset and accel/vbva accesses */ +/* +* We decide whether or not user-space supports display hot-plug +* depending on whether they react to a hot-plug event after the initial +* mode query. +*/ +bool initial_mode_queried; +struct work_struct hotplug_work; +u32 input_mapping_width; +u32 input_mapping_height; +/* +* Is user-space using an X.Org-style layout of one large frame-buffer +* encompassing all screen ones or is the fbdev console active?
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h line 106
Quoted 7 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +7
-0+*/ +bool single_framebuffer; +u8 cursor_data[CURSOR_DATA_SIZE ]; +}; + +#undef CURSOR_PIXEL_COUNT +#undef CURSOR_DATA_SIZEWhy these and not the others?
Because these are only intended to determine the size of the cursor_data member and not intended for use in the driver code.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +19
-0+*/ +u32 width; +u32 height; +u32 x; +u32 y; +}; + +struct vbox_encoder { +struct drm_encoder base; +}; + +#define to_vbox_crtc (x) container_of(x, struct vbox_crtc, base) +#define to_vbox_connector (x) container_of(x, struct vbox_connector, base) +#define to_vbox_encoder (x) container_of(x, struct vbox_encoder, base) +#define to_vbox_framebuffer (x) container_of(x, struct vbox_framebuffer, base) + +bool vbox_check_supported (u16 id); +int vbox_hw_init (struct vbox_private *vbox); +void vbox_hw_fini (struct vbox_private *vbox);
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h line 167
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_drv.h +5
-0+ +int vbox_mode_init (struct vbox_private *vbox); +void vbox_mode_fini (struct vbox_private *vbox); + +#define DRM_MODE_FB_CMD drm_mode_fb_cmd2This define looks like letfover from something old. Drop it and spell out the type.
Ack, fixed.
Quoted 47 lines
Quoted 47 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +40
-0@@ -0,0 +1,166 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright (C) 2013-2017 Oracle Corporation +* This file is based on ast_fb.c +* Copyright 2012 Red Hat Inc. +* Authors: Dave Airlie <[email protected]> +* Michael Thayer <[email protected], +*/ +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <linux/tty.h> +#include <linux/sysrq.h> +#include <linux/delay.h> +#include <linux/fb.h> +#include <linux/init.h> + +#include <drm/drmP.h> +#include <drm/drm_crtc.h> +#include <drm/drm_fb_helper.h> +#include <drm/drm_crtc_helper.h> + +#include "vbox_drv.h" +#include "vboxvideo.h" + +#ifdef CONFIG_DRM_KMS_FB_HELPER +static struct fb_deferred_io vbox_defio = { + .delay =HZ /30 , + .deferred_io = drm_fb_helper_deferred_io, +}; +#endif + +static struct fb_ops vboxfb_ops = { + .owner =THIS_MODULE , + .fb_check_var = drm_fb_helper_check_var, + .fb_set_par = drm_fb_helper_set_par, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea,
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c line 47
Quoted 7 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +7
-0+ .fb_imageblit = drm_fb_helper_sys_imageblit, + .fb_pan_display = drm_fb_helper_pan_display, + .fb_blank = drm_fb_helper_blank, + .fb_setcmap = drm_fb_helper_setcmap, + .fb_debug_enter = drm_fb_helper_debug_enter, + .fb_debug_leave = drm_fb_helper_debug_leave, +};Use
DRM_FB_HELPER_DEFAULT_OPS?
Yes good, idea, done.
Quoted 14 lines
Quoted 12 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +11
-0+ +static struct vbox_crtc *vbox_crtc_init (struct drm_device *dev,unsigned int i) +{ +struct vbox_private *vbox = + container_of(dev, struct vbox_private, ddev); +struct drm_plane *cursor =NULL ; +struct vbox_crtc *vbox_crtc; +struct drm_plane *primary; +u32 caps =0 ; +int ret; +...
Quoted 6 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c
Quoted 5 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +5
-0+ primary =vbox_create_plane (vbox,1 << i,DRM_PLANE_TYPE_PRIMARY ); +if (IS_ERR (primary)) { + ret =PTR_ERR (primary); + goto free_mem; + }primary is a pointer, so it is wrong to use
PTR_ERR()on a pointer.
PTR_ERR stands for pointer to error and ret is an int, so this is fine.
Quoted 33 lines
This will just cast this to a long that again is casted to a pointer.
It would be simpler to declare ret a void * to
PTR_ERR();Quoted 28 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +28
-0+ +if ((caps &VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE )) { + cursor =vbox_create_plane (vbox,1 << i,DRM_PLANE_TYPE_CURSOR ); +if (IS_ERR (cursor)) { + ret =PTR_ERR (cursor); + goto clean_primary; + } + }else { +DRM_WARN ("VirtualBox host is too old, no cursor support\n" ); + } + + vbox_crtc->crtc_id = i; + + ret =drm_crtc_init_with_planes (dev, &vbox_crtc->base, primary, cursor, + &vbox_crtc_funcs,NULL ); +if (ret) + goto clean_cursor; + +drm_mode_crtc_set_gamma_size (&vbox_crtc->base,256 ); +drm_crtc_helper_add (&vbox_crtc->base, &vbox_crtc_helper_funcs); + +return vbox_crtc; + +clean_cursor: +if (cursor) { +drm_plane_cleanup (cursor); +kfree (cursor); + }
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c
Quoted 8 lines
drivers/gpu/drm/vboxvideo/vbox_fb.c new file +8
-0+clean_primary: +drm_plane_cleanup (primary); +kfree (primary); +free_mem: +kfree (vbox_crtc); +return ERR_PTR (ret); +} +
Regards,
Hans
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel