From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH] drm/i915: Promote .format_mod_supported() to the lead role Date: Fri, 30 Mar 2018 12:06:11 -0700 Message-ID: <87sh8hfknw.fsf@anholt.net> References: <20180319165017.31908-1-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0746446107==" Return-path: In-Reply-To: <20180319165017.31908-1-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ville Syrjala , intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0746446107== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ville Syrjala writes: > From: Ville Syrj=C3=A4l=C3=A4 > > Up to now we've used the plane's modifier list as the primary > source of information for which modifiers are supported by a > given plane. In order to allow auxiliary metadata to be embedded > within the bits of the modifier we need to stop doing that. > > Thus we have to make .format_mod_supported() aware of the plane's > capabilities and gracefully deal with any modifier being passed > in directly from userspace. I took a look, and I think you have the chance to delete a whole ton of code if you keep the assumption that the core will check that the format is one of plane->format_types. > > Cc: Eric Anholt > References: https://lists.freedesktop.org/archives/dri-devel/2018-March/1= 69782.html > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > drivers/gpu/drm/i915/intel_display.c | 147 +++++++++++++++----------- > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_sprite.c | 194 ++++++++++++++++++++++-------= ------ > 3 files changed, 210 insertions(+), 132 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/= intel_display.c > index 3e7ab75e1b41..d717004be0b8 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -88,15 +88,7 @@ static const uint32_t skl_primary_formats[] =3D { > DRM_FORMAT_VYUY, > }; >=20=20 > -static const uint64_t skl_format_modifiers_noccs[] =3D { > - 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[] =3D { > +static const uint64_t skl_format_modifiers[] =3D { > I915_FORMAT_MOD_Yf_TILED_CCS, > I915_FORMAT_MOD_Y_TILED_CCS, > I915_FORMAT_MOD_Yf_TILED, > @@ -12997,8 +12989,17 @@ void intel_plane_destroy(struct drm_plane *plane) > kfree(to_intel_plane(plane)); > } >=20=20 > -static bool i8xx_mod_supported(uint32_t format, uint64_t modifier) > +static bool i8xx_plane_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + break; > + default: > + return false; > + } > + I think you could just remove the format-dependent switch below in favor of s/break/return true/. It's just a list of all the formats in i8xx_primary_formats[]. > switch (format) { > case DRM_FORMAT_C8: > case DRM_FORMAT_RGB565: > @@ -13011,8 +13012,17 @@ static bool i8xx_mod_supported(uint32_t format, = uint64_t modifier) > } > } >=20=20 > -static bool i965_mod_supported(uint32_t format, uint64_t modifier) > +static bool i965_plane_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + break; > + default: > + return false; > + } Again, there's no format dependence, so drop the switch statement, and probably just reuse the mod_supported func from 8xx. > + > switch (format) { > case DRM_FORMAT_C8: > case DRM_FORMAT_RGB565: > @@ -13027,17 +13037,37 @@ static bool i965_mod_supported(uint32_t format,= uint64_t modifier) > } > } >=20=20 > -static bool skl_mod_supported(uint32_t format, uint64_t modifier) > +static bool skl_plane_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + struct intel_plane *plane =3D to_intel_plane(_plane); > + > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + case I915_FORMAT_MOD_Y_TILED: > + case I915_FORMAT_MOD_Yf_TILED: > + break; > + case I915_FORMAT_MOD_Y_TILED_CCS: > + case I915_FORMAT_MOD_Yf_TILED_CCS: > + if (!plane->has_ccs) > + return false; > + break; > + default: > + return false; > + } > + > switch (format) { > case DRM_FORMAT_XRGB8888: > case DRM_FORMAT_XBGR8888: > case DRM_FORMAT_ARGB8888: > case DRM_FORMAT_ABGR8888: > - if (modifier =3D=3D I915_FORMAT_MOD_Yf_TILED_CCS || > - modifier =3D=3D I915_FORMAT_MOD_Y_TILED_CCS) > - return true; > - /* fall through */ I think these SKL changes could have just been done with a "&& plane->has_ccs" in this '-' area. I do think the new version is more readable, though. > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Yf_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED_CCS || > + modifier =3D=3D I915_FORMAT_MOD_Yf_TILED_CCS; > case DRM_FORMAT_RGB565: > case DRM_FORMAT_XRGB2101010: > case DRM_FORMAT_XBGR2101010: > @@ -13045,52 +13075,49 @@ static bool skl_mod_supported(uint32_t format, = uint64_t modifier) > case DRM_FORMAT_YVYU: > case DRM_FORMAT_UYVY: > case DRM_FORMAT_VYUY: > - if (modifier =3D=3D I915_FORMAT_MOD_Yf_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Yf_TILED; > case DRM_FORMAT_C8: > - if (modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > - modifier =3D=3D I915_FORMAT_MOD_X_TILED || > - modifier =3D=3D I915_FORMAT_MOD_Y_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED; > default: > return false; > } > } >=20=20 > -static bool intel_primary_plane_format_mod_supported(struct drm_plane *p= lane, > - uint32_t format, > - uint64_t modifier) > +static bool intel_cursor_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > - struct drm_i915_private *dev_priv =3D to_i915(plane->dev); > - > - if (WARN_ON(modifier =3D=3D DRM_FORMAT_MOD_INVALID)) > - return false; > - > - if ((modifier >> 56) !=3D DRM_FORMAT_MOD_VENDOR_INTEL && > - modifier !=3D DRM_FORMAT_MOD_LINEAR) > - return false; > - > - if (INTEL_GEN(dev_priv) >=3D 9) > - return skl_mod_supported(format, modifier); > - else if (INTEL_GEN(dev_priv) >=3D 4) > - return i965_mod_supported(format, modifier); > - else > - return i8xx_mod_supported(format, modifier); > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR && > + format =3D=3D DRM_FORMAT_ARGB8888; > } >=20=20 > -static bool intel_cursor_plane_format_mod_supported(struct drm_plane *pl= ane, > - uint32_t format, > - uint64_t modifier) > -{ > - if (WARN_ON(modifier =3D=3D DRM_FORMAT_MOD_INVALID)) > - return false; > +static struct drm_plane_funcs skl_plane_funcs =3D { > + .update_plane =3D drm_atomic_helper_update_plane, > + .disable_plane =3D drm_atomic_helper_disable_plane, > + .destroy =3D intel_plane_destroy, > + .atomic_get_property =3D intel_plane_atomic_get_property, > + .atomic_set_property =3D intel_plane_atomic_set_property, > + .atomic_duplicate_state =3D intel_plane_duplicate_state, > + .atomic_destroy_state =3D intel_plane_destroy_state, > + .format_mod_supported =3D skl_plane_format_mod_supported, > +}; >=20=20 > - return modifier =3D=3D DRM_FORMAT_MOD_LINEAR && format =3D=3D DRM_FORMA= T_ARGB8888; > -} > +static struct drm_plane_funcs i965_plane_funcs =3D { > + .update_plane =3D drm_atomic_helper_update_plane, > + .disable_plane =3D drm_atomic_helper_disable_plane, > + .destroy =3D intel_plane_destroy, > + .atomic_get_property =3D intel_plane_atomic_get_property, > + .atomic_set_property =3D intel_plane_atomic_set_property, > + .atomic_duplicate_state =3D intel_plane_duplicate_state, > + .atomic_destroy_state =3D intel_plane_destroy_state, > + .format_mod_supported =3D i965_plane_format_mod_supported, > +}; >=20=20 > -static struct drm_plane_funcs intel_plane_funcs =3D { > +static struct drm_plane_funcs i8xx_plane_funcs =3D { > .update_plane =3D drm_atomic_helper_update_plane, > .disable_plane =3D drm_atomic_helper_disable_plane, > .destroy =3D intel_plane_destroy, > @@ -13098,7 +13125,7 @@ static struct drm_plane_funcs intel_plane_funcs = =3D { > .atomic_set_property =3D intel_plane_atomic_set_property, > .atomic_duplicate_state =3D intel_plane_duplicate_state, > .atomic_destroy_state =3D intel_plane_destroy_state, > - .format_mod_supported =3D intel_primary_plane_format_mod_supported, > + .format_mod_supported =3D i8xx_plane_format_mod_supported, > }; >=20=20 > static int > @@ -13223,7 +13250,7 @@ static const struct drm_plane_funcs intel_cursor_= plane_funcs =3D { > .atomic_set_property =3D intel_plane_atomic_set_property, > .atomic_duplicate_state =3D intel_plane_duplicate_state, > .atomic_destroy_state =3D intel_plane_destroy_state, > - .format_mod_supported =3D intel_cursor_plane_format_mod_supported, > + .format_mod_supported =3D intel_cursor_format_mod_supported, > }; >=20=20 > static bool i9xx_plane_has_fbc(struct drm_i915_private *dev_priv, > @@ -13314,11 +13341,10 @@ intel_primary_plane_create(struct drm_i915_priv= ate *dev_priv, enum pipe pipe) > if (INTEL_GEN(dev_priv) >=3D 9) { > intel_primary_formats =3D skl_primary_formats; > num_formats =3D ARRAY_SIZE(skl_primary_formats); > + modifiers =3D skl_format_modifiers; >=20=20 > - if (skl_plane_has_ccs(dev_priv, pipe, PLANE_PRIMARY)) > - modifiers =3D skl_format_modifiers_ccs; > - else > - modifiers =3D skl_format_modifiers_noccs; > + primary->has_ccs =3D skl_plane_has_ccs(dev_priv, pipe, > + PLANE_PRIMARY); >=20=20 > primary->update_plane =3D skl_update_plane; > primary->disable_plane =3D skl_disable_plane; > @@ -13343,21 +13369,22 @@ intel_primary_plane_create(struct drm_i915_priv= ate *dev_priv, enum pipe pipe) >=20=20 > if (INTEL_GEN(dev_priv) >=3D 9) > ret =3D drm_universal_plane_init(&dev_priv->drm, &primary->base, > - 0, &intel_plane_funcs, > + 0, &skl_plane_funcs, > intel_primary_formats, num_formats, > modifiers, > DRM_PLANE_TYPE_PRIMARY, > "plane 1%c", pipe_name(pipe)); > else if (INTEL_GEN(dev_priv) >=3D 5 || IS_G4X(dev_priv)) > ret =3D drm_universal_plane_init(&dev_priv->drm, &primary->base, > - 0, &intel_plane_funcs, > + 0, &i965_plane_funcs, > intel_primary_formats, num_formats, > modifiers, > DRM_PLANE_TYPE_PRIMARY, > "primary %c", pipe_name(pipe)); > else > ret =3D drm_universal_plane_init(&dev_priv->drm, &primary->base, > - 0, &intel_plane_funcs, > + 0, IS_GEN4(dev_priv) ? > + &i965_plane_funcs : &i8xx_plane_funcs, > intel_primary_formats, num_formats, > modifiers, > DRM_PLANE_TYPE_PRIMARY, > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/inte= l_drv.h > index a215aa78b0be..e0b70c563e9f 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -937,6 +937,7 @@ struct intel_plane { > enum pipe pipe; > bool can_scale; > bool has_fbc; > + bool has_ccs; > int max_downscale; > uint32_t frontbuffer_bit; >=20=20 > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/i= ntel_sprite.c > index dbdcf85032df..f4dbdd6d1ddc 100644 > --- a/drivers/gpu/drm/i915/intel_sprite.c > +++ b/drivers/gpu/drm/i915/intel_sprite.c > @@ -1248,15 +1248,7 @@ static uint32_t skl_plane_formats[] =3D { > DRM_FORMAT_VYUY, > }; >=20=20 > -static const uint64_t skl_plane_format_modifiers_noccs[] =3D { > - 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_ccs[] =3D { > +static const uint64_t skl_plane_format_modifiers[] =3D { > I915_FORMAT_MOD_Yf_TILED_CCS, > I915_FORMAT_MOD_Y_TILED_CCS, > I915_FORMAT_MOD_Yf_TILED, > @@ -1266,25 +1258,41 @@ static const uint64_t skl_plane_format_modifiers_= ccs[] =3D { > DRM_FORMAT_MOD_INVALID > }; >=20=20 > -static bool g4x_mod_supported(uint32_t format, uint64_t modifier) > +static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + break; > + default: > + return false; > + } > + Reuse the same LINEAR/MOD_X_TILED func from intel_display.c? > switch (format) { > case DRM_FORMAT_XRGB8888: > case DRM_FORMAT_YUYV: > case DRM_FORMAT_YVYU: > case DRM_FORMAT_UYVY: > case DRM_FORMAT_VYUY: > - if (modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > - modifier =3D=3D I915_FORMAT_MOD_X_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED; > default: > return false; > } > } >=20=20 > -static bool snb_mod_supported(uint32_t format, uint64_t modifier) > +static bool snb_sprite_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + break; > + default: > + return false; > + } Reuse the same LINEAR/MOD_X_TILED func from intel_display.c? > + > switch (format) { > case DRM_FORMAT_XRGB8888: > case DRM_FORMAT_XBGR8888: > @@ -1292,17 +1300,24 @@ static bool snb_mod_supported(uint32_t format, ui= nt64_t modifier) > case DRM_FORMAT_YVYU: > case DRM_FORMAT_UYVY: > case DRM_FORMAT_VYUY: > - if (modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > - modifier =3D=3D I915_FORMAT_MOD_X_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED; > default: > return false; > } > } >=20=20 > -static bool vlv_mod_supported(uint32_t format, uint64_t modifier) > +static bool vlv_sprite_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + break; > + default: > + return false; > + } Reuse the same LINEAR/MOD_X_TILED func from intel_display.c? > + > switch (format) { > case DRM_FORMAT_RGB565: > case DRM_FORMAT_ABGR8888: > @@ -1315,26 +1330,44 @@ static bool vlv_mod_supported(uint32_t format, ui= nt64_t modifier) > case DRM_FORMAT_YVYU: > case DRM_FORMAT_UYVY: > case DRM_FORMAT_VYUY: > - if (modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > - modifier =3D=3D I915_FORMAT_MOD_X_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED; > default: > return false; > } > } >=20=20 > -static bool skl_mod_supported(uint32_t format, uint64_t modifier) > +static bool skl_plane_format_mod_supported(struct drm_plane *_plane, > + u32 format, u64 modifier) > { > + struct intel_plane *plane =3D to_intel_plane(_plane); > + > + switch (modifier) { > + case DRM_FORMAT_MOD_LINEAR: > + case I915_FORMAT_MOD_X_TILED: > + case I915_FORMAT_MOD_Y_TILED: > + case I915_FORMAT_MOD_Yf_TILED: > + break; > + case I915_FORMAT_MOD_Y_TILED_CCS: > + case I915_FORMAT_MOD_Yf_TILED_CCS: > + if (!plane->has_ccs) > + return false; > + break; > + default: > + return false; > + } > + > switch (format) { > case DRM_FORMAT_XRGB8888: > case DRM_FORMAT_XBGR8888: > case DRM_FORMAT_ARGB8888: > case DRM_FORMAT_ABGR8888: > - if (modifier =3D=3D I915_FORMAT_MOD_Yf_TILED_CCS || > - modifier =3D=3D I915_FORMAT_MOD_Y_TILED_CCS) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Yf_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED_CCS || > + modifier =3D=3D I915_FORMAT_MOD_Yf_TILED_CCS; > case DRM_FORMAT_RGB565: > case DRM_FORMAT_XRGB2101010: > case DRM_FORMAT_XBGR2101010: > @@ -1342,52 +1375,61 @@ static bool skl_mod_supported(uint32_t format, ui= nt64_t modifier) > case DRM_FORMAT_YVYU: > case DRM_FORMAT_UYVY: > case DRM_FORMAT_VYUY: > - if (modifier =3D=3D I915_FORMAT_MOD_Yf_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Yf_TILED; > case DRM_FORMAT_C8: > - if (modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > - modifier =3D=3D I915_FORMAT_MOD_X_TILED || > - modifier =3D=3D I915_FORMAT_MOD_Y_TILED) > - return true; > - /* fall through */ > + return modifier =3D=3D DRM_FORMAT_MOD_LINEAR || > + modifier =3D=3D I915_FORMAT_MOD_X_TILED || > + modifier =3D=3D I915_FORMAT_MOD_Y_TILED; > default: > return false; > } This looks like the same skl func from intel_display.c. Can we reuse it? > } >=20=20 > -static bool intel_sprite_plane_format_mod_supported(struct drm_plane *pl= ane, > - uint32_t format, > - uint64_t modifier) > -{ > - struct drm_i915_private *dev_priv =3D to_i915(plane->dev); > - > - if (WARN_ON(modifier =3D=3D DRM_FORMAT_MOD_INVALID)) > - return false; > +static const struct drm_plane_funcs g4x_sprite_funcs =3D { > + .update_plane =3D drm_atomic_helper_update_plane, > + .disable_plane =3D drm_atomic_helper_disable_plane, > + .destroy =3D intel_plane_destroy, > + .atomic_get_property =3D intel_plane_atomic_get_property, > + .atomic_set_property =3D intel_plane_atomic_set_property, > + .atomic_duplicate_state =3D intel_plane_duplicate_state, > + .atomic_destroy_state =3D intel_plane_destroy_state, > + .format_mod_supported =3D g4x_sprite_format_mod_supported, > +}; >=20=20 > - if ((modifier >> 56) !=3D DRM_FORMAT_MOD_VENDOR_INTEL && > - modifier !=3D DRM_FORMAT_MOD_LINEAR) > - return false; > +static const struct drm_plane_funcs snb_sprite_funcs =3D { > + .update_plane =3D drm_atomic_helper_update_plane, > + .disable_plane =3D drm_atomic_helper_disable_plane, > + .destroy =3D intel_plane_destroy, > + .atomic_get_property =3D intel_plane_atomic_get_property, > + .atomic_set_property =3D intel_plane_atomic_set_property, > + .atomic_duplicate_state =3D intel_plane_duplicate_state, > + .atomic_destroy_state =3D intel_plane_destroy_state, > + .format_mod_supported =3D snb_sprite_format_mod_supported, > +}; >=20=20 > - if (INTEL_GEN(dev_priv) >=3D 9) > - return skl_mod_supported(format, modifier); > - else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) > - return vlv_mod_supported(format, modifier); > - else if (INTEL_GEN(dev_priv) >=3D 6) > - return snb_mod_supported(format, modifier); > - else > - return g4x_mod_supported(format, modifier); > -} > +static const struct drm_plane_funcs vlv_sprite_funcs =3D { > + .update_plane =3D drm_atomic_helper_update_plane, > + .disable_plane =3D drm_atomic_helper_disable_plane, > + .destroy =3D intel_plane_destroy, > + .atomic_get_property =3D intel_plane_atomic_get_property, > + .atomic_set_property =3D intel_plane_atomic_set_property, > + .atomic_duplicate_state =3D intel_plane_duplicate_state, > + .atomic_destroy_state =3D intel_plane_destroy_state, > + .format_mod_supported =3D vlv_sprite_format_mod_supported, > +}; >=20=20 > -static const struct drm_plane_funcs intel_sprite_plane_funcs =3D { > - .update_plane =3D drm_atomic_helper_update_plane, > - .disable_plane =3D drm_atomic_helper_disable_plane, > - .destroy =3D intel_plane_destroy, > - .atomic_get_property =3D intel_plane_atomic_get_property, > - .atomic_set_property =3D intel_plane_atomic_set_property, > - .atomic_duplicate_state =3D intel_plane_duplicate_state, > - .atomic_destroy_state =3D intel_plane_destroy_state, > - .format_mod_supported =3D intel_sprite_plane_format_mod_supporte= d, > +static const struct drm_plane_funcs skl_plane_funcs =3D { > + .update_plane =3D drm_atomic_helper_update_plane, > + .disable_plane =3D drm_atomic_helper_disable_plane, > + .destroy =3D intel_plane_destroy, > + .atomic_get_property =3D intel_plane_atomic_get_property, > + .atomic_set_property =3D intel_plane_atomic_set_property, > + .atomic_duplicate_state =3D intel_plane_duplicate_state, > + .atomic_destroy_state =3D intel_plane_destroy_state, > + .format_mod_supported =3D skl_plane_format_mod_supported, > }; >=20=20 > bool skl_plane_has_ccs(struct drm_i915_private *dev_priv, > @@ -1413,6 +1455,7 @@ intel_sprite_plane_create(struct drm_i915_private *= dev_priv, > { > struct intel_plane *intel_plane =3D NULL; > struct intel_plane_state *state =3D NULL; > + const struct drm_plane_funcs *plane_funcs; > unsigned long possible_crtcs; > const uint32_t *plane_formats; > const uint64_t *modifiers; > @@ -1436,6 +1479,8 @@ intel_sprite_plane_create(struct drm_i915_private *= dev_priv, > if (INTEL_GEN(dev_priv) >=3D 9) { > intel_plane->can_scale =3D true; > state->scaler_id =3D -1; > + intel_plane->has_ccs =3D skl_plane_has_ccs(dev_priv, pipe, > + PLANE_SPRITE0 + plane); >=20=20 > intel_plane->update_plane =3D skl_update_plane; > intel_plane->disable_plane =3D skl_disable_plane; > @@ -1443,11 +1488,9 @@ intel_sprite_plane_create(struct drm_i915_private = *dev_priv, >=20=20 > plane_formats =3D skl_plane_formats; > num_plane_formats =3D ARRAY_SIZE(skl_plane_formats); > + modifiers =3D skl_plane_format_modifiers; >=20=20 > - if (skl_plane_has_ccs(dev_priv, pipe, PLANE_SPRITE0 + plane)) > - modifiers =3D skl_plane_format_modifiers_ccs; > - else > - modifiers =3D skl_plane_format_modifiers_noccs; > + plane_funcs =3D &skl_plane_funcs; > } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { > intel_plane->can_scale =3D false; > intel_plane->max_downscale =3D 1; > @@ -1459,6 +1502,8 @@ intel_sprite_plane_create(struct drm_i915_private *= dev_priv, > plane_formats =3D vlv_plane_formats; > num_plane_formats =3D ARRAY_SIZE(vlv_plane_formats); > modifiers =3D i9xx_plane_format_modifiers; > + > + plane_funcs =3D &vlv_sprite_funcs; > } else if (INTEL_GEN(dev_priv) >=3D 7) { > if (IS_IVYBRIDGE(dev_priv)) { > intel_plane->can_scale =3D true; > @@ -1475,6 +1520,8 @@ intel_sprite_plane_create(struct drm_i915_private *= dev_priv, > plane_formats =3D snb_plane_formats; > num_plane_formats =3D ARRAY_SIZE(snb_plane_formats); > modifiers =3D i9xx_plane_format_modifiers; > + > + plane_funcs =3D &snb_sprite_funcs; > } else { > intel_plane->can_scale =3D true; > intel_plane->max_downscale =3D 16; > @@ -1491,6 +1538,9 @@ intel_sprite_plane_create(struct drm_i915_private *= dev_priv, > plane_formats =3D g4x_plane_formats; > num_plane_formats =3D ARRAY_SIZE(g4x_plane_formats); > } > + > + plane_funcs =3D IS_GEN6(dev_priv) ? > + &snb_sprite_funcs : &g4x_sprite_funcs; Move htis assignment into the IS_GEN6() above? > } >=20=20 > if (INTEL_GEN(dev_priv) >=3D 9) { > @@ -1516,14 +1566,14 @@ intel_sprite_plane_create(struct drm_i915_private= *dev_priv, >=20=20 > if (INTEL_GEN(dev_priv) >=3D 9) > ret =3D drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, > - possible_crtcs, &intel_sprite_plane_funcs, > + possible_crtcs, plane_funcs, > plane_formats, num_plane_formats, > modifiers, > DRM_PLANE_TYPE_OVERLAY, > "plane %d%c", plane + 2, pipe_name(pipe)); > else > ret =3D drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, > - possible_crtcs, &intel_sprite_plane_funcs, > + possible_crtcs, plane_funcs, > plane_formats, num_plane_formats, > modifiers, > DRM_PLANE_TYPE_OVERLAY, > --=20 > 2.16.1 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlq+iqMACgkQtdYpNtH8 nujGKA//ZYI2Iss3UCE006qkG9JJNStVyVqYqoaBTkOD83408eMryABq8s2aRy2T MUspQqVZn7wuBKqy+zaqNgmCFCWRAU4QMRNWgNGUDwPZH2SjNRBop0f4Q3HOP6/u AsJgoxBCBA+gQTbnhaXd+8GIgXR676O4opDYViLyZFQBy+0rwrdr9G86/Swk9Yeh bODWcbgaHmdbQjpl5WQ485To+bj/F5rSLPRmsoymMZjvvc5hzuwCWbaerpgsYbO6 ELd3iUOKn6Zvo88SsNUDyZzo4evcItfxd2qg9vqc52lQYS6js3afGJsmi5gqRyXF LKK1nxkbpuw+GCF1whD3EJExiimwSyY6EETyhX4ayrZ+S4Tx/olV5ftiDjbolzHL x4LuLgJwjN7cUuYjHdTPrMzCr4q7NwSJa4SSY1OeHTRIW6yxn+UsLQWw4wKDyqus pQ3JE8L2wUplPK2kS7r0fYjgXMkb+cZRPUzeNzZeGw3OJM+ab5N+4U4Oa60uRhG9 Pc/ByoBuNavDT0vdCqKNp1yb15uRt1goP1kEx2znW+dvumCHPmNkr4EZ59UhtGFN v1v5xDF8RTEm5WoPl4L596Fcn0HmdV8m+gegWdPqzK4xNw/4xBLxgOk54mzOoIMQ wIhKdgI7yi4q67OumKFqd+j/pt3zTWhAKBS1RRYGNieVmOsBAek= =M3od -----END PGP SIGNATURE----- --=-=-=-- --===============0746446107== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0746446107==--