summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
authorDamien Lespiau2014-02-07 20:12:49 +0100
committerDaniel Vetter2014-02-12 18:52:51 +0100
commit22d3fd4600fcb3da3df63157234a241485b58157 (patch)
treeeeca264628871f65564c93d75ae94c6431fb1903 /drivers/gpu/drm/i915/i915_dma.c
parentdrm/i915: Make the intel_device_info structure kept in dev_priv writable (diff)
downloadkernel-qcow2-linux-22d3fd4600fcb3da3df63157234a241485b58157.tar.gz
kernel-qcow2-linux-22d3fd4600fcb3da3df63157234a241485b58157.tar.xz
kernel-qcow2-linux-22d3fd4600fcb3da3df63157234a241485b58157.zip
drm/i915: Move num_plane to the intel_device_info structure
And rename it to num_sprites as this value doesn't count the primary plane. 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. v2: rename num_plane to num_sprites (Ville Syrjälä) v3: rebase on top of latest drm-nightly Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> (for v2) Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (for v2) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 0a9d0adc5a63..e281298c6fd5 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1459,6 +1459,25 @@ 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;
+
+ info = (struct intel_device_info *)&to_i915(dev)->info;
+
+ info->num_sprites = 1;
+ if (IS_VALLEYVIEW(dev))
+ info->num_sprites = 2;
+}
+
/**
* i915_driver_load - setup chip and create an initial config
* @dev: DRM device
@@ -1638,9 +1657,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);