drm/i915: Introduce HAS_64BIT_RELOC
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Thu, 3 Nov 2016 08:39:46 +0000 (10:39 +0200)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Thu, 3 Nov 2016 10:45:57 +0000 (12:45 +0200)
Move has_64bit_reloc into dev_priv->info. This will make it visible
in the feature listing debug output.

v2:
- Keep the struct member to keep GCC fragile but happy (Chris)
v3:
- More detailed commit message (Chris)
- Include forgotten CHV and BXT (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1478162386-5018-1-git-send-email-joonas.lahtinen@linux.intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_gem_render_state.c
drivers/gpu/drm/i915/i915_pci.c

index eaa01da892a4f31356c6e76d4c35613b6162fbfb..ae0217d70b99654e65e615b4a6516fdde54cc25c 100644 (file)
@@ -670,6 +670,7 @@ struct intel_csr {
        func(is_kabylake); \
        func(is_preliminary); \
        /* Keep has_* in alphabetical order */ \
+       func(has_64bit_reloc); \
        func(has_csr); \
        func(has_ddi); \
        func(has_dp_mst); \
@@ -2917,6 +2918,8 @@ struct drm_i915_cmd_table {
 #define HAS_CSR(dev)   (INTEL_INFO(dev)->has_csr)
 
 #define HAS_RUNTIME_PM(dev_priv) ((dev_priv)->info.has_runtime_pm)
+#define HAS_64BIT_RELOC(dev_priv) ((dev_priv)->info.has_64bit_reloc)
+
 /*
  * For now, anything with a GuC requires uCode loading, and then supports
  * command submission once loaded. But these are logically independent
index c35e847bb8bc74e06a811cd31a92c60b301c0d68..322c580a739fcd3d754d07fa8b26fba115f82e7c 100644 (file)
@@ -331,7 +331,8 @@ static void reloc_cache_init(struct reloc_cache *cache,
        cache->page = -1;
        cache->vaddr = 0;
        cache->i915 = i915;
-       cache->use_64bit_reloc = INTEL_GEN(cache->i915) >= 8;
+       /* Must be a variable in the struct to allow GCC to unroll. */
+       cache->use_64bit_reloc = HAS_64BIT_RELOC(i915);
        cache->node.allocated = false;
 }
 
index 57918f21ecc3f9962bba4eceeae7bde5db6a91d7..5af19b0bf71366e7471fa5805104a5e47839c629 100644 (file)
@@ -74,7 +74,6 @@ static int render_state_setup(struct intel_render_state *so,
                              struct drm_i915_private *i915)
 {
        const struct intel_renderstate_rodata *rodata = so->rodata;
-       const bool has_64bit_reloc = INTEL_GEN(i915) >= 8;
        struct drm_i915_gem_object *obj = so->vma->obj;
        unsigned int i = 0, reloc_index = 0;
        unsigned int needs_clflush;
@@ -93,7 +92,7 @@ static int render_state_setup(struct intel_render_state *so,
                if (i * 4  == rodata->reloc[reloc_index]) {
                        u64 r = s + so->vma->node.start;
                        s = lower_32_bits(r);
-                       if (has_64bit_reloc) {
+                       if (HAS_64BIT_RELOC(i915)) {
                                if (i + 1 >= rodata->batch_items ||
                                    rodata->batch[i + 1] != 0)
                                        goto err;
index 31e6edd08dd0525ce9b4477df9e77a3c1ed0c2d5..2a419500b81a8164d476922998f3e7ec7c868e0e 100644 (file)
@@ -288,7 +288,8 @@ static const struct intel_device_info intel_haswell_info = {
 #define BDW_FEATURES \
        HSW_FEATURES, \
        BDW_COLORS, \
-       .has_logical_ring_contexts = 1
+       .has_logical_ring_contexts = 1, \
+       .has_64bit_reloc = 1
 
 static const struct intel_device_info intel_broadwell_info = {
        BDW_FEATURES,
@@ -308,6 +309,7 @@ static const struct intel_device_info intel_cherryview_info = {
        .has_hotplug = 1,
        .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
        .is_cherryview = 1,
+       .has_64bit_reloc = 1,
        .has_psr = 1,
        .has_runtime_pm = 1,
        .has_resource_streamer = 1,
@@ -347,6 +349,7 @@ static const struct intel_device_info intel_broxton_info = {
        .has_hotplug = 1,
        .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
        .num_pipes = 3,
+       .has_64bit_reloc = 1,
        .has_ddi = 1,
        .has_fpga_dbg = 1,
        .has_fbc = 1,