aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/vboxvideo
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-05 10:36:26 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-05 10:36:26 -0700
commitbf1d6b2c76eda86159519bf5c427b1fa8f51f733 (patch)
tree030fb04185223a03254aa1092750d9c1b819618c /drivers/staging/vboxvideo
parentMerge tag 'tty-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty (diff)
parentstaging:rtl8188eu:core Fix remove unneccessary else block (diff)
downloadlinux-dev-bf1d6b2c76eda86159519bf5c427b1fa8f51f733.tar.xz
linux-dev-bf1d6b2c76eda86159519bf5c427b1fa8f51f733.zip
Merge tag 'staging-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO driver updates from Greg KH: "Here is the big staging and IIO driver update for 4.14-rc1. Lots of staging driver fixes and cleanups, including some reorginizing of the lustre header files to try to impose some sanity on what is, and what is not, the uapi for that filesystem. There are some tty core changes in here as well, as the speakup drivers need them, and that's ok with me, they are sane and the speakup code is getting nicer because of it. There is also the addition of the obiligatory new wifi driver, just because it has been a release or two since we added our last one... Other than that, lots and lots of small coding style fixes, as usual. All of these have been in linux-next for a while with no reported issues" * tag 'staging-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (612 commits) staging:rtl8188eu:core Fix remove unneccessary else block staging: typec: fusb302: make structure fusb302_psy_desc static staging: unisys: visorbus: make two functions static staging: fsl-dpaa2/eth: fix off-by-one FD ctrl bitmaks staging: r8822be: Simplify deinit_priv() staging: r8822be: Remove some dead code staging: vboxvideo: Use CONFIG_DRM_KMS_FB_HELPER to check for fbdefio availability staging:rtl8188eu Fix comparison to NULL staging: rts5208: rename mmc_ddr_tunning_rx_cmd to mmc_ddr_tuning_rx_cmd Staging: Pi433: style fix - tabs and spaces staging: pi433: fix spelling mistake: "preample" -> "preamble" staging:rtl8188eu:core Fix Code Indent staging: typec: fusb302: Export current-limit through a power_supply class dev staging: typec: fusb302: Add support for USB2 charger detection through extcon staging: typec: fusb302: Use client->irq as irq if set staging: typec: fusb302: Get max snk mv/ma/mw from device-properties staging: typec: fusb302: Set max supply voltage to 5V staging: typec: tcpm: Add get_current_limit tcpc_dev callback staging:rtl8188eu Use __func__ instead of function name staging: lustre: coding style fixes found by checkpatch.pl ...
Diffstat (limited to 'drivers/staging/vboxvideo')
-rw-r--r--drivers/staging/vboxvideo/Kconfig11
-rw-r--r--drivers/staging/vboxvideo/TODO4
-rw-r--r--drivers/staging/vboxvideo/vbox_drv.c2
-rw-r--r--drivers/staging/vboxvideo/vbox_fb.c159
-rw-r--r--drivers/staging/vboxvideo/vbox_mode.c5
-rw-r--r--drivers/staging/vboxvideo/vbox_ttm.c2
6 files changed, 27 insertions, 156 deletions
diff --git a/drivers/staging/vboxvideo/Kconfig b/drivers/staging/vboxvideo/Kconfig
index a52746f9a670..1f4182e2e980 100644
--- a/drivers/staging/vboxvideo/Kconfig
+++ b/drivers/staging/vboxvideo/Kconfig
@@ -2,11 +2,14 @@ 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 builtin this module, it is advised
- to build this driver as a module, so that it can be updated
- independently of the kernel. Select M to built this driver as a
- module and add support for these devices via drm/kms interfaces.
+ 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.
diff --git a/drivers/staging/vboxvideo/TODO b/drivers/staging/vboxvideo/TODO
index ce764309b079..bd381d861ab3 100644
--- a/drivers/staging/vboxvideo/TODO
+++ b/drivers/staging/vboxvideo/TODO
@@ -5,5 +5,5 @@ TODO:
-Extend this TODO with the results of that review
Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
-Hans de Goede <hdegoede@redhat.com> and
-Michael Thayer <michael.thayer@oracle.com>.
+Hans de Goede <hdegoede@redhat.com>, Michael Thayer <michael.thayer@oracle.com>
+and dri-devel@lists.freedesktop.org .
diff --git a/drivers/staging/vboxvideo/vbox_drv.c b/drivers/staging/vboxvideo/vbox_drv.c
index 6d0600c37c0c..e18642e5027e 100644
--- a/drivers/staging/vboxvideo/vbox_drv.c
+++ b/drivers/staging/vboxvideo/vbox_drv.c
@@ -36,7 +36,7 @@
#include "vbox_drv.h"
-int vbox_modeset = -1;
+static int vbox_modeset = -1;
MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
module_param_named(modeset, vbox_modeset, int, 0400);
diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c
index c1572843003a..8aed248db6e2 100644
--- a/drivers/staging/vboxvideo/vbox_fb.c
+++ b/drivers/staging/vboxvideo/vbox_fb.c
@@ -45,144 +45,20 @@
#include "vbox_drv.h"
#include "vboxvideo.h"
-#define VBOX_DIRTY_DELAY (HZ / 30)
-/**
- * Tell the host about dirty rectangles to update.
- */
-static void vbox_dirty_update(struct vbox_fbdev *fbdev,
- int x, int y, int width, int height)
-{
- struct drm_gem_object *obj;
- struct vbox_bo *bo;
- int ret = -EBUSY;
- bool store_for_later = false;
- int x2, y2;
- unsigned long flags;
- struct drm_clip_rect rect;
-
- obj = fbdev->afb.obj;
- bo = gem_to_vbox_bo(obj);
-
- /*
- * try and reserve the BO, if we fail with busy
- * then the BO is being moved and we should
- * store up the damage until later.
- */
- if (drm_can_sleep())
- ret = vbox_bo_reserve(bo, true);
- if (ret) {
- if (ret != -EBUSY)
- return;
-
- store_for_later = true;
- }
-
- x2 = x + width - 1;
- y2 = y + height - 1;
- spin_lock_irqsave(&fbdev->dirty_lock, flags);
-
- if (fbdev->y1 < y)
- y = fbdev->y1;
- if (fbdev->y2 > y2)
- y2 = fbdev->y2;
- if (fbdev->x1 < x)
- x = fbdev->x1;
- if (fbdev->x2 > x2)
- x2 = fbdev->x2;
-
- if (store_for_later) {
- fbdev->x1 = x;
- fbdev->x2 = x2;
- fbdev->y1 = y;
- fbdev->y2 = y2;
- spin_unlock_irqrestore(&fbdev->dirty_lock, flags);
- return;
- }
-
- fbdev->x1 = INT_MAX;
- fbdev->y1 = INT_MAX;
- fbdev->x2 = 0;
- fbdev->y2 = 0;
-
- spin_unlock_irqrestore(&fbdev->dirty_lock, flags);
-
- /*
- * Not sure why the original code subtracted 1 here, but I will keep
- * it that way to avoid unnecessary differences.
- */
- rect.x1 = x;
- rect.x2 = x2 + 1;
- rect.y1 = y;
- rect.y2 = y2 + 1;
- vbox_framebuffer_dirty_rectangles(&fbdev->afb.base, &rect, 1);
-
- vbox_bo_unreserve(bo);
-}
-
-#ifdef CONFIG_FB_DEFERRED_IO
-static void vbox_deferred_io(struct fb_info *info, struct list_head *pagelist)
-{
- struct vbox_fbdev *fbdev = info->par;
- unsigned long start, end, min, max;
- struct page *page;
- int y1, y2;
-
- min = ULONG_MAX;
- max = 0;
- list_for_each_entry(page, pagelist, lru) {
- start = page->index << PAGE_SHIFT;
- end = start + PAGE_SIZE - 1;
- min = min(min, start);
- max = max(max, end);
- }
-
- if (min < max) {
- y1 = min / info->fix.line_length;
- y2 = (max / info->fix.line_length) + 1;
- DRM_INFO("%s: Calling dirty update: 0, %d, %d, %d\n",
- __func__, y1, info->var.xres, y2 - y1 - 1);
- vbox_dirty_update(fbdev, 0, y1, info->var.xres, y2 - y1 - 1);
- }
-}
-
+#ifdef CONFIG_DRM_KMS_FB_HELPER
static struct fb_deferred_io vbox_defio = {
- .delay = VBOX_DIRTY_DELAY,
- .deferred_io = vbox_deferred_io,
+ .delay = HZ / 30,
+ .deferred_io = drm_fb_helper_deferred_io,
};
#endif
-static void vbox_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
-{
- struct vbox_fbdev *fbdev = info->par;
-
- sys_fillrect(info, rect);
- vbox_dirty_update(fbdev, rect->dx, rect->dy, rect->width, rect->height);
-}
-
-static void vbox_copyarea(struct fb_info *info, const struct fb_copyarea *area)
-{
- struct vbox_fbdev *fbdev = info->par;
-
- sys_copyarea(info, area);
- vbox_dirty_update(fbdev, area->dx, area->dy, area->width, area->height);
-}
-
-static void vbox_imageblit(struct fb_info *info, const struct fb_image *image)
-{
- struct vbox_fbdev *fbdev = info->par;
-
- sys_imageblit(info, image);
- vbox_dirty_update(fbdev, image->dx, image->dy, image->width,
- image->height);
-}
-
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 = vbox_fillrect,
- .fb_copyarea = vbox_copyarea,
- .fb_imageblit = vbox_imageblit,
+ .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,
@@ -219,7 +95,6 @@ static int vboxfb_create(struct drm_fb_helper *helper,
struct DRM_MODE_FB_CMD mode_cmd;
struct drm_framebuffer *fb;
struct fb_info *info;
- struct device *device = &dev->pdev->dev;
struct drm_gem_object *gobj;
struct vbox_bo *bo;
int size, ret;
@@ -263,16 +138,16 @@ static int vboxfb_create(struct drm_fb_helper *helper,
return ret;
}
- info = framebuffer_alloc(0, device);
- if (!info)
- return -ENOMEM;
+ info = drm_fb_helper_alloc_fbi(helper);
+ if (IS_ERR(info))
+ return -PTR_ERR(info);
+
info->par = fbdev;
fbdev->size = size;
fb = &fbdev->afb.base;
fbdev->helper.fb = fb;
- fbdev->helper.fbdev = info;
strcpy(info->fix.id, "vboxdrmfb");
@@ -284,17 +159,10 @@ static int vboxfb_create(struct drm_fb_helper *helper,
FBINFO_MISC_ALWAYS_SETPAR;
info->fbops = &vboxfb_ops;
- ret = fb_alloc_cmap(&info->cmap, 256, 0);
- if (ret)
- return -ENOMEM;
-
/*
* This seems to be done for safety checking that the framebuffer
* is not registered twice by different drivers.
*/
- info->apertures = alloc_apertures(1);
- if (!info->apertures)
- return -ENOMEM;
info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
@@ -305,7 +173,7 @@ static int vboxfb_create(struct drm_fb_helper *helper,
info->screen_base = bo->kmap.virtual;
info->screen_size = size;
-#ifdef CONFIG_FB_DEFERRED_IO
+#ifdef CONFIG_DRM_KMS_FB_HELPER
info->fbdefio = &vbox_defio;
fb_deferred_io_init(info);
#endif
@@ -327,6 +195,11 @@ void vbox_fbdev_fini(struct drm_device *dev)
struct vbox_fbdev *fbdev = vbox->fbdev;
struct vbox_framebuffer *afb = &fbdev->afb;
+#ifdef CONFIG_DRM_KMS_FB_HELPER
+ if (fbdev->helper.fbdev && fbdev->helper.fbdev->fbdefio)
+ fb_deferred_io_cleanup(fbdev->helper.fbdev);
+#endif
+
drm_fb_helper_unregister_fbi(&fbdev->helper);
if (afb->obj) {
diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index e5b6383984e7..257a77830410 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -54,14 +54,12 @@ static void vbox_do_modeset(struct drm_crtc *crtc,
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct vbox_private *vbox;
int width, height, bpp, pitch;
- unsigned int crtc_id;
u16 flags;
s32 x_offset, y_offset;
vbox = crtc->dev->dev_private;
width = mode->hdisplay ? mode->hdisplay : 640;
height = mode->vdisplay ? mode->vdisplay : 480;
- crtc_id = vbox_crtc->crtc_id;
bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32;
pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;
x_offset = vbox->single_framebuffer ? crtc->x : vbox_crtc->x_hint;
@@ -573,9 +571,6 @@ static int vbox_mode_valid(struct drm_connector *connector,
static void vbox_connector_destroy(struct drm_connector *connector)
{
- struct vbox_connector *vbox_connector;
-
- vbox_connector = to_vbox_connector(connector);
drm_connector_unregister(connector);
drm_connector_cleanup(connector);
kfree(connector);
diff --git a/drivers/staging/vboxvideo/vbox_ttm.c b/drivers/staging/vboxvideo/vbox_ttm.c
index 34a905d40735..4eb410a2a1a8 100644
--- a/drivers/staging/vboxvideo/vbox_ttm.c
+++ b/drivers/staging/vboxvideo/vbox_ttm.c
@@ -230,7 +230,7 @@ static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
}
-struct ttm_bo_driver vbox_bo_driver = {
+static struct ttm_bo_driver vbox_bo_driver = {
.ttm_tt_create = vbox_ttm_tt_create,
.ttm_tt_populate = vbox_ttm_tt_populate,
.ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,