virtio-gpu: update done only on the scanout associated with rect
PATCH 1/1 virtio-gpu: update done only on the scanout associated with rect
It only needs to update the scanouts containing the rect area coming with the resource-flush request from the guest.
--- hw/display/virtio-gpu.c | 3 +++ 1 file changed, 3 insertions(+)
hw/display/virtio-gpu.c +3 -0
@@ -514,6 +514,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,for (i =0 ; i < g->parent_obj.conf.max_outputs; i++) { scanout = &g->parent_obj.scanout[i];if (scanout->resource_id == res->resource_id && + rf.r.x >= scanout->x && rf.r.y >= scanout->y && + rf.r.x + rf.r.width <= scanout->x + scanout->width && + rf.r.y + rf.r.height <= scanout->y + scanout->height &&console_has_gl (scanout->con)) {dpy_gl_update (scanout->con,0 ,0 , scanout->width, scanout->height);
Signature · 1 line
2.30.2
Hi
Quoted 4 lines · Dongwon Kim
It only needs to update the scanouts containing the rect area coming with the resource-flush request from the guest.
Quoted 11 lines
Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>--- hw/display/virtio-gpu.c | 3 +++ 1 file changed, 3 insertions(+)hw/display/virtio-gpu.c +0
-0
hw/display/virtio-gpu.c static void virtio_gpu_resource_flush(VirtIOGPU *g, · line 520
Quoted 7 lines
hw/display/virtio-gpu.c +3
-0@@ -514,6 +514,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,for (i =0 ; i < g->parent_obj.conf.max_outputs; i++) { scanout = &g->parent_obj.scanout[i]; if (scanout->resource_id == res->resource_id && + rf.r.x >= scanout->x && rf.r.y >= scanout->y && + rf.r.x + rf.r.width <= scanout->x + scanout->width && + rf.r.y + rf.r.height <= scanout->y + scanout->height &&
That doesn't seem to handle intersections/overlapping, I think it should.
Quoted 8 lines
hw/display/virtio-gpu.c +0
-0console_has_gl(scanout->con)) { dpy_gl_update(scanout->con, 0, 0, scanout->width,scanout->height);--
2.30.2
Signature · 1 line
Marc-André Lureau
Quoted 15 lines · Marc-André Lureau
Hi
Quoted 4 lines · Dongwon Kim
It only needs to update the scanouts containing the rect area coming with the resource-flush request from the guest.
Cc Gerd Hoffmann <[email protected]>Quoted 6 lines
Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>--- hw/display/virtio-gpu.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 15 lines
hw/display/virtio-gpu.c static void virtio_gpu_resource_flush(VirtIOGPU *g, · line 520
Quoted 12 lines
hw/display/virtio-gpu.c +3
-0@@ -514,6 +514,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,for (i =0 ; i < g->parent_obj.conf.max_outputs; i++) { scanout = &g->parent_obj.scanout[i]; if (scanout->resource_id == res->resource_id && + rf.r.x >= scanout->x && rf.r.y >= scanout->y && + rf.r.x + rf.r.width <= scanout->x + scanout->width && + rf.r.y + rf.r.height <= scanout->y + scanout->height &&That doesn't seem to handle intersections/overlapping, I think it should.
so set-scanouts and resource flushes are issued per scanout(CRTC/plane from guest's point of view). In case of intersections/overlapping, there will be two resource flushes (in case there are two scanouts) and each resource flush will take care of updating the scanout that covers partial damaged area.
The problem with the original code is that even if there is a resource flush request for a single scanout, it does update on both (or more) as well, which is unnecessary burden.
Thanks
Quoted 13 lines
Quoted 10 lines
hw/display/virtio-gpu.c +0
-0console_has_gl(scanout->con)) { dpy_gl_update(scanout->con, 0, 0, scanout->width,scanout->height);--
2.30.2Signature · 1 line
Marc-André Lureau
Quoted 32 lines · Dongwon Kim
Quoted 15 lines · Marc-André Lureau
Hi
Quoted 4 lines · Dongwon Kim
It only needs to update the scanouts containing the rect area coming with the resource-flush request from the guest.
Cc Gerd Hoffmann <[email protected]>Quoted 6 lines
Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>--- hw/display/virtio-gpu.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 15 lines
hw/display/virtio-gpu.c static void virtio_gpu_resource_flush(VirtIOGPU *g, · line 520
Quoted 12 lines
hw/display/virtio-gpu.c +3
-0@@ -514,6 +514,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,for (i =0 ; i < g->parent_obj.conf.max_outputs; i++) { scanout = &g->parent_obj.scanout[i]; if (scanout->resource_id == res->resource_id && + rf.r.x >= scanout->x && rf.r.y >= scanout->y && + rf.r.x + rf.r.width <= scanout->x + scanout->width && + rf.r.y + rf.r.height <= scanout->y + scanout->height &&That doesn't seem to handle intersections/overlapping, I think it should.
Quoted 5 lines
so set-scanouts and resource flushes are issued per scanout(CRTC/plane from guest's point of view). In case of intersections/overlapping, there will be two resource flushes (in case there are two scanouts) and each resource flush will take care of updating the scanout that covers partial damaged area.
Even though the linux kernel driver sends two flushes, one for each scanout, it is perfectly valid send a single flush for the complete resource.
So checking whenever the rectangle is completely within the scanout is not correct. When the scanout is covered partly you must update too. Only when the rectangle is completely outside the scanout it is valid to skip it.
take care,
Gerd
Quoted 39 lines · Gerd Hoffmann
Quoted 32 lines · Dongwon Kim
Quoted 15 lines · Marc-André Lureau
Hi
Quoted 4 lines · Dongwon Kim
It only needs to update the scanouts containing the rect area coming with the resource-flush request from the guest.
Cc Gerd Hoffmann <[email protected]>Quoted 6 lines
Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>--- hw/display/virtio-gpu.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 15 lines
hw/display/virtio-gpu.c static void virtio_gpu_resource_flush(VirtIOGPU *g, · line 520
Quoted 12 lines
hw/display/virtio-gpu.c +3
-0@@ -514,6 +514,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,for (i =0 ; i < g->parent_obj.conf.max_outputs; i++) { scanout = &g->parent_obj.scanout[i]; if (scanout->resource_id == res->resource_id && + rf.r.x >= scanout->x && rf.r.y >= scanout->y && + rf.r.x + rf.r.width <= scanout->x + scanout->width && + rf.r.y + rf.r.height <= scanout->y + scanout->height &&That doesn't seem to handle intersections/overlapping, I think it should.
Quoted 5 lines
so set-scanouts and resource flushes are issued per scanout(CRTC/plane from guest's point of view). In case of intersections/overlapping, there will be two resource flushes (in case there are two scanouts) and each resource flush will take care of updating the scanout that covers partial damaged area.
Quoted 8 lines
Even though the linux kernel driver sends two flushes, one for each scanout, it is perfectly valid send a single flush for the complete resource.
So checking whenever the rectangle is completely within the scanout is not correct. When the scanout is covered partly you must update too. Only when the rectangle is completely outside the scanout it is valid to skip it.
Gerd,
I got your point. I will take a look into it.
Quoted 4 lines
take care,
Gerd