[PATCH 2/2] i915: Add format modifiers for Intel
Kristian H. Kristensen
hoegsberg at gmail.com
Wed Dec 21 00:12:22 UTC 2016
Signed-off-by: Kristian H. Kristensen <hoegsberg at gmail.com>
---
drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++++++++++++++---
drivers/gpu/drm/i915/intel_sprite.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9c198fb..6150636 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -61,6 +61,11 @@ static const uint32_t i8xx_primary_formats[] = {
DRM_FORMAT_XRGB8888,
};
+static const struct drm_format_modifier i8xx_format_modifiers[] = {
+ { .formats = 0x0f, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0x0f, .modifier = I915_FORMAT_MOD_X_TILED }
+};
+
/* Primary plane formats for gen >= 4 */
static const uint32_t i965_primary_formats[] = {
DRM_FORMAT_C8,
@@ -71,6 +76,11 @@ static const uint32_t i965_primary_formats[] = {
DRM_FORMAT_XBGR2101010,
};
+static const struct drm_format_modifier i965_format_modifiers[] = {
+ { .formats = 0x3f, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0x3f, .modifier = I915_FORMAT_MOD_X_TILED }
+};
+
static const uint32_t skl_primary_formats[] = {
DRM_FORMAT_C8,
DRM_FORMAT_RGB565,
@@ -86,6 +96,12 @@ static const uint32_t skl_primary_formats[] = {
DRM_FORMAT_VYUY,
};
+static const struct drm_format_modifier skl_format_modifiers[] = {
+ { .formats = 0xfff, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0xff, .modifier = I915_FORMAT_MOD_X_TILED },
+ { .formats = 0x3f, .modifier = I915_FORMAT_MOD_Y_TILED }
+};
+
/* Cursor formats */
static const uint32_t intel_cursor_formats[] = {
DRM_FORMAT_ARGB8888,
@@ -14962,6 +14978,8 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
const uint32_t *intel_primary_formats;
unsigned int supported_rotations;
unsigned int num_formats;
+ const struct drm_format_modifier *intel_format_modifiers;
+ unsigned int num_format_modifiers;
int ret;
primary = kzalloc(sizeof(*primary), GFP_KERNEL);
@@ -14999,24 +15017,32 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
if (INTEL_GEN(dev_priv) >= 9) {
intel_primary_formats = skl_primary_formats;
num_formats = ARRAY_SIZE(skl_primary_formats);
+ intel_format_modifiers = skl_format_modifiers;
+ num_format_modifiers = ARRAY_SIZE(skl_format_modifiers);
primary->update_plane = skylake_update_primary_plane;
primary->disable_plane = skylake_disable_primary_plane;
} else if (HAS_PCH_SPLIT(dev_priv)) {
intel_primary_formats = i965_primary_formats;
num_formats = ARRAY_SIZE(i965_primary_formats);
+ intel_format_modifiers = i965_format_modifiers;
+ num_format_modifiers = ARRAY_SIZE(i965_format_modifiers);
primary->update_plane = ironlake_update_primary_plane;
primary->disable_plane = i9xx_disable_primary_plane;
} else if (INTEL_GEN(dev_priv) >= 4) {
intel_primary_formats = i965_primary_formats;
num_formats = ARRAY_SIZE(i965_primary_formats);
+ intel_format_modifiers = i965_format_modifiers;
+ num_format_modifiers = ARRAY_SIZE(i965_format_modifiers);
primary->update_plane = i9xx_update_primary_plane;
primary->disable_plane = i9xx_disable_primary_plane;
} else {
intel_primary_formats = i8xx_primary_formats;
num_formats = ARRAY_SIZE(i8xx_primary_formats);
+ intel_format_modifiers = i8xx_format_modifiers;
+ num_format_modifiers = ARRAY_SIZE(i8xx_format_modifiers);
primary->update_plane = i9xx_update_primary_plane;
primary->disable_plane = i9xx_disable_primary_plane;
@@ -15026,21 +15052,24 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
ret = drm_universal_plane_init(&dev_priv->drm, &primary->base,
0, &intel_plane_funcs,
intel_primary_formats, num_formats,
- NULL, 0,
+ intel_format_modifiers,
+ num_format_modifiers,
DRM_PLANE_TYPE_PRIMARY,
"plane 1%c", pipe_name(pipe));
else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
ret = drm_universal_plane_init(&dev_priv->drm, &primary->base,
0, &intel_plane_funcs,
intel_primary_formats, num_formats,
- NULL, 0,
+ intel_format_modifiers,
+ num_format_modifiers,
DRM_PLANE_TYPE_PRIMARY,
"primary %c", pipe_name(pipe));
else
ret = drm_universal_plane_init(&dev_priv->drm, &primary->base,
0, &intel_plane_funcs,
intel_primary_formats, num_formats,
- NULL, 0,
+ intel_format_modifiers,
+ num_format_modifiers,
DRM_PLANE_TYPE_PRIMARY,
"plane %c", plane_name(primary->plane));
if (ret)
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index ff766c0..a919d9e 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -989,6 +989,11 @@ static const uint32_t ilk_plane_formats[] = {
DRM_FORMAT_VYUY,
};
+static const struct drm_format_modifier ilk_plane_format_modifiers[] = {
+ { .formats = 0x1f, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0x1f, .modifier = I915_FORMAT_MOD_X_TILED }
+};
+
static const uint32_t snb_plane_formats[] = {
DRM_FORMAT_XBGR8888,
DRM_FORMAT_XRGB8888,
@@ -998,6 +1003,11 @@ static const uint32_t snb_plane_formats[] = {
DRM_FORMAT_VYUY,
};
+static const struct drm_format_modifier snb_plane_format_modifiers[] = {
+ { .formats = 0x3f, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0x3f, .modifier = I915_FORMAT_MOD_X_TILED }
+};
+
static const uint32_t vlv_plane_formats[] = {
DRM_FORMAT_RGB565,
DRM_FORMAT_ABGR8888,
@@ -1012,6 +1022,11 @@ static const uint32_t vlv_plane_formats[] = {
DRM_FORMAT_VYUY,
};
+static const struct drm_format_modifier vlv_plane_format_modifiers[] = {
+ { .formats = 0x7ff, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0x7ff, .modifier = I915_FORMAT_MOD_X_TILED }
+};
+
static uint32_t skl_plane_formats[] = {
DRM_FORMAT_RGB565,
DRM_FORMAT_ABGR8888,
@@ -1024,6 +1039,12 @@ static uint32_t skl_plane_formats[] = {
DRM_FORMAT_VYUY,
};
+static const struct drm_format_modifier skl_plane_format_modifiers[] = {
+ { .formats = 0x1ff, .modifier = DRM_FORMAT_MOD_NONE },
+ { .formats = 0x1ff, .modifier = I915_FORMAT_MOD_X_TILED },
+ { .formats = 0x01f, .modifier = I915_FORMAT_MOD_Y_TILED }
+};
+
struct intel_plane *
intel_sprite_plane_create(struct drm_i915_private *dev_priv,
enum pipe pipe, int plane)
@@ -1032,8 +1053,9 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
struct intel_plane_state *state = NULL;
unsigned long possible_crtcs;
const uint32_t *plane_formats;
+ const struct drm_format_modifier *modifiers;
unsigned int supported_rotations;
- int num_plane_formats;
+ int num_plane_formats, num_modifiers;
int ret;
intel_plane = kzalloc(sizeof(*intel_plane), GFP_KERNEL);
@@ -1058,6 +1080,8 @@ 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;
+ num_modifiers = ARRAY_SIZE(skl_plane_format_modifiers);
} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
intel_plane->can_scale = false;
intel_plane->max_downscale = 1;
@@ -1067,6 +1091,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
plane_formats = vlv_plane_formats;
num_plane_formats = ARRAY_SIZE(vlv_plane_formats);
+ modifiers = vlv_plane_format_modifiers;
+ num_modifiers = ARRAY_SIZE(vlv_plane_format_modifiers);
} else if (INTEL_GEN(dev_priv) >= 7) {
if (IS_IVYBRIDGE(dev_priv)) {
intel_plane->can_scale = true;
@@ -1081,6 +1107,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
plane_formats = snb_plane_formats;
num_plane_formats = ARRAY_SIZE(snb_plane_formats);
+ modifiers = snb_plane_format_modifiers;
+ num_modifiers = ARRAY_SIZE(snb_plane_format_modifiers);
} else {
intel_plane->can_scale = true;
intel_plane->max_downscale = 16;
@@ -1091,9 +1119,13 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
if (IS_GEN6(dev_priv)) {
plane_formats = snb_plane_formats;
num_plane_formats = ARRAY_SIZE(snb_plane_formats);
+ modifiers = snb_plane_format_modifiers;
+ num_modifiers = ARRAY_SIZE(snb_plane_format_modifiers);
} else {
plane_formats = ilk_plane_formats;
num_plane_formats = ARRAY_SIZE(ilk_plane_formats);
+ modifiers = ilk_plane_format_modifiers;
+ num_modifiers = ARRAY_SIZE(ilk_plane_format_modifiers);
}
}
@@ -1121,12 +1153,14 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base,
possible_crtcs, &intel_plane_funcs,
plane_formats, num_plane_formats,
+ modifiers, num_modifiers,
DRM_PLANE_TYPE_OVERLAY,
"plane %d%c", plane + 2, pipe_name(pipe));
else
ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base,
possible_crtcs, &intel_plane_funcs,
plane_formats, num_plane_formats,
+ modifiers, num_modifiers,
DRM_PLANE_TYPE_OVERLAY,
"sprite %c", sprite_name(pipe, plane));
if (ret)
--
2.9.3
More information about the dri-devel
mailing list