dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Stone <daniels@collabora.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH 2/4] drm/i915: Move GEM BO inside drm_framebuffer
Date: Fri, 23 Mar 2018 13:45:50 +0000	[thread overview]
Message-ID: <20180323134553.15993-2-daniels@collabora.com> (raw)
In-Reply-To: <20180323134553.15993-1-daniels@collabora.com>

Since drm_framebuffer can now store GEM objects directly, place them
there rather than in our own subclass.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/intel_display.c | 15 ++++++++++++---
 drivers/gpu/drm/i915/intel_drv.h     |  3 +--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 49b0772e9abc..e8100a4fc877 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13916,7 +13916,8 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	drm_framebuffer_cleanup(fb);
 
 	i915_gem_object_lock(obj);
-	WARN_ON(!obj->framebuffer_references--);
+	WARN_ON(obj->framebuffer_references < fb->format->num_planes);
+	obj->framebuffer_references -= fb->format->num_planes;
 	i915_gem_object_unlock(obj);
 
 	i915_gem_object_put(obj);
@@ -14176,9 +14177,9 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 				      i, fb->pitches[i], stride_alignment);
 			goto err;
 		}
-	}
 
-	intel_fb->obj = obj;
+		fb->obj[i] = &obj->base;
+	}
 
 	ret = intel_fill_fb_info(dev_priv, fb);
 	if (ret)
@@ -14190,6 +14191,14 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 		goto err;
 	}
 
+	/* We already hold one reference to the fb, but in case it's
+	 * multi-planar and we've placed multiple pointers in
+	 * drm_framebuffer, hold extra refs.
+	 */
+	i915_gem_object_lock(obj);
+	obj->framebuffer_references += fb->format->num_planes - 1;
+	i915_gem_object_unlock(obj);
+
 	return 0;
 
 err:
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 570f89b31544..d93ed9e59867 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -186,7 +186,6 @@ enum intel_output_type {
 
 struct intel_framebuffer {
 	struct drm_framebuffer base;
-	struct drm_i915_gem_object *obj;
 	struct intel_rotation_info rot_info;
 
 	/* for each plane in the normal GTT view */
@@ -985,7 +984,7 @@ struct cxsr_latency {
 #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
 #define to_intel_plane(x) container_of(x, struct intel_plane, base)
 #define to_intel_plane_state(x) container_of(x, struct intel_plane_state, base)
-#define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL)
+#define intel_fb_obj(x) (((x) && (x)->obj[0]) ? to_intel_bo((x)->obj[0]) : NULL)
 
 struct intel_hdmi {
 	i915_reg_t hdmi_reg;
-- 
2.16.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-03-23 13:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 13:42 [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
2018-03-23 13:45 ` [PATCH 1/4] drm/i915: Use intel_fb_obj() everywhere Daniel Stone
2018-03-23 13:45   ` Daniel Stone [this message]
2018-03-23 14:42     ` [Intel-gfx] [PATCH 2/4] drm/i915: Move GEM BO inside drm_framebuffer Ville Syrjälä
2018-03-23 14:49       ` Daniel Stone
2018-05-17 13:18         ` [Intel-gfx] " Daniel Stone
2018-03-23 13:45   ` [PATCH 3/4] drm: Reshuffle getfb error returns Daniel Stone
2018-03-23 14:43     ` Ville Syrjälä
2018-03-23 13:45   ` [PATCH 4/4] drm: Add getfb2 ioctl Daniel Stone
2018-03-23 14:49     ` Ville Syrjälä
2018-03-23 17:00       ` Daniel Stone
2018-03-23 17:31         ` Ville Syrjälä
2018-03-24 10:12           ` Daniel Stone
2018-03-23 13:45   ` [PATCH libdrm] NOMERGE: Add drmModeGetFB2 Daniel Stone
2018-03-23 13:46 ` [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone
2018-03-23 13:46   ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone
2018-03-23 13:46   ` [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone
2018-03-23 15:01     ` [igt-dev] " Ville Syrjälä
2018-03-23 14:53   ` [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä
2018-03-23 14:55     ` [igt-dev] " Daniel Stone
2018-03-23 13:51 ` [PATCH 0/8] Add GetFB2 ioctl Daniel Stone

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=20180323134553.15993-2-daniels@collabora.com \
    --to=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /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