From: Gerd Hoffmann <kraxel@redhat.com>
To: dri-devel@lists.freedesktop.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
virtualization@lists.linux-foundation.org (open list:VIRTIO GPU
DRIVER), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v2 3/6] drm/virtio: params struct for virtio_gpu_cmd_create_resource()
Date: Wed, 30 Jan 2019 10:43:35 +0100 [thread overview]
Message-ID: <20190130094338.14203-4-kraxel@redhat.com> (raw)
In-Reply-To: <20190130094338.14203-1-kraxel@redhat.com>
Add format, width and height fields to the virtio_gpu_object_params
struct. With that in place we can use the parameter struct for
virtio_gpu_cmd_create_resource() calls too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_drv.h | 7 ++++---
drivers/gpu/drm/virtio/virtgpu_gem.c | 8 ++++----
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6 ++++--
drivers/gpu/drm/virtio/virtgpu_vq.c | 10 ++++------
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 40928980a2..a40215c10e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -51,6 +51,9 @@
#define DRIVER_PATCHLEVEL 0
struct virtio_gpu_object_params {
+ uint32_t format;
+ uint32_t width;
+ uint32_t height;
unsigned long size;
bool pinned;
};
@@ -248,9 +251,7 @@ int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev);
void virtio_gpu_free_vbufs(struct virtio_gpu_device *vgdev);
void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev,
struct virtio_gpu_object *bo,
- uint32_t format,
- uint32_t width,
- uint32_t height);
+ struct virtio_gpu_object_params *params);
void virtio_gpu_cmd_unref_resource(struct virtio_gpu_device *vgdev,
uint32_t resource_id);
void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index b5f2d94ce5..3a63ffcd4b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -88,7 +88,6 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
struct virtio_gpu_object_params params = { 0 };
int ret;
uint32_t pitch;
- uint32_t format;
if (args->bpp != 32)
return -EINVAL;
@@ -98,16 +97,17 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
args->size = ALIGN(args->size, PAGE_SIZE);
params.pinned = false,
+ params.format = virtio_gpu_translate_format(DRM_FORMAT_HOST_XRGB8888);
+ params.width = args->width;
+ params.height = args->height;
params.size = args->size;
ret = virtio_gpu_gem_create(file_priv, dev, ¶ms, &gobj,
&args->handle);
if (ret)
goto fail;
- format = virtio_gpu_translate_format(DRM_FORMAT_HOST_XRGB8888);
obj = gem_to_virtio_gpu_obj(gobj);
- virtio_gpu_cmd_create_resource(vgdev, obj, format,
- args->width, args->height);
+ virtio_gpu_cmd_create_resource(vgdev, obj, ¶ms);
/* attach the object to the resource */
ret = virtio_gpu_object_attach(vgdev, obj, NULL);
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index fa7b958ca2..84c2216fd4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -303,6 +303,9 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
memset(&mainbuf, 0, sizeof(struct ttm_validate_buffer));
params.pinned = false,
+ params.format = rc->format;
+ params.width = rc->width;
+ params.height = rc->height;
params.size = rc->size;
/* allocate a single page size object */
@@ -315,8 +318,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
obj = &qobj->gem_base;
if (!vgdev->has_virgl_3d) {
- virtio_gpu_cmd_create_resource(vgdev, qobj, rc->format,
- rc->width, rc->height);
+ virtio_gpu_cmd_create_resource(vgdev, qobj, ¶ms);
ret = virtio_gpu_object_attach(vgdev, qobj, NULL);
} else {
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 6bc2008b0d..363b8b8577 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -376,9 +376,7 @@ static int virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev,
/* create a basic resource */
void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev,
struct virtio_gpu_object *bo,
- uint32_t format,
- uint32_t width,
- uint32_t height)
+ struct virtio_gpu_object_params *params)
{
struct virtio_gpu_resource_create_2d *cmd_p;
struct virtio_gpu_vbuffer *vbuf;
@@ -388,9 +386,9 @@ void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev,
cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_RESOURCE_CREATE_2D);
cmd_p->resource_id = cpu_to_le32(bo->hw_res_handle);
- cmd_p->format = cpu_to_le32(format);
- cmd_p->width = cpu_to_le32(width);
- cmd_p->height = cpu_to_le32(height);
+ cmd_p->format = cpu_to_le32(params->format);
+ cmd_p->width = cpu_to_le32(params->width);
+ cmd_p->height = cpu_to_le32(params->height);
virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
bo->created = true;
--
2.9.3
next prev parent reply other threads:[~2019-01-30 9:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190130094338.14203-1-kraxel@redhat.com>
2019-01-30 9:43 ` [PATCH v2 1/6] drm/virtio: move virtio_gpu_object_{attach,detach} calls Gerd Hoffmann
2019-01-31 10:34 ` [PATCH v2 1/6] drm/virtio: move virtio_gpu_object_{attach, detach} calls Noralf Trønnes
2019-01-30 9:43 ` [PATCH v2 2/6] drm/virtio: use struct to pass params to virtio_gpu_object_create() Gerd Hoffmann
2019-01-31 10:40 ` Noralf Trønnes
2019-02-01 8:10 ` Gerd Hoffmann
2019-01-30 9:43 ` Gerd Hoffmann [this message]
2019-01-31 10:41 ` [PATCH v2 3/6] drm/virtio: params struct for virtio_gpu_cmd_create_resource() Noralf Trønnes
2019-01-30 9:43 ` [PATCH v2 4/6] drm/virtio: params struct for virtio_gpu_cmd_create_resource_3d() Gerd Hoffmann
2019-01-31 10:47 ` Noralf Trønnes
2019-02-01 8:01 ` Gerd Hoffmann
2019-02-01 9:31 ` Noralf Trønnes
2019-01-30 9:43 ` [PATCH v2 5/6] drm/virtio: drop fencing in virtio_gpu_resource_create_ioctl Gerd Hoffmann
2019-01-31 10:50 ` Noralf Trønnes
2019-01-31 19:04 ` Gurchetan Singh
2019-02-01 7:23 ` Gerd Hoffmann
2019-03-18 11:35 ` Gerd Hoffmann
2019-01-30 9:43 ` [PATCH v2 6/6] drm/virtio: move virtio_gpu_cmd_create_resource call into virtio_gpu_object_create Gerd Hoffmann
2019-01-31 10:53 ` Noralf Trønnes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190130094338.14203-4-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®