[Intel-gfx] [RFC 21/28] drm/i915: Allow render state to be compiled out

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Apr 14 11:50:21 UTC 2021


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/Makefile                |  8 ++++----
 drivers/gpu/drm/i915/i915_gem_render_state.c | 10 ++++------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index f55cc028b2eb..dd523e037523 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -92,10 +92,10 @@ i915-y += intel_uc.o \
 	  intel_huc.o
 
 # autogenerated null render state
-i915-y += intel_renderstate_gen6.o \
-	  intel_renderstate_gen7.o \
-	  intel_renderstate_gen8.o \
-	  intel_renderstate_gen9.o
+i915-$(CONFIG_DRM_I915_GEN6) += intel_renderstate_gen6.o
+i915-$(CONFIG_DRM_I915_GEN7) += intel_renderstate_gen7.o
+i915-$(CONFIG_DRM_I915_GEN8) += intel_renderstate_gen8.o
+i915-$(CONFIG_DRM_I915_GEN9) += intel_renderstate_gen9.o
 
 # modesetting core code
 i915-y += intel_audio.o \
diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.c b/drivers/gpu/drm/i915/i915_gem_render_state.c
index f7fc0df251ac..26f7940049dc 100644
--- a/drivers/gpu/drm/i915/i915_gem_render_state.c
+++ b/drivers/gpu/drm/i915/i915_gem_render_state.c
@@ -45,16 +45,14 @@ render_state_get_rodata(const struct intel_engine_cs *engine)
 	if (engine->id != RCS)
 		return NULL;
 
-	switch (INTEL_GEN(engine->i915)) {
-	case 6:
+	if (IS_GEN6(engine->i915))
 		return &gen6_null_state;
-	case 7:
+	else if (IS_GEN7(engine->i915))
 		return &gen7_null_state;
-	case 8:
+	else if (IS_GEN8(engine->i915))
 		return &gen8_null_state;
-	case 9:
+	else if (IS_GEN9(engine->i915))
 		return &gen9_null_state;
-	}
 
 	return NULL;
 }
-- 
2.27.0



More information about the Intel-gfx mailing list