drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
/*
|
|
|
|
* Copyright © 2013 Red Hat
|
|
|
|
*
|
|
|
|
* 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 (including the next
|
|
|
|
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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:
|
|
|
|
* David Airlie
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
|
|
#include "drmP.h"
|
|
|
|
#include "drm/drm.h"
|
|
|
|
#include "drm/drm_crtc.h"
|
|
|
|
#include "drm/drm_crtc_helper.h"
|
|
|
|
#include "qxl_drv.h"
|
|
|
|
|
|
|
|
#include "qxl_object.h"
|
|
|
|
#include "drm_fb_helper.h"
|
|
|
|
|
|
|
|
#define QXL_DIRTY_DELAY (HZ / 30)
|
|
|
|
|
|
|
|
struct qxl_fbdev {
|
|
|
|
struct drm_fb_helper helper;
|
|
|
|
struct qxl_framebuffer qfb;
|
|
|
|
struct qxl_device *qdev;
|
|
|
|
|
2013-07-22 11:37:39 +07:00
|
|
|
spinlock_t delayed_ops_lock;
|
|
|
|
struct list_head delayed_ops;
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
void *shadow;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void qxl_fb_image_init(struct qxl_fb_image *qxl_fb_image,
|
|
|
|
struct qxl_device *qdev, struct fb_info *info,
|
|
|
|
const struct fb_image *image)
|
|
|
|
{
|
|
|
|
qxl_fb_image->qdev = qdev;
|
|
|
|
if (info) {
|
|
|
|
qxl_fb_image->visual = info->fix.visual;
|
|
|
|
if (qxl_fb_image->visual == FB_VISUAL_TRUECOLOR ||
|
|
|
|
qxl_fb_image->visual == FB_VISUAL_DIRECTCOLOR)
|
|
|
|
memcpy(&qxl_fb_image->pseudo_palette,
|
|
|
|
info->pseudo_palette,
|
|
|
|
sizeof(qxl_fb_image->pseudo_palette));
|
|
|
|
} else {
|
|
|
|
/* fallback */
|
|
|
|
if (image->depth == 1)
|
|
|
|
qxl_fb_image->visual = FB_VISUAL_MONO10;
|
|
|
|
else
|
|
|
|
qxl_fb_image->visual = FB_VISUAL_DIRECTCOLOR;
|
|
|
|
}
|
|
|
|
if (image) {
|
|
|
|
memcpy(&qxl_fb_image->fb_image, image,
|
|
|
|
sizeof(qxl_fb_image->fb_image));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-10 23:52:38 +07:00
|
|
|
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
2013-04-16 10:24:25 +07:00
|
|
|
static struct fb_deferred_io qxl_defio = {
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
.delay = QXL_DIRTY_DELAY,
|
2016-04-28 22:18:36 +07:00
|
|
|
.deferred_io = drm_fb_helper_deferred_io,
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
};
|
2016-08-10 23:52:38 +07:00
|
|
|
#endif
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
|
|
|
|
static struct fb_ops qxlfb_ops = {
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.fb_check_var = drm_fb_helper_check_var,
|
|
|
|
.fb_set_par = drm_fb_helper_set_par, /* TODO: copy vmwgfx */
|
2016-04-28 22:18:36 +07:00
|
|
|
.fb_fillrect = drm_fb_helper_sys_fillrect,
|
|
|
|
.fb_copyarea = drm_fb_helper_sys_copyarea,
|
|
|
|
.fb_imageblit = drm_fb_helper_sys_imageblit,
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
.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,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void qxlfb_destroy_pinned_object(struct drm_gem_object *gobj)
|
|
|
|
{
|
|
|
|
struct qxl_bo *qbo = gem_to_qxl_bo(gobj);
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = qxl_bo_reserve(qbo, false);
|
|
|
|
if (likely(ret == 0)) {
|
|
|
|
qxl_bo_kunmap(qbo);
|
|
|
|
qxl_bo_unpin(qbo);
|
|
|
|
qxl_bo_unreserve(qbo);
|
|
|
|
}
|
|
|
|
drm_gem_object_unreference_unlocked(gobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
int qxl_get_handle_for_primary_fb(struct qxl_device *qdev,
|
|
|
|
struct drm_file *file_priv,
|
|
|
|
uint32_t *handle)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
struct drm_gem_object *gobj = qdev->fbdev_qfb->obj;
|
|
|
|
|
|
|
|
BUG_ON(!gobj);
|
|
|
|
/* drm_get_handle_create adds a reference - good */
|
|
|
|
r = drm_gem_handle_create(file_priv, gobj, handle);
|
|
|
|
if (r)
|
|
|
|
return r;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int qxlfb_create_pinned_object(struct qxl_fbdev *qfbdev,
|
2015-11-12 00:11:29 +07:00
|
|
|
const struct drm_mode_fb_cmd2 *mode_cmd,
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
struct drm_gem_object **gobj_p)
|
|
|
|
{
|
|
|
|
struct qxl_device *qdev = qfbdev->qdev;
|
|
|
|
struct drm_gem_object *gobj = NULL;
|
|
|
|
struct qxl_bo *qbo = NULL;
|
|
|
|
int ret;
|
|
|
|
int aligned_size, size;
|
|
|
|
int height = mode_cmd->height;
|
|
|
|
|
|
|
|
size = mode_cmd->pitches[0] * height;
|
|
|
|
aligned_size = ALIGN(size, PAGE_SIZE);
|
|
|
|
/* TODO: unallocate and reallocate surface0 for real. Hack to just
|
|
|
|
* have a large enough surface0 for 1024x768 Xorg 32bpp mode */
|
|
|
|
ret = qxl_gem_object_create(qdev, aligned_size, 0,
|
|
|
|
QXL_GEM_DOMAIN_SURFACE,
|
|
|
|
false, /* is discardable */
|
|
|
|
false, /* is kernel (false means device) */
|
|
|
|
NULL,
|
|
|
|
&gobj);
|
|
|
|
if (ret) {
|
|
|
|
pr_err("failed to allocate framebuffer (%d)\n",
|
|
|
|
aligned_size);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
qbo = gem_to_qxl_bo(gobj);
|
|
|
|
|
|
|
|
qbo->surf.width = mode_cmd->width;
|
|
|
|
qbo->surf.height = mode_cmd->height;
|
|
|
|
qbo->surf.stride = mode_cmd->pitches[0];
|
|
|
|
qbo->surf.format = SPICE_SURFACE_FMT_32_xRGB;
|
|
|
|
ret = qxl_bo_reserve(qbo, false);
|
|
|
|
if (unlikely(ret != 0))
|
|
|
|
goto out_unref;
|
|
|
|
ret = qxl_bo_pin(qbo, QXL_GEM_DOMAIN_SURFACE, NULL);
|
|
|
|
if (ret) {
|
|
|
|
qxl_bo_unreserve(qbo);
|
|
|
|
goto out_unref;
|
|
|
|
}
|
|
|
|
ret = qxl_bo_kmap(qbo, NULL);
|
|
|
|
qxl_bo_unreserve(qbo); /* unreserve, will be mmaped */
|
|
|
|
if (ret)
|
|
|
|
goto out_unref;
|
|
|
|
|
|
|
|
*gobj_p = gobj;
|
|
|
|
return 0;
|
|
|
|
out_unref:
|
|
|
|
qxlfb_destroy_pinned_object(gobj);
|
|
|
|
*gobj_p = NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-04-28 22:18:36 +07:00
|
|
|
/*
|
|
|
|
* FIXME
|
|
|
|
* It should not be necessary to have a special dirty() callback for fbdev.
|
|
|
|
*/
|
|
|
|
static int qxlfb_framebuffer_dirty(struct drm_framebuffer *fb,
|
|
|
|
struct drm_file *file_priv,
|
|
|
|
unsigned flags, unsigned color,
|
|
|
|
struct drm_clip_rect *clips,
|
|
|
|
unsigned num_clips)
|
|
|
|
{
|
|
|
|
struct qxl_device *qdev = fb->dev->dev_private;
|
|
|
|
struct fb_info *info = qdev->fbdev_info;
|
|
|
|
struct qxl_fbdev *qfbdev = info->par;
|
|
|
|
struct qxl_fb_image qxl_fb_image;
|
|
|
|
struct fb_image *image = &qxl_fb_image.fb_image;
|
|
|
|
|
|
|
|
/* TODO: hard coding 32 bpp */
|
|
|
|
int stride = qfbdev->qfb.base.pitches[0];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* we are using a shadow draw buffer, at qdev->surface0_shadow
|
|
|
|
*/
|
|
|
|
qxl_io_log(qdev, "dirty x[%d, %d], y[%d, %d]", clips->x1, clips->x2,
|
|
|
|
clips->y1, clips->y2);
|
|
|
|
image->dx = clips->x1;
|
|
|
|
image->dy = clips->y1;
|
|
|
|
image->width = clips->x2 - clips->x1;
|
|
|
|
image->height = clips->y2 - clips->y1;
|
|
|
|
image->fg_color = 0xffffffff; /* unused, just to avoid uninitialized
|
|
|
|
warnings */
|
|
|
|
image->bg_color = 0;
|
|
|
|
image->depth = 32; /* TODO: take from somewhere? */
|
|
|
|
image->cmap.start = 0;
|
|
|
|
image->cmap.len = 0;
|
|
|
|
image->cmap.red = NULL;
|
|
|
|
image->cmap.green = NULL;
|
|
|
|
image->cmap.blue = NULL;
|
|
|
|
image->cmap.transp = NULL;
|
|
|
|
image->data = qfbdev->shadow + (clips->x1 * 4) + (stride * clips->y1);
|
|
|
|
|
|
|
|
qxl_fb_image_init(&qxl_fb_image, qdev, info, NULL);
|
|
|
|
qxl_draw_opaque_fb(&qxl_fb_image, stride);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct drm_framebuffer_funcs qxlfb_fb_funcs = {
|
|
|
|
.destroy = qxl_user_framebuffer_destroy,
|
|
|
|
.dirty = qxlfb_framebuffer_dirty,
|
|
|
|
};
|
|
|
|
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
static int qxlfb_create(struct qxl_fbdev *qfbdev,
|
|
|
|
struct drm_fb_helper_surface_size *sizes)
|
|
|
|
{
|
|
|
|
struct qxl_device *qdev = qfbdev->qdev;
|
|
|
|
struct fb_info *info;
|
|
|
|
struct drm_framebuffer *fb = NULL;
|
|
|
|
struct drm_mode_fb_cmd2 mode_cmd;
|
|
|
|
struct drm_gem_object *gobj = NULL;
|
|
|
|
struct qxl_bo *qbo = NULL;
|
|
|
|
int ret;
|
|
|
|
int size;
|
|
|
|
int bpp = sizes->surface_bpp;
|
|
|
|
int depth = sizes->surface_depth;
|
|
|
|
void *shadow;
|
|
|
|
|
|
|
|
mode_cmd.width = sizes->surface_width;
|
|
|
|
mode_cmd.height = sizes->surface_height;
|
|
|
|
|
|
|
|
mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((bpp + 1) / 8), 64);
|
|
|
|
mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
|
|
|
|
|
|
|
|
ret = qxlfb_create_pinned_object(qfbdev, &mode_cmd, &gobj);
|
2016-05-13 00:06:56 +07:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
qbo = gem_to_qxl_bo(gobj);
|
|
|
|
QXL_INFO(qdev, "%s: %dx%d %d\n", __func__, mode_cmd.width,
|
|
|
|
mode_cmd.height, mode_cmd.pitches[0]);
|
|
|
|
|
|
|
|
shadow = vmalloc(mode_cmd.pitches[0] * mode_cmd.height);
|
|
|
|
/* TODO: what's the usual response to memory allocation errors? */
|
|
|
|
BUG_ON(!shadow);
|
|
|
|
QXL_INFO(qdev,
|
|
|
|
"surface0 at gpu offset %lld, mmap_offset %lld (virt %p, shadow %p)\n",
|
|
|
|
qxl_bo_gpu_offset(qbo),
|
|
|
|
qxl_bo_mmap_offset(qbo),
|
|
|
|
qbo->kptr,
|
|
|
|
shadow);
|
|
|
|
size = mode_cmd.pitches[0] * mode_cmd.height;
|
|
|
|
|
2015-07-22 16:28:13 +07:00
|
|
|
info = drm_fb_helper_alloc_fbi(&qfbdev->helper);
|
|
|
|
if (IS_ERR(info)) {
|
|
|
|
ret = PTR_ERR(info);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
goto out_unref;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->par = qfbdev;
|
|
|
|
|
2016-04-28 22:18:36 +07:00
|
|
|
qxl_framebuffer_init(qdev->ddev, &qfbdev->qfb, &mode_cmd, gobj,
|
|
|
|
&qxlfb_fb_funcs);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
|
|
|
|
fb = &qfbdev->qfb.base;
|
|
|
|
|
|
|
|
/* setup helper with fb data */
|
|
|
|
qfbdev->helper.fb = fb;
|
2015-07-22 16:28:13 +07:00
|
|
|
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
qfbdev->shadow = shadow;
|
|
|
|
strcpy(info->fix.id, "qxldrmfb");
|
|
|
|
|
|
|
|
drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
|
|
|
|
|
|
|
|
info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
|
|
|
|
info->fbops = &qxlfb_ops;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO: using gobj->size in various places in this function. Not sure
|
|
|
|
* what the difference between the different sizes is.
|
|
|
|
*/
|
|
|
|
info->fix.smem_start = qdev->vram_base; /* TODO - correct? */
|
|
|
|
info->fix.smem_len = gobj->size;
|
|
|
|
info->screen_base = qfbdev->shadow;
|
|
|
|
info->screen_size = gobj->size;
|
|
|
|
|
|
|
|
drm_fb_helper_fill_var(info, &qfbdev->helper, sizes->fb_width,
|
|
|
|
sizes->fb_height);
|
|
|
|
|
|
|
|
/* setup aperture base/size for vesafb takeover */
|
|
|
|
info->apertures->ranges[0].base = qdev->ddev->mode_config.fb_base;
|
|
|
|
info->apertures->ranges[0].size = qdev->vram_size;
|
|
|
|
|
|
|
|
info->fix.mmio_start = 0;
|
|
|
|
info->fix.mmio_len = 0;
|
|
|
|
|
|
|
|
if (info->screen_base == NULL) {
|
|
|
|
ret = -ENOSPC;
|
2015-07-22 16:28:13 +07:00
|
|
|
goto out_destroy_fbi;
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
}
|
|
|
|
|
2016-08-10 23:52:38 +07:00
|
|
|
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
info->fbdefio = &qxl_defio;
|
|
|
|
fb_deferred_io_init(info);
|
2016-08-10 23:52:38 +07:00
|
|
|
#endif
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
|
|
|
|
qdev->fbdev_info = info;
|
|
|
|
qdev->fbdev_qfb = &qfbdev->qfb;
|
|
|
|
DRM_INFO("fb mappable at 0x%lX, size %lu\n", info->fix.smem_start, (unsigned long)info->screen_size);
|
|
|
|
DRM_INFO("fb: depth %d, pitch %d, width %d, height %d\n", fb->depth, fb->pitches[0], fb->width, fb->height);
|
|
|
|
return 0;
|
|
|
|
|
2015-07-22 16:28:13 +07:00
|
|
|
out_destroy_fbi:
|
|
|
|
drm_fb_helper_release_fbi(&qfbdev->helper);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
out_unref:
|
|
|
|
if (qbo) {
|
|
|
|
ret = qxl_bo_reserve(qbo, false);
|
|
|
|
if (likely(ret == 0)) {
|
|
|
|
qxl_bo_kunmap(qbo);
|
|
|
|
qxl_bo_unpin(qbo);
|
|
|
|
qxl_bo_unreserve(qbo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (fb && ret) {
|
2016-03-30 16:40:42 +07:00
|
|
|
drm_gem_object_unreference_unlocked(gobj);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
drm_framebuffer_cleanup(fb);
|
|
|
|
kfree(fb);
|
|
|
|
}
|
2016-03-30 16:40:42 +07:00
|
|
|
drm_gem_object_unreference_unlocked(gobj);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int qxl_fb_find_or_create_single(
|
|
|
|
struct drm_fb_helper *helper,
|
|
|
|
struct drm_fb_helper_surface_size *sizes)
|
|
|
|
{
|
2014-09-14 23:40:19 +07:00
|
|
|
struct qxl_fbdev *qfbdev =
|
|
|
|
container_of(helper, struct qxl_fbdev, helper);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
int new_fb = 0;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!helper->fb) {
|
|
|
|
ret = qxlfb_create(qfbdev, sizes);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
new_fb = 1;
|
|
|
|
}
|
|
|
|
return new_fb;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int qxl_fbdev_destroy(struct drm_device *dev, struct qxl_fbdev *qfbdev)
|
|
|
|
{
|
|
|
|
struct qxl_framebuffer *qfb = &qfbdev->qfb;
|
|
|
|
|
2015-07-22 16:28:13 +07:00
|
|
|
drm_fb_helper_unregister_fbi(&qfbdev->helper);
|
|
|
|
drm_fb_helper_release_fbi(&qfbdev->helper);
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
|
|
|
|
if (qfb->obj) {
|
|
|
|
qxlfb_destroy_pinned_object(qfb->obj);
|
|
|
|
qfb->obj = NULL;
|
|
|
|
}
|
|
|
|
drm_fb_helper_fini(&qfbdev->helper);
|
|
|
|
vfree(qfbdev->shadow);
|
|
|
|
drm_framebuffer_cleanup(&qfb->base);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-27 22:19:23 +07:00
|
|
|
static const struct drm_fb_helper_funcs qxl_fb_helper_funcs = {
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
.fb_probe = qxl_fb_find_or_create_single,
|
|
|
|
};
|
|
|
|
|
|
|
|
int qxl_fbdev_init(struct qxl_device *qdev)
|
|
|
|
{
|
|
|
|
struct qxl_fbdev *qfbdev;
|
|
|
|
int bpp_sel = 32; /* TODO: parameter from somewhere? */
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
qfbdev = kzalloc(sizeof(struct qxl_fbdev), GFP_KERNEL);
|
|
|
|
if (!qfbdev)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
qfbdev->qdev = qdev;
|
|
|
|
qdev->mode_info.qfbdev = qfbdev;
|
2013-07-22 11:37:39 +07:00
|
|
|
spin_lock_init(&qfbdev->delayed_ops_lock);
|
|
|
|
INIT_LIST_HEAD(&qfbdev->delayed_ops);
|
2014-06-27 22:19:24 +07:00
|
|
|
|
|
|
|
drm_fb_helper_prepare(qdev->ddev, &qfbdev->helper,
|
|
|
|
&qxl_fb_helper_funcs);
|
|
|
|
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
ret = drm_fb_helper_init(qdev->ddev, &qfbdev->helper,
|
2013-07-02 12:37:13 +07:00
|
|
|
qxl_num_crtc /* num_crtc - QXL supports just 1 */,
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
QXLFB_CONN_LIMIT);
|
2014-12-19 17:21:32 +07:00
|
|
|
if (ret)
|
|
|
|
goto free;
|
|
|
|
|
|
|
|
ret = drm_fb_helper_single_add_all_connectors(&qfbdev->helper);
|
|
|
|
if (ret)
|
|
|
|
goto fini;
|
|
|
|
|
|
|
|
ret = drm_fb_helper_initial_config(&qfbdev->helper, bpp_sel);
|
|
|
|
if (ret)
|
|
|
|
goto fini;
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
|
|
|
|
return 0;
|
2014-12-19 17:21:32 +07:00
|
|
|
|
|
|
|
fini:
|
|
|
|
drm_fb_helper_fini(&qfbdev->helper);
|
|
|
|
free:
|
|
|
|
kfree(qfbdev);
|
|
|
|
return ret;
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
void qxl_fbdev_fini(struct qxl_device *qdev)
|
|
|
|
{
|
|
|
|
if (!qdev->mode_info.qfbdev)
|
|
|
|
return;
|
|
|
|
|
|
|
|
qxl_fbdev_destroy(qdev->ddev, qdev->mode_info.qfbdev);
|
|
|
|
kfree(qdev->mode_info.qfbdev);
|
|
|
|
qdev->mode_info.qfbdev = NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-04 11:59:34 +07:00
|
|
|
void qxl_fbdev_set_suspend(struct qxl_device *qdev, int state)
|
|
|
|
{
|
2015-07-22 16:28:13 +07:00
|
|
|
drm_fb_helper_set_suspend(&qdev->mode_info.qfbdev->helper, state);
|
2013-07-04 11:59:34 +07:00
|
|
|
}
|
drm: add new QXL driver. (v1.4)
QXL is a paravirtual graphics device used by the Spice virtual desktop
interface.
The drivers uses GEM and TTM to manage memory, the qxl hw fencing however
is quite different than normal TTM expects, we have to keep track of a number
of non-linear fence ids per bo that we need to have released by the hardware.
The releases are freed from a workqueue that wakes up and processes the
release ring.
releases are suballocated from a BO, there are 3 release categories, drawables,
surfaces and cursor cmds. The hw also has 3 rings for commands, cursor and release handling.
The hardware also have a surface id tracking mechnaism and the driver encapsulates it completely inside the kernel, userspace never sees the actual hw surface
ids.
This requires a newer version of the QXL userspace driver, so shouldn't be
enabled until that has been placed into your distro of choice.
Authors: Dave Airlie, Alon Levy
v1.1: fixup some issues in the ioctl interface with padding
v1.2: add module device table
v1.3: fix nomodeset, fbcon leak, dumb bo create, release ring irq,
don't try flush release ring (broken hw), fix -modesetting.
v1.4: fbcon cpu usage reduction + suitable accel flags.
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-02-25 11:47:55 +07:00
|
|
|
|
2013-07-04 11:59:34 +07:00
|
|
|
bool qxl_fbdev_qobj_is_fb(struct qxl_device *qdev, struct qxl_bo *qobj)
|
|
|
|
{
|
|
|
|
if (qobj == gem_to_qxl_bo(qdev->mode_info.qfbdev->qfb.obj))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|