From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: Don't leak the bufmgr and batch for converted surfaces
Date: Thu, 28 Mar 2019 19:54:50 +0200 [thread overview]
Message-ID: <20190328175450.8370-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190328175450.8370-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Remember to free the bufmgr and batch after the convert surface is
destroyed. We'll do that by sucking the relevant code into
free_linear_mapping(), and for the sake of symmetry we'll move
the setup code into setup_linear_mapping().
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
lib/igt_fb.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 8b6adf55a338..99766d2d08f9 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1604,6 +1604,11 @@ static void free_linear_mapping(struct fb_blit_upload *blit)
gem_sync(fd, linear->fb.gem_handle);
gem_close(fd, linear->fb.gem_handle);
+
+ if (blit->batch) {
+ intel_batchbuffer_free(blit->batch);
+ drm_intel_bufmgr_destroy(blit->bufmgr);
+ }
}
static void destroy_cairo_surface__blit(void *arg)
@@ -1625,9 +1630,6 @@ static void destroy_cairo_surface__rendercopy(void *arg)
free_linear_mapping(blit);
- intel_batchbuffer_free(blit->batch);
- drm_intel_bufmgr_destroy(blit->bufmgr);
-
free(blit);
}
@@ -1637,6 +1639,12 @@ static void setup_linear_mapping(struct fb_blit_upload *blit)
struct igt_fb *fb = blit->fb;
struct fb_blit_linear *linear = &blit->linear;
+ if (use_rendercopy(fb)) {
+ blit->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+ blit->batch = intel_batchbuffer_alloc(blit->bufmgr,
+ intel_get_drm_devid(fd));
+ }
+
/*
* We create a linear BO that we'll map for the CPU to write to (using
* cairo). This linear bo will be then blitted to its final
@@ -1706,10 +1714,6 @@ static void create_cairo_surface__rendercopy(int fd, struct igt_fb *fb)
blit->fd = fd;
blit->fb = fb;
- blit->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
- blit->batch = intel_batchbuffer_alloc(blit->bufmgr,
- intel_get_drm_devid(fd));
-
setup_linear_mapping(blit);
cairo_format = drm_format_to_cairo(fb->drm_format);
@@ -2525,12 +2529,6 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
blit->base.fd = fd;
blit->base.fb = fb;
- if (use_rendercopy(fb)) {
- blit->base.bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
- blit->base.batch = intel_batchbuffer_alloc(blit->base.bufmgr,
- intel_get_drm_devid(fd));
- }
-
blit->shadow_ptr = igt_fb_create_cairo_shadow_buffer(fd, drm_format,
fb->width,
fb->height,
--
2.19.2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-28 17:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 17:54 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
2019-03-28 17:54 ` Ville Syrjala [this message]
2019-04-02 23:01 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: Don't leak the bufmgr and batch for converted surfaces Dhinakaran Pandiyan
2019-03-28 18:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_fb: Don't use blitter for large buffers Patchwork
2019-03-28 18:25 ` [igt-dev] [PATCH i-g-t 1/2] " Chris Wilson
2019-04-02 22:41 ` Dhinakaran Pandiyan
2019-04-03 15:24 ` Ville Syrjälä
2019-03-29 4:20 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/2] " Patchwork
2019-04-08 17:13 ` [igt-dev] [PATCH i-g-t v3 1/2] " Ville Syrjala
2019-04-08 17:19 ` Chris Wilson
2019-04-08 17:20 ` Chris Wilson
2019-04-09 12:25 ` Ville Syrjälä
2019-04-09 19:49 ` Chris Wilson
2019-04-09 20:12 ` Ville Syrjälä
2019-04-08 18:02 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/2] lib/igt_fb: Don't use blitter for large buffers (rev2) Patchwork
2019-04-08 21:09 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20190328175450.8370-2-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dhinakaran.pandiyan@intel.com \
--cc=igt-dev@lists.freedesktop.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