virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/qxl: use drmm_mode_config_init
       [not found] <20200908093912.26792-1-kraxel@redhat.com>
@ 2020-09-08  9:39 ` Gerd Hoffmann
  2020-09-08 11:35   ` Daniel Vetter
  2020-09-08  9:39 ` [PATCH 2/3] drm/qxl: release shadow on shutdown Gerd Hoffmann
  2020-09-08  9:39 ` [PATCH 3/3] drm/qxl: handle shadow in primary destroy Gerd Hoffmann
  2 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2020-09-08  9:39 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, open list, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	Daniel Vetter, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	Dave Airlie

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_display.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index fa79688013b7..4be04eaf7f37 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -1190,7 +1190,9 @@ int qxl_modeset_init(struct qxl_device *qdev)
 	int i;
 	int ret;
 
-	drm_mode_config_init(&qdev->ddev);
+	ret = drmm_mode_config_init(&qdev->ddev);
+	if (ret)
+		return ret;
 
 	ret = qxl_create_monitors_object(qdev);
 	if (ret)
@@ -1223,5 +1225,4 @@ int qxl_modeset_init(struct qxl_device *qdev)
 void qxl_modeset_fini(struct qxl_device *qdev)
 {
 	qxl_destroy_monitors_object(qdev);
-	drm_mode_config_cleanup(&qdev->ddev);
 }
-- 
2.27.0

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] drm/qxl: release shadow on shutdown
       [not found] <20200908093912.26792-1-kraxel@redhat.com>
  2020-09-08  9:39 ` [PATCH 1/3] drm/qxl: use drmm_mode_config_init Gerd Hoffmann
@ 2020-09-08  9:39 ` Gerd Hoffmann
  2020-09-08  9:39 ` [PATCH 3/3] drm/qxl: handle shadow in primary destroy Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-09-08  9:39 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, open list, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	Daniel Vetter, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	Dave Airlie

In case we have a shadow surface on shutdown release
it so it doesn't leak.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_display.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 4be04eaf7f37..85dcb7fe56a9 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -1224,5 +1224,9 @@ int qxl_modeset_init(struct qxl_device *qdev)
 
 void qxl_modeset_fini(struct qxl_device *qdev)
 {
+	if (qdev->dumb_shadow_bo) {
+		drm_gem_object_put(&qdev->dumb_shadow_bo->tbo.base);
+		qdev->dumb_shadow_bo = NULL;
+	}
 	qxl_destroy_monitors_object(qdev);
 }
-- 
2.27.0

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] drm/qxl: handle shadow in primary destroy
       [not found] <20200908093912.26792-1-kraxel@redhat.com>
  2020-09-08  9:39 ` [PATCH 1/3] drm/qxl: use drmm_mode_config_init Gerd Hoffmann
  2020-09-08  9:39 ` [PATCH 2/3] drm/qxl: release shadow on shutdown Gerd Hoffmann
@ 2020-09-08  9:39 ` Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-09-08  9:39 UTC (permalink / raw)
  To: dri-devel
  Cc: David Airlie, open list, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	Daniel Vetter, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	Dave Airlie

qxl_primary_atomic_disable must check whenever the framebuffer bo has a
shadow surface and in case it has check the shadow primary status.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 85dcb7fe56a9..3dcbb359e0f5 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -560,6 +560,8 @@ static void qxl_primary_atomic_disable(struct drm_plane *plane,
 	if (old_state->fb) {
 		struct qxl_bo *bo = gem_to_qxl_bo(old_state->fb->obj[0]);
 
+		if (bo->shadow)
+			bo = bo->shadow;
 		if (bo->is_primary) {
 			qxl_io_destroy_primary(qdev);
 			bo->is_primary = false;
-- 
2.27.0

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] drm/qxl: use drmm_mode_config_init
  2020-09-08  9:39 ` [PATCH 1/3] drm/qxl: use drmm_mode_config_init Gerd Hoffmann
@ 2020-09-08 11:35   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2020-09-08 11:35 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: David Airlie, open list, dri-devel,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU, Daniel Vetter,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU, Dave Airlie

On Tue, Sep 08, 2020 at 11:39:10AM +0200, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Btw going all in on devm_drm_dev_alloc and managed functions might be good
cleanup for virtio.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/qxl/qxl_display.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index fa79688013b7..4be04eaf7f37 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -1190,7 +1190,9 @@ int qxl_modeset_init(struct qxl_device *qdev)
>  	int i;
>  	int ret;
>  
> -	drm_mode_config_init(&qdev->ddev);
> +	ret = drmm_mode_config_init(&qdev->ddev);
> +	if (ret)
> +		return ret;
>  
>  	ret = qxl_create_monitors_object(qdev);
>  	if (ret)
> @@ -1223,5 +1225,4 @@ int qxl_modeset_init(struct qxl_device *qdev)
>  void qxl_modeset_fini(struct qxl_device *qdev)
>  {
>  	qxl_destroy_monitors_object(qdev);
> -	drm_mode_config_cleanup(&qdev->ddev);
>  }
> -- 
> 2.27.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-08 11:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200908093912.26792-1-kraxel@redhat.com>
2020-09-08  9:39 ` [PATCH 1/3] drm/qxl: use drmm_mode_config_init Gerd Hoffmann
2020-09-08 11:35   ` Daniel Vetter
2020-09-08  9:39 ` [PATCH 2/3] drm/qxl: release shadow on shutdown Gerd Hoffmann
2020-09-08  9:39 ` [PATCH 3/3] drm/qxl: handle shadow in primary destroy Gerd Hoffmann

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).