* [PATCH] virtio-gpu-udmabuf: create udmabuf for blob even when iov_cnt == 1
@ 2023-06-21 22:27 Dongwon Kim
2023-06-26 11:44 ` Marc-André Lureau
0 siblings, 1 reply; 2+ messages in thread
From: Dongwon Kim @ 2023-06-21 22:27 UTC (permalink / raw)
To: qemu-devel
Cc: Dongwon Kim, Gerd Hoffmann, Marc-André Lureau,
Vivek Kasireddy
There were often cases where a scanout blob sometimes has just 1 entry
that is linked to many pages in it. So just checking whether iov_cnt is 1
is not enough for screening small, non-scanout blobs. Therefore adding
iov_len check as well to make sure it creates an udmabuf only for a scanout
blob, which is at least bigger than one page size.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
hw/display/virtio-gpu-udmabuf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf.c
index 69e2cf0bd6..ef1a740de5 100644
--- a/hw/display/virtio-gpu-udmabuf.c
+++ b/hw/display/virtio-gpu-udmabuf.c
@@ -132,7 +132,8 @@ void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res)
void *pdata = NULL;
res->dmabuf_fd = -1;
- if (res->iov_cnt == 1) {
+ if (res->iov_cnt == 1 &&
+ res->iov[0].iov_len < 4096) {
pdata = res->iov[0].iov_base;
} else {
virtio_gpu_create_udmabuf(res);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] virtio-gpu-udmabuf: create udmabuf for blob even when iov_cnt == 1
2023-06-21 22:27 [PATCH] virtio-gpu-udmabuf: create udmabuf for blob even when iov_cnt == 1 Dongwon Kim
@ 2023-06-26 11:44 ` Marc-André Lureau
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2023-06-26 11:44 UTC (permalink / raw)
To: Dongwon Kim; +Cc: qemu-devel, Gerd Hoffmann, Vivek Kasireddy
[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]
On Thu, Jun 22, 2023 at 12:47 AM Dongwon Kim <dongwon.kim@intel.com> wrote:
> There were often cases where a scanout blob sometimes has just 1 entry
> that is linked to many pages in it. So just checking whether iov_cnt is 1
> is not enough for screening small, non-scanout blobs. Therefore adding
> iov_len check as well to make sure it creates an udmabuf only for a scanout
> blob, which is at least bigger than one page size.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> hw/display/virtio-gpu-udmabuf.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/display/virtio-gpu-udmabuf.c
> b/hw/display/virtio-gpu-udmabuf.c
> index 69e2cf0bd6..ef1a740de5 100644
> --- a/hw/display/virtio-gpu-udmabuf.c
> +++ b/hw/display/virtio-gpu-udmabuf.c
> @@ -132,7 +132,8 @@ void virtio_gpu_init_udmabuf(struct
> virtio_gpu_simple_resource *res)
> void *pdata = NULL;
>
> res->dmabuf_fd = -1;
> - if (res->iov_cnt == 1) {
> + if (res->iov_cnt == 1 &&
> + res->iov[0].iov_len < 4096) {
> pdata = res->iov[0].iov_base;
> } else {
> virtio_gpu_create_udmabuf(res);
> --
> 2.34.1
>
>
>
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 2465 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-26 11:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 22:27 [PATCH] virtio-gpu-udmabuf: create udmabuf for blob even when iov_cnt == 1 Dongwon Kim
2023-06-26 11:44 ` Marc-André Lureau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).