mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/virtio: use struct to pass params to virtio_gpu_object_create()
Create virtio_gpu_object_params, use that to pass object parameters to virtio_gpu_object_create. This is just the first step, followup patches will add more parameters to the struct. The plan is to use the struct for all object parameters. Drop unused "kernel" parameter for virtio_gpu_alloc_object(), it is unused and always false. Also drop "pinned" parameter. virtio-gpu doesn't shuffle around objects, so effecively they all are pinned anyway. Hardcode TTM_PL_FLAG_NO_EVICT so ttm knows. Doesn't change much for the moment as virtio-gpu supports TTM_PL_FLAG_TT only so there is no opportunity to move around objects. That'll probably change in the future though. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Link: http://patchwork.freedesktop.org/patch/msgid/20190318113332.10900-3-kraxel@redhat.com
This commit is contained in:
@@ -34,15 +34,15 @@ void virtio_gpu_gem_free_object(struct drm_gem_object *gem_obj)
|
||||
virtio_gpu_object_unref(&obj);
|
||||
}
|
||||
|
||||
struct virtio_gpu_object *virtio_gpu_alloc_object(struct drm_device *dev,
|
||||
size_t size, bool kernel,
|
||||
bool pinned)
|
||||
struct virtio_gpu_object*
|
||||
virtio_gpu_alloc_object(struct drm_device *dev,
|
||||
struct virtio_gpu_object_params *params)
|
||||
{
|
||||
struct virtio_gpu_device *vgdev = dev->dev_private;
|
||||
struct virtio_gpu_object *obj;
|
||||
int ret;
|
||||
|
||||
ret = virtio_gpu_object_create(vgdev, size, kernel, pinned, &obj);
|
||||
ret = virtio_gpu_object_create(vgdev, params, &obj);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
@@ -51,7 +51,7 @@ struct virtio_gpu_object *virtio_gpu_alloc_object(struct drm_device *dev,
|
||||
|
||||
int virtio_gpu_gem_create(struct drm_file *file,
|
||||
struct drm_device *dev,
|
||||
uint64_t size,
|
||||
struct virtio_gpu_object_params *params,
|
||||
struct drm_gem_object **obj_p,
|
||||
uint32_t *handle_p)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ int virtio_gpu_gem_create(struct drm_file *file,
|
||||
int ret;
|
||||
u32 handle;
|
||||
|
||||
obj = virtio_gpu_alloc_object(dev, size, false, false);
|
||||
obj = virtio_gpu_alloc_object(dev, params);
|
||||
if (IS_ERR(obj))
|
||||
return PTR_ERR(obj);
|
||||
|
||||
@@ -85,6 +85,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
|
||||
struct virtio_gpu_device *vgdev = dev->dev_private;
|
||||
struct drm_gem_object *gobj;
|
||||
struct virtio_gpu_object *obj;
|
||||
struct virtio_gpu_object_params params = { 0 };
|
||||
int ret;
|
||||
uint32_t pitch;
|
||||
uint32_t format;
|
||||
@@ -96,7 +97,8 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
|
||||
args->size = pitch * args->height;
|
||||
args->size = ALIGN(args->size, PAGE_SIZE);
|
||||
|
||||
ret = virtio_gpu_gem_create(file_priv, dev, args->size, &gobj,
|
||||
params.size = args->size;
|
||||
ret = virtio_gpu_gem_create(file_priv, dev, ¶ms, &gobj,
|
||||
&args->handle);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
Reference in New Issue
Block a user