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 Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Dave Airlie
|
|
|
|
* Alon Levy
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "qxl_drv.h"
|
|
|
|
#include "qxl_object.h"
|
|
|
|
|
2019-01-18 04:03:34 +07:00
|
|
|
#include <drm/drm_probe_helper.h>
|
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
|
|
|
#include <linux/io-mapping.h>
|
|
|
|
|
|
|
|
int qxl_log_level;
|
|
|
|
|
|
|
|
static bool qxl_check_device(struct qxl_device *qdev)
|
|
|
|
{
|
|
|
|
struct qxl_rom *rom = qdev->rom;
|
|
|
|
|
|
|
|
if (rom->magic != 0x4f525851) {
|
|
|
|
DRM_ERROR("bad rom signature %x\n", rom->magic);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DRM_INFO("Device Version %d.%d\n", rom->id, rom->update_id);
|
|
|
|
DRM_INFO("Compression level %d log level %d\n", rom->compression_level,
|
|
|
|
rom->log_level);
|
|
|
|
DRM_INFO("%d io pages at offset 0x%x\n",
|
|
|
|
rom->num_io_pages, rom->pages_offset);
|
|
|
|
DRM_INFO("%d byte draw area at offset 0x%x\n",
|
|
|
|
rom->surface0_area_size, rom->draw_area_offset);
|
|
|
|
|
|
|
|
qdev->vram_size = rom->surface0_area_size;
|
|
|
|
DRM_INFO("RAM header offset: 0x%x\n", rom->ram_header_offset);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-01-18 19:20:00 +07:00
|
|
|
static void setup_hw_slot(struct qxl_device *qdev, struct qxl_memslot *slot)
|
2013-07-04 11:57:58 +07:00
|
|
|
{
|
|
|
|
qdev->ram_header->mem_slot.mem_start = slot->start_phys_addr;
|
2019-01-18 19:20:00 +07:00
|
|
|
qdev->ram_header->mem_slot.mem_end = slot->start_phys_addr + slot->size;
|
|
|
|
qxl_io_memslot_add(qdev, qdev->rom->slots_start + slot->index);
|
2013-07-04 11:57:58 +07:00
|
|
|
}
|
|
|
|
|
2019-01-18 19:20:00 +07:00
|
|
|
static void setup_slot(struct qxl_device *qdev,
|
|
|
|
struct qxl_memslot *slot,
|
|
|
|
unsigned int slot_index,
|
|
|
|
const char *slot_name,
|
|
|
|
unsigned long start_phys_addr,
|
|
|
|
unsigned long size)
|
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
|
|
|
{
|
|
|
|
uint64_t high_bits;
|
|
|
|
|
2019-01-18 19:20:00 +07:00
|
|
|
slot->index = slot_index;
|
|
|
|
slot->name = slot_name;
|
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
|
|
|
slot->start_phys_addr = start_phys_addr;
|
2019-01-18 19:20:00 +07:00
|
|
|
slot->size = size;
|
2013-07-04 11:57:58 +07:00
|
|
|
|
2019-01-18 19:20:00 +07:00
|
|
|
setup_hw_slot(qdev, slot);
|
2013-07-04 11:57:58 +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
|
|
|
slot->generation = qdev->rom->slot_generation;
|
2019-01-18 19:20:00 +07:00
|
|
|
high_bits = (qdev->rom->slots_start + slot->index)
|
2019-01-18 19:20:02 +07:00
|
|
|
<< qdev->rom->slot_gen_bits;
|
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
|
|
|
high_bits |= slot->generation;
|
2019-01-18 19:20:02 +07:00
|
|
|
high_bits <<= (64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits));
|
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
|
|
|
slot->high_bits = high_bits;
|
2019-01-18 19:20:00 +07:00
|
|
|
|
2019-01-18 19:20:03 +07:00
|
|
|
DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx, gpu_offset 0x%lx\n",
|
2019-01-18 19:20:00 +07:00
|
|
|
slot->index, slot->name,
|
|
|
|
(unsigned long)slot->start_phys_addr,
|
2019-01-18 19:20:03 +07:00
|
|
|
(unsigned long)slot->size,
|
|
|
|
(unsigned long)slot->gpu_offset);
|
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:57:58 +07:00
|
|
|
void qxl_reinit_memslots(struct qxl_device *qdev)
|
|
|
|
{
|
2019-01-18 19:20:00 +07:00
|
|
|
setup_hw_slot(qdev, &qdev->main_slot);
|
|
|
|
setup_hw_slot(qdev, &qdev->surfaces_slot);
|
2013-07-04 11:57:58 +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
|
|
|
static void qxl_gc_work(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct qxl_device *qdev = container_of(work, struct qxl_device, gc_work);
|
2018-10-27 02:22:55 +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
|
|
|
qxl_garbage_collect(qdev);
|
|
|
|
}
|
|
|
|
|
2017-01-19 20:48:05 +07:00
|
|
|
int qxl_device_init(struct qxl_device *qdev,
|
2017-01-27 08:05:48 +07:00
|
|
|
struct drm_driver *drv,
|
2017-02-28 03:43:15 +07:00
|
|
|
struct pci_dev *pdev)
|
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-10-11 15:01:10 +07:00
|
|
|
int r, sb;
|
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
|
|
|
|
2017-01-27 08:05:48 +07:00
|
|
|
r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
|
2018-07-27 18:54:40 +07:00
|
|
|
if (r) {
|
|
|
|
pr_err("Unable to init drm dev");
|
|
|
|
goto error;
|
|
|
|
}
|
2017-01-27 08:05:48 +07:00
|
|
|
|
|
|
|
qdev->ddev.pdev = pdev;
|
|
|
|
pci_set_drvdata(pdev, &qdev->ddev);
|
|
|
|
qdev->ddev.dev_private = qdev;
|
|
|
|
|
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
|
|
|
mutex_init(&qdev->gem.mutex);
|
|
|
|
mutex_init(&qdev->update_area_mutex);
|
|
|
|
mutex_init(&qdev->release_mutex);
|
|
|
|
mutex_init(&qdev->surf_evict_mutex);
|
2016-11-08 16:12:06 +07:00
|
|
|
qxl_gem_init(qdev);
|
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->rom_base = pci_resource_start(pdev, 2);
|
|
|
|
qdev->rom_size = pci_resource_len(pdev, 2);
|
|
|
|
qdev->vram_base = pci_resource_start(pdev, 0);
|
|
|
|
qdev->io_base = pci_resource_start(pdev, 3);
|
|
|
|
|
|
|
|
qdev->vram_mapping = io_mapping_create_wc(qdev->vram_base, pci_resource_len(pdev, 0));
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qdev->vram_mapping) {
|
|
|
|
pr_err("Unable to create vram_mapping");
|
|
|
|
r = -ENOMEM;
|
|
|
|
goto error;
|
|
|
|
}
|
2013-10-11 15:01:10 +07:00
|
|
|
|
|
|
|
if (pci_resource_len(pdev, 4) > 0) {
|
|
|
|
/* 64bit surface bar present */
|
|
|
|
sb = 4;
|
|
|
|
qdev->surfaceram_base = pci_resource_start(pdev, sb);
|
|
|
|
qdev->surfaceram_size = pci_resource_len(pdev, sb);
|
|
|
|
qdev->surface_mapping =
|
|
|
|
io_mapping_create_wc(qdev->surfaceram_base,
|
|
|
|
qdev->surfaceram_size);
|
|
|
|
}
|
|
|
|
if (qdev->surface_mapping == NULL) {
|
|
|
|
/* 64bit surface bar not present (or mapping failed) */
|
|
|
|
sb = 1;
|
|
|
|
qdev->surfaceram_base = pci_resource_start(pdev, sb);
|
|
|
|
qdev->surfaceram_size = pci_resource_len(pdev, sb);
|
|
|
|
qdev->surface_mapping =
|
|
|
|
io_mapping_create_wc(qdev->surfaceram_base,
|
|
|
|
qdev->surfaceram_size);
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qdev->surface_mapping) {
|
|
|
|
pr_err("Unable to create surface_mapping");
|
|
|
|
r = -ENOMEM;
|
|
|
|
goto vram_mapping_free;
|
|
|
|
}
|
2013-10-11 15:01:10 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
DRM_DEBUG_KMS("qxl: vram %llx-%llx(%dM %dk), surface %llx-%llx(%dM %dk, %s)\n",
|
2013-05-31 09:45:09 +07:00
|
|
|
(unsigned long long)qdev->vram_base,
|
|
|
|
(unsigned long long)pci_resource_end(pdev, 0),
|
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)pci_resource_len(pdev, 0) / 1024 / 1024,
|
|
|
|
(int)pci_resource_len(pdev, 0) / 1024,
|
2013-05-31 09:45:09 +07:00
|
|
|
(unsigned long long)qdev->surfaceram_base,
|
2013-10-11 15:01:10 +07:00
|
|
|
(unsigned long long)pci_resource_end(pdev, sb),
|
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)qdev->surfaceram_size / 1024 / 1024,
|
2013-10-11 15:01:10 +07:00
|
|
|
(int)qdev->surfaceram_size / 1024,
|
|
|
|
(sb == 4) ? "64bit" : "32bit");
|
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->rom = ioremap(qdev->rom_base, qdev->rom_size);
|
|
|
|
if (!qdev->rom) {
|
|
|
|
pr_err("Unable to ioremap ROM\n");
|
2018-07-27 18:54:40 +07:00
|
|
|
r = -ENOMEM;
|
|
|
|
goto surface_mapping_free;
|
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
|
|
|
}
|
|
|
|
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qxl_check_device(qdev)) {
|
|
|
|
r = -ENODEV;
|
|
|
|
goto surface_mapping_free;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
r = qxl_bo_init(qdev);
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("bo init failed %d\n", r);
|
2018-07-27 18:54:40 +07:00
|
|
|
goto rom_unmap;
|
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->ram_header = ioremap(qdev->vram_base +
|
|
|
|
qdev->rom->ram_header_offset,
|
|
|
|
sizeof(*qdev->ram_header));
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qdev->ram_header) {
|
|
|
|
DRM_ERROR("Unable to ioremap RAM header\n");
|
|
|
|
r = -ENOMEM;
|
|
|
|
goto bo_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
|
|
|
|
|
|
|
qdev->command_ring = qxl_ring_create(&(qdev->ram_header->cmd_ring_hdr),
|
|
|
|
sizeof(struct qxl_command),
|
|
|
|
QXL_COMMAND_RING_SIZE,
|
|
|
|
qdev->io_base + QXL_IO_NOTIFY_CMD,
|
|
|
|
false,
|
|
|
|
&qdev->display_event);
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qdev->command_ring) {
|
|
|
|
DRM_ERROR("Unable to create command ring\n");
|
|
|
|
r = -ENOMEM;
|
|
|
|
goto ram_header_unmap;
|
|
|
|
}
|
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->cursor_ring = qxl_ring_create(
|
|
|
|
&(qdev->ram_header->cursor_ring_hdr),
|
|
|
|
sizeof(struct qxl_command),
|
|
|
|
QXL_CURSOR_RING_SIZE,
|
|
|
|
qdev->io_base + QXL_IO_NOTIFY_CMD,
|
|
|
|
false,
|
|
|
|
&qdev->cursor_event);
|
|
|
|
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qdev->cursor_ring) {
|
|
|
|
DRM_ERROR("Unable to create cursor ring\n");
|
|
|
|
r = -ENOMEM;
|
|
|
|
goto command_ring_free;
|
|
|
|
}
|
|
|
|
|
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->release_ring = qxl_ring_create(
|
|
|
|
&(qdev->ram_header->release_ring_hdr),
|
|
|
|
sizeof(uint64_t),
|
|
|
|
QXL_RELEASE_RING_SIZE, 0, true,
|
|
|
|
NULL);
|
|
|
|
|
2018-07-27 18:54:40 +07:00
|
|
|
if (!qdev->release_ring) {
|
|
|
|
DRM_ERROR("Unable to create release ring\n");
|
|
|
|
r = -ENOMEM;
|
|
|
|
goto cursor_ring_free;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
idr_init(&qdev->release_idr);
|
|
|
|
spin_lock_init(&qdev->release_idr_lock);
|
2014-04-02 17:40:05 +07:00
|
|
|
spin_lock_init(&qdev->release_lock);
|
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
|
|
|
|
|
|
|
idr_init(&qdev->surf_id_idr);
|
|
|
|
spin_lock_init(&qdev->surf_id_idr_lock);
|
|
|
|
|
|
|
|
mutex_init(&qdev->async_io_mutex);
|
|
|
|
|
|
|
|
/* reset the device into a known state - no memslots, no primary
|
|
|
|
* created, no surfaces. */
|
|
|
|
qxl_io_reset(qdev);
|
|
|
|
|
|
|
|
/* must initialize irq before first async io - slot creation */
|
|
|
|
r = qxl_irq_init(qdev);
|
2018-07-27 18:54:40 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Unable to init qxl irq\n");
|
2019-01-18 19:20:00 +07:00
|
|
|
goto release_ring_free;
|
2018-07-27 18:54:40 +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
|
|
|
|
|
|
|
/*
|
|
|
|
* Note that virtual is surface0. We rely on the single ioremap done
|
|
|
|
* before.
|
|
|
|
*/
|
2019-01-18 19:20:00 +07:00
|
|
|
setup_slot(qdev, &qdev->main_slot, 0, "main",
|
|
|
|
(unsigned long)qdev->vram_base,
|
|
|
|
(unsigned long)qdev->rom->ram_header_offset);
|
|
|
|
setup_slot(qdev, &qdev->surfaces_slot, 1, "surfaces",
|
|
|
|
(unsigned long)qdev->surfaceram_base,
|
|
|
|
(unsigned long)qdev->surfaceram_size);
|
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
|
|
|
|
|
|
|
INIT_WORK(&qdev->gc_work, qxl_gc_work);
|
|
|
|
|
|
|
|
return 0;
|
2018-07-27 18:54:40 +07:00
|
|
|
|
|
|
|
release_ring_free:
|
|
|
|
qxl_ring_free(qdev->release_ring);
|
|
|
|
cursor_ring_free:
|
|
|
|
qxl_ring_free(qdev->cursor_ring);
|
|
|
|
command_ring_free:
|
|
|
|
qxl_ring_free(qdev->command_ring);
|
|
|
|
ram_header_unmap:
|
|
|
|
iounmap(qdev->ram_header);
|
|
|
|
bo_fini:
|
|
|
|
qxl_bo_fini(qdev);
|
|
|
|
rom_unmap:
|
|
|
|
iounmap(qdev->rom);
|
|
|
|
surface_mapping_free:
|
|
|
|
io_mapping_free(qdev->surface_mapping);
|
|
|
|
vram_mapping_free:
|
|
|
|
io_mapping_free(qdev->vram_mapping);
|
|
|
|
error:
|
|
|
|
return r;
|
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
|
|
|
}
|
|
|
|
|
2017-01-19 20:48:05 +07:00
|
|
|
void qxl_device_fini(struct qxl_device *qdev)
|
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
|
|
|
{
|
2018-11-20 23:20:02 +07:00
|
|
|
qxl_bo_unref(&qdev->current_release_bo[0]);
|
|
|
|
qxl_bo_unref(&qdev->current_release_bo[1]);
|
2016-07-02 18:02:09 +07:00
|
|
|
flush_work(&qdev->gc_work);
|
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
|
|
|
qxl_ring_free(qdev->command_ring);
|
|
|
|
qxl_ring_free(qdev->cursor_ring);
|
|
|
|
qxl_ring_free(qdev->release_ring);
|
2016-11-08 16:12:06 +07:00
|
|
|
qxl_gem_fini(qdev);
|
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
|
|
|
qxl_bo_fini(qdev);
|
|
|
|
io_mapping_free(qdev->surface_mapping);
|
|
|
|
io_mapping_free(qdev->vram_mapping);
|
|
|
|
iounmap(qdev->ram_header);
|
|
|
|
iounmap(qdev->rom);
|
|
|
|
qdev->rom = NULL;
|
|
|
|
}
|