From: Damien Lespiau <damien.lespiau@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/6] drm/i915: Move num_plane to the intel_device_info structure
Date: Thu, 12 Dec 2013 11:20:59 +0000 [thread overview]
Message-ID: <1386847263-2885-3-git-send-email-damien.lespiau@intel.com> (raw)
In-Reply-To: <1386847263-2885-1-git-send-email-damien.lespiau@intel.com>
And rename it to num_planes to match num_pipes.
This limit lives with num_pipes really, and now that dev_priv->info is
writable we can put it there instead.
While at it, introduce a intel_device_info_runtime_init() where we'll be
able to gather the device info fields at run-time.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
drivers/gpu/drm/i915/i915_dma.c | 21 ++++++++++++++++++---
drivers/gpu/drm/i915/i915_drv.h | 5 ++---
drivers/gpu/drm/i915/intel_display.c | 4 ++--
3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 332d5b6..0f75d5c7 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1459,6 +1459,23 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv)
#undef SEP_COMMA
}
+/*
+ * Determine various intel_device_info fields at runtime.
+ *
+ * Use it when either:
+ * - it's judged too laborious to fill n static structures with the limit
+ * when a simple if statement does the job,
+ * - run-time checks (eg read fuse/strap registers) are needed.
+ */
+static void intel_device_info_runtime_init(struct drm_device *dev)
+{
+ struct intel_device_info *info = INTEL_INFO(dev);
+
+ info->num_planes = 1;
+ if (IS_VALLEYVIEW(dev))
+ info->num_planes = 2;
+}
+
/**
* i915_driver_load - setup chip and create an initial config
* @dev: DRM device
@@ -1631,9 +1648,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
if (!IS_I945G(dev) && !IS_I945GM(dev))
pci_enable_msi(dev->pdev);
- dev_priv->num_plane = 1;
- if (IS_VALLEYVIEW(dev))
- dev_priv->num_plane = 2;
+ intel_device_info_runtime_init(dev);
if (INTEL_INFO(dev)->num_pipes) {
ret = drm_vblank_init(dev, INTEL_INFO(dev)->num_pipes);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6a7844c..704dc7d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -77,7 +77,7 @@ enum plane {
};
#define plane_name(p) ((p) + 'A')
-#define sprite_name(p, s) ((p) * dev_priv->num_plane + (s) + 'A')
+#define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_planes + (s) + 'A')
enum port {
PORT_A = 0,
@@ -503,6 +503,7 @@ struct intel_uncore {
struct intel_device_info {
u32 display_mmio_offset;
u8 num_pipes:3;
+ u8 num_planes:2;
u8 gen;
u8 ring_mask; /* Rings supported by the HW */
DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON);
@@ -1389,8 +1390,6 @@ typedef struct drm_i915_private {
u32 hpd_event_bits;
struct timer_list hotplug_reenable_timer;
- int num_plane;
-
struct i915_fbc fbc;
struct intel_opregion opregion;
struct intel_vbt_data vbt;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 71876d9..25cbe36 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1189,7 +1189,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
u32 val;
if (IS_VALLEYVIEW(dev)) {
- for (i = 0; i < dev_priv->num_plane; i++) {
+ for (i = 0; i < INTEL_INFO(dev)->num_planes; i++) {
reg = SPCNTR(pipe, i);
val = I915_READ(reg);
WARN((val & SP_ENABLE),
@@ -10862,7 +10862,7 @@ void intel_modeset_init(struct drm_device *dev)
for_each_pipe(i) {
intel_crtc_init(dev, i);
- for (j = 0; j < dev_priv->num_plane; j++) {
+ for (j = 0; j < INTEL_INFO(dev)->num_planes; j++) {
ret = intel_plane_init(dev, i, j);
if (ret)
DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n",
--
1.8.3.1
next prev parent reply other threads:[~2013-12-12 11:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 11:20 Supporting fused display configurations v2 Damien Lespiau
2013-12-12 11:20 ` [PATCH 1/6] drm/i915: Make the intel_device_info structure kept in dev_priv writable Damien Lespiau
2013-12-12 11:42 ` Ville Syrjälä
2013-12-12 11:20 ` Damien Lespiau [this message]
2013-12-12 11:40 ` [PATCH 2/6] drm/i915: Move num_plane to the intel_device_info structure Ville Syrjälä
2013-12-12 11:21 ` [PATCH 3/6] drm/i915: Consolidate FUSE_STRAP in one set of defines Damien Lespiau
2013-12-12 11:21 ` [PATCH 4/6] drm/i915: Disable display when fused off Damien Lespiau
2013-12-12 11:21 ` [PATCH 5/6] drm/i915: Remove the Quanta special case Damien Lespiau
2013-12-12 11:21 ` [PATCH 6/6] drm/i915: Use I915_MAX_PIPES in the pipe/plane_to_crtc_mapping definitions Damien Lespiau
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=1386847263-2885-3-git-send-email-damien.lespiau@intel.com \
--to=damien.lespiau@intel.com \
--cc=intel-gfx@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