Commit 881c4117 authored by Dave Airlie's avatar Dave Airlie
parent 8117713d
...@@ -98,19 +98,11 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev, ...@@ -98,19 +98,11 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
/* /*
* TTM backend functions. * TTM backend functions.
*/ */
struct qxl_ttm_tt {
struct ttm_tt ttm;
struct qxl_device *qdev;
u64 offset;
};
static int qxl_ttm_backend_bind(struct ttm_bo_device *bdev, static int qxl_ttm_backend_bind(struct ttm_bo_device *bdev,
struct ttm_tt *ttm, struct ttm_tt *ttm,
struct ttm_resource *bo_mem) struct ttm_resource *bo_mem)
{ {
struct qxl_ttm_tt *gtt = (void *)ttm;
gtt->offset = (unsigned long)(bo_mem->start << PAGE_SHIFT);
if (!ttm->num_pages) { if (!ttm->num_pages) {
WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n", WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n",
ttm->num_pages, bo_mem, ttm); ttm->num_pages, bo_mem, ttm);
...@@ -128,29 +120,24 @@ static void qxl_ttm_backend_unbind(struct ttm_bo_device *bdev, ...@@ -128,29 +120,24 @@ static void qxl_ttm_backend_unbind(struct ttm_bo_device *bdev,
static void qxl_ttm_backend_destroy(struct ttm_bo_device *bdev, static void qxl_ttm_backend_destroy(struct ttm_bo_device *bdev,
struct ttm_tt *ttm) struct ttm_tt *ttm)
{ {
struct qxl_ttm_tt *gtt = (void *)ttm;
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
ttm_tt_fini(&gtt->ttm); ttm_tt_fini(ttm);
kfree(gtt); kfree(ttm);
} }
static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo, static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo,
uint32_t page_flags) uint32_t page_flags)
{ {
struct qxl_device *qdev; struct ttm_tt *ttm;
struct qxl_ttm_tt *gtt;
qdev = qxl_get_qdev(bo->bdev); ttm = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL);
gtt = kzalloc(sizeof(struct qxl_ttm_tt), GFP_KERNEL); if (ttm == NULL)
if (gtt == NULL)
return NULL; return NULL;
gtt->qdev = qdev; if (ttm_tt_init(ttm, bo, page_flags)) {
if (ttm_tt_init(&gtt->ttm, bo, page_flags)) { kfree(ttm);
kfree(gtt);
return NULL; return NULL;
} }
return &gtt->ttm; return ttm;
} }
static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict, static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment