mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Gerd Hoffmann <kraxel@redhat.com>, dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:VIRTIO GPU DRIVER" 
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH v2 4/6] drm/virtio: params struct for virtio_gpu_cmd_create_resource_3d()
Date: Thu, 31 Jan 2019 11:47:38 +0100	[thread overview]
Message-ID: <4d3064ef-9993-106a-74b5-73a29c08975e@tronnes.org> (raw)
In-Reply-To: <20190130094338.14203-5-kraxel@redhat.com>



Den 30.01.2019 10.43, skrev Gerd Hoffmann:
> Add 3d resource parameters to virtio_gpu_object_params struct.  With
> that in place we can use it for virtio_gpu_cmd_resource_create_3d()
> calls.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---

You don't remove the struct virtio_gpu_resource_create_3d definition,
but it looks like there's no users left?

Noralf.

>  drivers/gpu/drm/virtio/virtgpu_drv.h   | 10 +++++++++-
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 25 ++++++++++---------------
>  drivers/gpu/drm/virtio/virtgpu_vq.c    | 16 +++++++++++++---
>  3 files changed, 32 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index a40215c10e..3265e62725 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -56,6 +56,14 @@ struct virtio_gpu_object_params {
>  	uint32_t height;
>  	unsigned long size;
>  	bool pinned;
> +	/* 3d */
> +	uint32_t target;
> +	uint32_t bind;
> +	uint32_t depth;
> +	uint32_t array_size;
> +	uint32_t last_level;
> +	uint32_t nr_samples;
> +	uint32_t flags;
>  };
>  
>  struct virtio_gpu_object {
> @@ -310,7 +318,7 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
>  void
>  virtio_gpu_cmd_resource_create_3d(struct virtio_gpu_device *vgdev,
>  				  struct virtio_gpu_object *bo,
> -				  struct virtio_gpu_resource_create_3d *rc_3d);
> +				  struct virtio_gpu_object_params *params);
>  void virtio_gpu_ctrl_ack(struct virtqueue *vq);
>  void virtio_gpu_cursor_ack(struct virtqueue *vq);
>  void virtio_gpu_fence_ack(struct virtqueue *vq);
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 84c2216fd4..431e5d767e 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -283,7 +283,6 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
>  	struct ttm_validate_buffer mainbuf;
>  	struct virtio_gpu_fence *fence = NULL;
>  	struct ww_acquire_ctx ticket;
> -	struct virtio_gpu_resource_create_3d rc_3d;
>  	struct virtio_gpu_object_params params = { 0 };
>  
>  	if (vgdev->has_virgl_3d == false) {
> @@ -307,7 +306,15 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
>  	params.width = rc->width;
>  	params.height = rc->height;
>  	params.size = rc->size;
> -
> +	if (vgdev->has_virgl_3d) {
> +		params.target = rc->target;
> +		params.bind = rc->bind;
> +		params.depth = rc->depth;
> +		params.array_size = rc->array_size;
> +		params.last_level = rc->last_level;
> +		params.nr_samples = rc->nr_samples;
> +		params.flags = rc->flags;
> +	}
>  	/* allocate a single page size object */
>  	if (params.size == 0)
>  		params.size = PAGE_SIZE;
> @@ -333,25 +340,13 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
>  			goto fail_unref;
>  		}
>  
> -		rc_3d.resource_id = cpu_to_le32(qobj->hw_res_handle);
> -		rc_3d.target = cpu_to_le32(rc->target);
> -		rc_3d.format = cpu_to_le32(rc->format);
> -		rc_3d.bind = cpu_to_le32(rc->bind);
> -		rc_3d.width = cpu_to_le32(rc->width);
> -		rc_3d.height = cpu_to_le32(rc->height);
> -		rc_3d.depth = cpu_to_le32(rc->depth);
> -		rc_3d.array_size = cpu_to_le32(rc->array_size);
> -		rc_3d.last_level = cpu_to_le32(rc->last_level);
> -		rc_3d.nr_samples = cpu_to_le32(rc->nr_samples);
> -		rc_3d.flags = cpu_to_le32(rc->flags);
> -
>  		fence = virtio_gpu_fence_alloc(vgdev);
>  		if (!fence) {
>  			ret = -ENOMEM;
>  			goto fail_backoff;
>  		}
>  
> -		virtio_gpu_cmd_resource_create_3d(vgdev, qobj, &rc_3d);
> +		virtio_gpu_cmd_resource_create_3d(vgdev, qobj, &params);
>  		ret = virtio_gpu_object_attach(vgdev, qobj, fence);
>  		if (ret) {
>  			dma_fence_put(&fence->f);
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 363b8b8577..ca93ec6ca3 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -826,7 +826,7 @@ void virtio_gpu_cmd_context_detach_resource(struct virtio_gpu_device *vgdev,
>  void
>  virtio_gpu_cmd_resource_create_3d(struct virtio_gpu_device *vgdev,
>  				  struct virtio_gpu_object *bo,
> -				  struct virtio_gpu_resource_create_3d *rc_3d)
> +				  struct virtio_gpu_object_params *params)
>  {
>  	struct virtio_gpu_resource_create_3d *cmd_p;
>  	struct virtio_gpu_vbuffer *vbuf;
> @@ -834,9 +834,19 @@ virtio_gpu_cmd_resource_create_3d(struct virtio_gpu_device *vgdev,
>  	cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p));
>  	memset(cmd_p, 0, sizeof(*cmd_p));
>  
> -	*cmd_p = *rc_3d;
>  	cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_RESOURCE_CREATE_3D);
> -	cmd_p->hdr.flags = 0;
> +	cmd_p->resource_id = cpu_to_le32(bo->hw_res_handle);
> +	cmd_p->format = cpu_to_le32(params->format);
> +	cmd_p->width = cpu_to_le32(params->width);
> +	cmd_p->height = cpu_to_le32(params->height);
> +
> +	cmd_p->target = cpu_to_le32(params->target);
> +	cmd_p->bind = cpu_to_le32(params->bind);
> +	cmd_p->depth = cpu_to_le32(params->depth);
> +	cmd_p->array_size = cpu_to_le32(params->array_size);
> +	cmd_p->last_level = cpu_to_le32(params->last_level);
> +	cmd_p->nr_samples = cpu_to_le32(params->nr_samples);
> +	cmd_p->flags = cpu_to_le32(params->flags);
>  
>  	virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
>  	bo->created = true;
> 

  reply	other threads:[~2019-01-31 10:47 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 ` [PATCH v2 3/6] drm/virtio: params struct for virtio_gpu_cmd_create_resource() Gerd Hoffmann
2019-01-31 10:41   ` 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 [this message]
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=4d3064ef-9993-106a-74b5-73a29c08975e@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --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®