From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 04/15] drm/mode: introduce wrapper to read framebuffer refcount.
Date: Fri, 15 Apr 2016 15:10:35 +1000 [thread overview]
Message-ID: <1460697046-23781-5-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1460697046-23781-1-git-send-email-airlied@gmail.com>
From: Dave Airlie <airlied@redhat.com>
Avoids drivers knowing where the kref is stored.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/drm_crtc.c | 2 +-
drivers/gpu/drm/i915/i915_debugfs.c | 4 ++--
drivers/gpu/drm/msm/msm_fb.c | 2 +-
drivers/gpu/drm/tegra/drm.c | 2 +-
include/drm/drm_crtc.h | 5 +++++
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 0ad1a92..8616737 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -612,7 +612,7 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
* in-use fb with fb-id == 0. Userspace is allowed to shoot its own foot
* in this manner.
*/
- if (atomic_read(&fb->refcount.refcount) > 1) {
+ if (drm_framebuffer_read_refcount(fb) > 1) {
drm_modeset_lock_all(dev);
/* remove from any CRTC */
drm_for_each_crtc(crtc, dev) {
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index a0f1bd7..20d9300 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1908,7 +1908,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
fbdev_fb->base.depth,
fbdev_fb->base.bits_per_pixel,
fbdev_fb->base.modifier[0],
- atomic_read(&fbdev_fb->base.refcount.refcount));
+ drm_framebuffer_read_refcount(&fbdev_fb->base));
describe_obj(m, fbdev_fb->obj);
seq_putc(m, '\n');
}
@@ -1926,7 +1926,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
fb->base.depth,
fb->base.bits_per_pixel,
fb->base.modifier[0],
- atomic_read(&fb->base.refcount.refcount));
+ drm_framebuffer_read_refcount(&fb->base));
describe_obj(m, fb->obj);
seq_putc(m, '\n');
}
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index a474d6c..17e0c9e 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -77,7 +77,7 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)
seq_printf(m, "fb: %dx%d@%4.4s (%2d, ID:%d)\n",
fb->width, fb->height, (char *)&fb->pixel_format,
- fb->refcount.refcount.counter, fb->base.id);
+ drm_framebuffer_read_refcount(fb), fb->base.id);
for (i = 0; i < n; i++) {
seq_printf(m, " %d: offset=%d pitch=%d, obj: ",
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 8e6b18c..2be88eb 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -878,7 +878,7 @@ static int tegra_debugfs_framebuffers(struct seq_file *s, void *data)
seq_printf(s, "%3d: user size: %d x %d, depth %d, %d bpp, refcount %d\n",
fb->base.id, fb->width, fb->height, fb->depth,
fb->bits_per_pixel,
- atomic_read(&fb->refcount.refcount));
+ drm_framebuffer_read_refcount(fb));
}
mutex_unlock(&drm->mode_config.fb_lock);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e0170bf..99a12f0 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -2608,6 +2608,11 @@ static inline uint32_t drm_color_lut_extract(uint32_t user_input,
return clamp_val(val, 0, max);
}
+static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb)
+{
+ return atomic_read(&fb->refcount.refcount);
+}
+
/* Plane list iterator for legacy (overlay only) planes. */
#define drm_for_each_legacy_plane(plane, dev) \
list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
--
2.5.5
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-04-15 5:10 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 5:10 drm reference counter connectors and fix lifetimes Dave Airlie
2016-04-15 5:10 ` [PATCH 01/15] drm/mode: rework drm_mode_object_put to drm_mode_object_unregister Dave Airlie
2016-04-21 8:03 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 02/15] drm/mode: move framebuffer_free up above framebuffer_init Dave Airlie
2016-04-21 8:03 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 03/15] drm/modes: drop __drm_framebuffer_unregister Dave Airlie
2016-04-21 8:05 ` Daniel Vetter
2016-04-15 5:10 ` Dave Airlie [this message]
2016-04-21 8:07 ` [PATCH 04/15] drm/mode: introduce wrapper to read framebuffer refcount Daniel Vetter
2016-04-15 5:10 ` [PATCH 05/15] drm/mode: move framebuffer reference into object Dave Airlie
2016-04-21 8:12 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 06/15] drm/mode: use _object_find to find framebuffers Dave Airlie
2016-04-21 8:14 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 07/15] drm/mode: reduce scope of fb_lock in framebuffer init Dave Airlie
2016-04-21 8:54 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 08/15] drm/mode: reduce lock hold in addfb2 Dave Airlie
2016-04-21 8:59 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 09/15] drm/modes: move reference taking into object lookup Dave Airlie
2016-04-21 9:05 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 10/15] drm/modes: reduce fb_lock to just protecting lists Dave Airlie
2016-04-21 9:06 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 11/15] drm/modes: stop handling framebuffer special Dave Airlie
2016-04-21 9:06 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 12/15] drm/modes: add connector reference counting Dave Airlie
2016-04-22 9:24 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 13/15] drm: take references to connectors used in a modeset Dave Airlie
2016-04-22 8:49 ` Daniel Vetter
2016-04-27 1:44 ` Dave Airlie
2016-04-15 5:10 ` [PATCH 14/15] drm/i915/mst: use reference counted connectors Dave Airlie
2016-04-22 9:03 ` Daniel Vetter
2016-04-27 1:54 ` Dave Airlie
2016-04-27 6:29 ` Daniel Vetter
2016-04-15 5:10 ` [PATCH 15/15] drm/radeon/dp_mst: use connector ref counting Dave Airlie
2016-04-22 9:04 ` Daniel Vetter
2016-04-21 9:08 ` drm reference counter connectors and fix lifetimes Daniel Vetter
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=1460697046-23781-5-git-send-email-airlied@gmail.com \
--to=airlied@gmail.com \
--cc=dri-devel@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;
as well as URLs for NNTP newsgroup(s).