forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "drm/xen-front: Remove CMA support"
This reverts commit 492aec5.
- Loading branch information
1 parent
c49e01f
commit 5c39f22
Showing
10 changed files
with
241 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR MIT | ||
|
||
/* | ||
* Xen para-virtual DRM device | ||
* | ||
* Copyright (C) 2016-2018 EPAM Systems Inc. | ||
* | ||
* Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> | ||
*/ | ||
|
||
#include <drm/drmP.h> | ||
#include <drm/drm_gem.h> | ||
#include <drm/drm_fb_cma_helper.h> | ||
#include <drm/drm_gem_cma_helper.h> | ||
|
||
#include "xen_drm_front.h" | ||
#include "xen_drm_front_gem.h" | ||
|
||
struct drm_gem_object * | ||
xen_drm_front_gem_import_sg_table(struct drm_device *dev, | ||
struct dma_buf_attachment *attach, | ||
struct sg_table *sgt) | ||
{ | ||
struct xen_drm_front_drm_info *drm_info = dev->dev_private; | ||
struct drm_gem_object *gem_obj; | ||
struct drm_gem_cma_object *cma_obj; | ||
int ret; | ||
|
||
gem_obj = drm_gem_cma_prime_import_sg_table(dev, attach, sgt); | ||
if (IS_ERR_OR_NULL(gem_obj)) | ||
return gem_obj; | ||
|
||
cma_obj = to_drm_gem_cma_obj(gem_obj); | ||
|
||
ret = xen_drm_front_dbuf_create_from_sgt(drm_info->front_info, | ||
xen_drm_front_dbuf_to_cookie(gem_obj), | ||
0, 0, 0, gem_obj->size, | ||
drm_gem_cma_prime_get_sg_table(gem_obj)); | ||
if (ret < 0) | ||
return ERR_PTR(ret); | ||
|
||
DRM_DEBUG("Imported CMA buffer of size %zu\n", gem_obj->size); | ||
|
||
return gem_obj; | ||
} | ||
|
||
struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj) | ||
{ | ||
return drm_gem_cma_prime_get_sg_table(gem_obj); | ||
} | ||
|
||
struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, | ||
size_t size) | ||
{ | ||
struct xen_drm_front_drm_info *drm_info = dev->dev_private; | ||
struct drm_gem_cma_object *cma_obj; | ||
|
||
if (drm_info->front_info->cfg.be_alloc) { | ||
/* This use-case is not yet supported and probably won't be */ | ||
DRM_ERROR("Backend allocated buffers and CMA helpers are not supported at the same time\n"); | ||
return ERR_PTR(-EINVAL); | ||
} | ||
|
||
cma_obj = drm_gem_cma_create(dev, size); | ||
if (IS_ERR_OR_NULL(cma_obj)) | ||
return ERR_CAST(cma_obj); | ||
|
||
return &cma_obj->base; | ||
} | ||
|
||
void xen_drm_front_gem_free_object_unlocked(struct drm_gem_object *gem_obj) | ||
{ | ||
drm_gem_cma_free_object(gem_obj); | ||
} | ||
|
||
struct page **xen_drm_front_gem_get_pages(struct drm_gem_object *gem_obj) | ||
{ | ||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.