[4/4] drm/i915: Add support for CCS modifiers

Submitted by Ben Widawsky on July 24, 2017, 3:46 a.m.

Details

Message ID 20170724034641.13369-5-ben@bwidawsk.net
State New
Headers show
Series "Blobifiers (FKA GET_PLANE2)" ( rev: 3 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Ben Widawsky July 24, 2017, 3:46 a.m.
v2:
Support sprite plane.
Support pipe C/D limitation on GEN9.

v3:
Rename structure (Ville)
Handle GLK (Ville)

This requires rebase on the correct Ville patches

Cc: Daniel Stone <daniels@collabora.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/intel_display.c | 30 +++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_sprite.c  | 25 ++++++++++++++++++++++++-
 2 files changed, 51 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 34c37f82acb2..44747ed9ee38 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -88,7 +88,17 @@  static const uint32_t skl_primary_formats[] = {
 	DRM_FORMAT_VYUY,
 };
 
-static const uint64_t skl_format_modifiers[] = {
+static const uint64_t skl_format_modifiers_noccs[] = {
+	I915_FORMAT_MOD_Yf_TILED,
+	I915_FORMAT_MOD_Y_TILED,
+	I915_FORMAT_MOD_X_TILED,
+	DRM_FORMAT_MOD_LINEAR,
+	DRM_FORMAT_MOD_INVALID
+};
+
+static const uint64_t skl_format_modifiers_ccs[] = {
+	I915_FORMAT_MOD_Yf_TILED_CCS,
+	I915_FORMAT_MOD_Y_TILED_CCS,
 	I915_FORMAT_MOD_Yf_TILED,
 	I915_FORMAT_MOD_Y_TILED,
 	I915_FORMAT_MOD_X_TILED,
@@ -12862,6 +12872,10 @@  static bool skl_mod_supported(uint32_t format, uint64_t modifier)
 	case DRM_FORMAT_XBGR8888:
 	case DRM_FORMAT_ARGB8888:
 	case DRM_FORMAT_ABGR8888:
+		if (modifier == I915_FORMAT_MOD_Yf_TILED_CCS ||
+		    modifier == I915_FORMAT_MOD_Y_TILED_CCS)
+		return true;
+		/* fall through */
 	case DRM_FORMAT_RGB565:
 	case DRM_FORMAT_XRGB2101010:
 	case DRM_FORMAT_XBGR2101010:
@@ -13108,10 +13122,20 @@  intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 	primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe);
 	primary->check_plane = intel_check_primary_plane;
 
-	if (INTEL_GEN(dev_priv) >= 9) {
+	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
+		intel_primary_formats = skl_primary_formats;
+		num_formats = ARRAY_SIZE(skl_primary_formats);
+		modifiers = skl_format_modifiers_ccs;
+
+		primary->update_plane = skylake_update_primary_plane;
+		primary->disable_plane = skylake_disable_primary_plane;
+	} else if (INTEL_GEN(dev_priv) >= 9) {
 		intel_primary_formats = skl_primary_formats;
 		num_formats = ARRAY_SIZE(skl_primary_formats);
-		modifiers = skl_format_modifiers;
+		if (pipe >= PIPE_C)
+			modifiers = skl_format_modifiers_ccs;
+		else
+			modifiers = skl_format_modifiers_noccs;
 
 		primary->update_plane = skylake_update_primary_plane;
 		primary->disable_plane = skylake_disable_primary_plane;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 05a15063ee97..97d29cc061ad 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1079,7 +1079,17 @@  static uint32_t skl_plane_formats[] = {
 	DRM_FORMAT_VYUY,
 };
 
+static const uint64_t skl_plane_format_modifiers_noccs[] = {
+	I915_FORMAT_MOD_Yf_TILED,
+	I915_FORMAT_MOD_Y_TILED,
+	I915_FORMAT_MOD_X_TILED,
+	DRM_FORMAT_MOD_LINEAR,
+	DRM_FORMAT_MOD_INVALID
+};
+
 static const uint64_t skl_plane_format_modifiers[] = {
+	I915_FORMAT_MOD_Yf_TILED_CCS,
+	I915_FORMAT_MOD_Y_TILED_CCS,
 	I915_FORMAT_MOD_Yf_TILED,
 	I915_FORMAT_MOD_Y_TILED,
 	I915_FORMAT_MOD_X_TILED,
@@ -1224,7 +1234,7 @@  intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 	}
 	intel_plane->base.state = &state->base;
 
-	if (INTEL_GEN(dev_priv) >= 9) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		intel_plane->can_scale = true;
 		state->scaler_id = -1;
 
@@ -1234,6 +1244,19 @@  intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 		plane_formats = skl_plane_formats;
 		num_plane_formats = ARRAY_SIZE(skl_plane_formats);
 		modifiers = skl_plane_format_modifiers;
+	} else if (INTEL_GEN(dev_priv) >= 9) {
+		intel_plane->can_scale = true;
+		state->scaler_id = -1;
+
+		intel_plane->update_plane = skl_update_plane;
+		intel_plane->disable_plane = skl_disable_plane;
+
+		plane_formats = skl_plane_formats;
+		num_plane_formats = ARRAY_SIZE(skl_plane_formats);
+		if (pipe >= PIPE_C)
+			modifiers = skl_plane_format_modifiers_noccs;
+		else
+			modifiers = skl_plane_format_modifiers;
 	} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
 		intel_plane->can_scale = false;
 		intel_plane->max_downscale = 1;

Comments

Hi Ben,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.13-rc2 next-20170724]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ben-Widawsky/drm-Plumb-modifiers-through-plane-init/20170725-062539
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/intel_display.c:105:2: error: 'I915_FORMAT_MOD_Yf_TILED_CCS' undeclared here (not in a function)
     I915_FORMAT_MOD_Yf_TILED_CCS,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/intel_display.c:106:2: error: 'I915_FORMAT_MOD_Y_TILED_CCS' undeclared here (not in a function)
     I915_FORMAT_MOD_Y_TILED_CCS,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/intel_display.c: In function 'skl_mod_supported':
>> drivers/gpu/drm/i915/intel_display.c:13642:16: warning: comparison between pointer and integer
      if (modifier == I915_FORMAT_MOD_Yf_TILED_CCS ||
                   ^~
   drivers/gpu/drm/i915/intel_display.c:13643:16: warning: comparison between pointer and integer
          modifier == I915_FORMAT_MOD_Y_TILED_CCS)
                   ^~
--
>> drivers/gpu/drm/i915/intel_sprite.c:1092:2: error: 'I915_FORMAT_MOD_Yf_TILED_CCS' undeclared here (not in a function)
     I915_FORMAT_MOD_Yf_TILED_CCS,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/intel_sprite.c:1093:2: error: 'I915_FORMAT_MOD_Y_TILED_CCS' undeclared here (not in a function)
     I915_FORMAT_MOD_Y_TILED_CCS,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/I915_FORMAT_MOD_Yf_TILED_CCS +105 drivers/gpu/drm/i915/intel_display.c

   103	
   104	static const uint64_t skl_format_modifiers_ccs[] = {
 > 105		I915_FORMAT_MOD_Yf_TILED_CCS,
 > 106		I915_FORMAT_MOD_Y_TILED_CCS,
   107		I915_FORMAT_MOD_Yf_TILED,
   108		I915_FORMAT_MOD_Y_TILED,
   109		I915_FORMAT_MOD_X_TILED,
   110		DRM_FORMAT_MOD_LINEAR,
   111		DRM_FORMAT_MOD_INVALID
   112	};
   113	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation