drm/i915: Use LINEAR modifier instead of NONE
Subsystems (33)
PATCH 1/3 drm/i915: Use LINEAR modifier instead of NONE
They're the same, so use the one which makes more sense.
--- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_display.c +14 -14
@@ -1997,7 +1997,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)unsigned int cpp = fb->format->cpp[plane];switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :return cpp;case I915_FORMAT_MOD_X_TILED :if (IS_GEN2 (dev_priv))
@@ -2033,7 +2033,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)static unsigned int intel_tile_height (const struct drm_framebuffer *fb,int plane) { -if (fb->modifier ==DRM_FORMAT_MOD_NONE ) +if (fb->modifier ==DRM_FORMAT_MOD_LINEAR )return 1 ;else return intel_tile_size(to_i915(fb->dev)) /
@@ -2107,7 +2107,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,return 4096 ;switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :return intel_linear_alignment (dev_priv);case I915_FORMAT_MOD_X_TILED :if (INTEL_GEN (dev_priv) >=9 )
@@ -2290,7 +2290,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,WARN_ON (new_offset > old_offset); -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_size, tile_width, tile_height;unsigned int pitch_tiles;
@@ -2345,7 +2345,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,if (alignment) alignment--; -if (fb_modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb_modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_size, tile_width, tile_height;unsigned int tile_rows, tiles, pitch_tiles;
@@ -2471,7 +2471,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv, DRM_ROTATE_0, tile_size); offset /= tile_size; -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_width, tile_height;unsigned int pitch_tiles;struct drm_rect r;
@@ -2803,7 +2803,7 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, int plane,int cpp = fb->format->cpp[plane];switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :case I915_FORMAT_MOD_X_TILED :switch (cpp) {case 8 :
@@ -3199,7 +3199,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,static u32 intel_fb_stride_alignment (const struct drm_framebuffer *fb,int plane) { -if (fb->modifier ==DRM_FORMAT_MOD_NONE ) +if (fb->modifier ==DRM_FORMAT_MOD_LINEAR )return 64 ;else return intel_tile_width_bytes (fb, plane);
@@ -3298,7 +3298,7 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :break ;case I915_FORMAT_MOD_X_TILED :return PLANE_CTL_TILED_X ;
@@ -8426,7 +8426,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, tiling = val &PLANE_CTL_TILED_MASK ;switch (tiling) {case PLANE_CTL_TILED_LINEAR : - fb->modifier =DRM_FORMAT_MOD_NONE ; + fb->modifier =DRM_FORMAT_MOD_LINEAR ;break ;case PLANE_CTL_TILED_X : plane_config->tiling =I915_TILING_X ;
@@ -10399,7 +10399,7 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc, ctl =I915_READ (PLANE_CTL (pipe,0 )); ctl &= ~PLANE_CTL_TILED_MASK ;switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :break ;case I915_FORMAT_MOD_X_TILED : ctl |=PLANE_CTL_TILED_X ;
@@ -13756,7 +13756,7 @@ intel_check_cursor_plane(struct drm_plane *plane,return -ENOMEM ; } -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {DRM_DEBUG_KMS ("cursor cannot be tiled\n" );return -EINVAL ; }
@@ -14412,7 +14412,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, mode_cmd->modifier[0]); goto err; } -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :case I915_FORMAT_MOD_X_TILED :break ;default :
@@ -14435,7 +14435,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, mode_cmd->pixel_format);if (mode_cmd->pitches[0 ] > pitch_limit) {DRM_DEBUG_KMS ("%s pitch (%u) must be at most %d\n" , - mode_cmd->modifier[0 ] !=DRM_FORMAT_MOD_NONE ? + mode_cmd->modifier[0 ] !=DRM_FORMAT_MOD_LINEAR ?"tiled" :"linear" , mode_cmd->pitches[0 ], pitch_limit); goto err;
Signature · 6 lines
2.12.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm: Add new DRM_IOCTL_MODE_GETPLANE2
Originally based off of a patch by Kristian.
This new ioctl extends DRM_IOCTL_MODE_GETPLANE, by returning information about the modifiers that will work with each format.
It's modified from Kristian's patch in that the modifiers and formats are setup by the driver, and then a callback is used to create the format list. The LOC was enough difference that I don't think it made sense to leave his authorship, but the new UABI was primarily his idea.
Additionally, I hit a couple of drivers which Kristian missed updating.
It also contains a change requested by Daniel to make the modifiers array a sentinel based structure instead of a sized one. Upon discussion on IRC, it was determined that having an invalid modifier might make sense in general as well.
v2:
- Make formats uint32_t, and use an offset, see the comment in the patch. Add a WARN_ON and early bail for when there are more than 32 formats. (Rob)
- Remove DRM_DEBUG_KMS (Ville)
- make flags come before count in struct (Ville)
v3:
- Make formats 64b again to defer the pain, and add a pad
- Make init fail if > 64 instead of at get_plane. This could be made more optimal by doing it in get_plane because 0 masked modifiers don't need to be reported back to userspace. As a result, the first driver to go back 64 formats has to deal with this.
- Fix the comment to be more clear.
v4:
- Add drivers/gpu/drm/qxl/
Cc: Rob Clark <[email protected]>
Cc: Ville Syrjälä <[email protected]>
Cc: Daniel Stone <[email protected]>
Cc: "Kristian H. Kristensen" <[email protected]>
References: https://patchwork.kernel.org/patch/9482393/
--- drivers/gpu/drm/arc/arcpgu_crtc.c | 1 + drivers/gpu/drm/arm/hdlcd_crtc.c | 1 + drivers/gpu/drm/arm/malidp_planes.c | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 1 + drivers/gpu/drm/armada/armada_overlay.c | 1 + drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 4 +- drivers/gpu/drm/drm_ioctl.c | 2 +- drivers/gpu/drm/drm_modeset_helper.c | 1 + drivers/gpu/drm/drm_plane.c | 67 ++++++++++++++++++++++++- drivers/gpu/drm/drm_simple_kms_helper.c | 3 ++ drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 2 +- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 1 + drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- drivers/gpu/drm/i915/intel_display.c | 7 ++- drivers/gpu/drm/i915/intel_sprite.c | 4 +- drivers/gpu/drm/imx/ipuv3-plane.c | 4 +- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 +- drivers/gpu/drm/meson/meson_plane.c | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 2 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 +- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 2 +- drivers/gpu/drm/nouveau/nv50_display.c | 5 +- drivers/gpu/drm/omapdrm/omap_plane.c | 3 +- drivers/gpu/drm/qxl/qxl_display.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 4 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +- drivers/gpu/drm/sti/sti_cursor.c | 2 +- drivers/gpu/drm/sti/sti_gdp.c | 2 +- drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- drivers/gpu/drm/sun4i/sun4i_layer.c | 2 +- drivers/gpu/drm/tegra/dc.c | 12 ++--- drivers/gpu/drm/vc4/vc4_plane.c | 2 +- drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- drivers/gpu/drm/zte/zx_plane.c | 2 +- include/drm/drm_plane.h | 21 +++++++- include/drm/drm_simple_kms_helper.h | 1 + include/uapi/drm/drm.h | 1 + include/uapi/drm/drm_fourcc.h | 11 ++++ include/uapi/drm/drm_mode.h | 44 ++++++++++++++++ 41 files changed, 200 insertions(+), 42 deletions(-)
drivers/gpu/drm/arc/arcpgu_crtc.c +1 -0
@@ -218,6 +218,7 @@ static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm) ret =drm_universal_plane_init (drm, plane,0xff , &arc_pgu_plane_funcs, formats,ARRAY_SIZE (formats), +NULL ,DRM_PLANE_TYPE_PRIMARY ,NULL );if (ret)return ERR_PTR (ret);
drivers/gpu/drm/arm/hdlcd_crtc.c +1 -0
@@ -303,6 +303,7 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm) ret =drm_universal_plane_init (drm, plane,0xff , &hdlcd_plane_funcs, formats,ARRAY_SIZE (formats), +NULL ,DRM_PLANE_TYPE_PRIMARY ,NULL );if (ret) {devm_kfree (drm->dev, plane);
drivers/gpu/drm/arm/malidp_planes.c +1 -1
@@ -328,7 +328,7 @@ int malidp_de_planes_init(struct drm_device *drm)DRM_PLANE_TYPE_OVERLAY ; ret =drm_universal_plane_init (drm, &plane->base, crtcs, &malidp_de_plane_funcs, formats, - n, plane_type,NULL ); + n,NULL , plane_type,NULL );if (ret <0 ) goto cleanup;
drivers/gpu/drm/armada/armada_crtc.c +1 -0
@@ -1268,6 +1268,7 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, &armada_primary_plane_funcs, armada_primary_formats,ARRAY_SIZE (armada_primary_formats), +NULL , DRM_PLANE_TYPE_PRIMARY, NULL);if (ret) {kfree (primary);
drivers/gpu/drm/armada/armada_overlay.c +1 -0
@@ -458,6 +458,7 @@ int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs) &armada_ovl_plane_funcs, armada_ovl_formats,ARRAY_SIZE (armada_ovl_formats), +NULL , DRM_PLANE_TYPE_OVERLAY, NULL);if (ret) {kfree (dplane);
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +3 -1
@@ -1058,7 +1058,9 @@ static int atmel_hlcdc_plane_create(struct drm_device *dev, ret =drm_universal_plane_init (dev, &plane->base,0 , &layer_plane_funcs, desc->formats->formats, - desc->formats->nformats, type,NULL ); + desc->formats->nformats, +NULL , + type,NULL );if (ret)return ret;
drivers/gpu/drm/drm_ioctl.c +1 -1
@@ -614,7 +614,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {DRM_IOCTL_DEF (DRM_IOCTL_MODE_GETPLANERESOURCES , drm_mode_getplane_res,DRM_CONTROL_ALLOW |DRM_UNLOCKED ),DRM_IOCTL_DEF (DRM_IOCTL_MODE_GETCRTC , drm_mode_getcrtc,DRM_CONTROL_ALLOW |DRM_UNLOCKED ),DRM_IOCTL_DEF (DRM_IOCTL_MODE_SETCRTC , drm_mode_setcrtc,DRM_MASTER |DRM_CONTROL_ALLOW |DRM_UNLOCKED ), -DRM_IOCTL_DEF (DRM_IOCTL_MODE_GETPLANE , drm_mode_getplane,DRM_CONTROL_ALLOW |DRM_UNLOCKED ), +DRM_IOCTL_DEF (DRM_IOCTL_MODE_GETPLANE2 , drm_mode_getplane,DRM_CONTROL_ALLOW |DRM_UNLOCKED ),DRM_IOCTL_DEF (DRM_IOCTL_MODE_SETPLANE , drm_mode_setplane,DRM_MASTER |DRM_CONTROL_ALLOW |DRM_UNLOCKED ),DRM_IOCTL_DEF (DRM_IOCTL_MODE_CURSOR , drm_mode_cursor_ioctl,DRM_MASTER |DRM_CONTROL_ALLOW |DRM_UNLOCKED ), DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, DRM_UNLOCKED),
drivers/gpu/drm/drm_modeset_helper.c +1 -0
@@ -124,6 +124,7 @@ static struct drm_plane *create_primary_plane(struct drm_device *dev) &drm_primary_helper_funcs, safe_modeset_formats,ARRAY_SIZE (safe_modeset_formats), +NULL , DRM_PLANE_TYPE_PRIMARY, NULL);if (ret) {kfree (primary);
drivers/gpu/drm/drm_plane.c +65 -2
130 lines not on this page · raw message
drivers/gpu/drm/drm_simple_kms_helper.c +3 -0
@@ -193,6 +193,7 @@ EXPORT_SYMBOL(drm_simple_display_pipe_attach_bridge);* @funcs: callbacks for the display pipe (optional) * @formats: array of supported formats (DRM_FORMAT\_\*) * @format_count: number of elements in @formats +* @format_modifiers: array of formats modifiers * @connector: connector to attach and register (optional) * * Sets up a display pipeline which consist of a really simple
@@ -213,6 +214,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev,struct drm_simple_display_pipe *pipe, const struct drm_simple_display_pipe_funcs *funcs, const uint32_t *formats, unsigned int format_count, + const uint64_t *format_modifiers, struct drm_connector *connector) { struct drm_encoder *encoder = &pipe->encoder;
@@ -227,6 +229,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev, ret =drm_universal_plane_init (dev, plane,0 , &drm_simple_kms_plane_funcs, formats, format_count, + format_modifiers,DRM_PLANE_TYPE_PRIMARY ,NULL );if (ret)return ret;
drivers/gpu/drm/exynos/exynos_drm_plane.c +1 -1
@@ -284,7 +284,7 @@ int exynos_plane_init(struct drm_device *dev, &exynos_plane_funcs, config->pixel_formats, config->num_pixel_formats, - config->type, NULL); + NULL, config->type, NULL);if (err) {DRM_ERROR ("failed to initialize plane\n" );return err;
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +1 -1
@@ -224,7 +224,7 @@ struct drm_plane *fsl_dcu_drm_primary_create_plane(struct drm_device *dev) &fsl_dcu_drm_plane_funcs, fsl_dcu_drm_plane_formats,ARRAY_SIZE (fsl_dcu_drm_plane_formats), - DRM_PLANE_TYPE_PRIMARY, NULL); + NULL, DRM_PLANE_TYPE_PRIMARY, NULL);if (ret) {kfree (primary); primary =NULL ;
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c +1 -0
@@ -181,6 +181,7 @@ static struct drm_plane *hibmc_plane_init(struct hibmc_drm_private *priv) ret =drm_universal_plane_init (dev, plane,1 , &hibmc_plane_funcs, channel_formats1,ARRAY_SIZE (channel_formats1), +NULL ,DRM_PLANE_TYPE_PRIMARY ,NULL );if (ret) {
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1 -1
@@ -909,7 +909,7 @@ static int ade_plane_init(struct drm_device *dev, struct ade_plane *aplane,return ret; ret =drm_universal_plane_init (dev, &aplane->base,1 , &ade_plane_funcs, - fmts, fmts_cnt, type,NULL ); + fmts, fmts_cnt,NULL , type,NULL );if (ret) {DRM_ERROR ("fail to init plane, ch=%d\n" , aplane->ch);return ret;
drivers/gpu/drm/i915/intel_display.c +6 -1
@@ -13587,6 +13587,8 @@ intel_legacy_cursor_update(struct drm_plane *plane, src_x, src_y, src_w, src_h); } + +static const struct drm_plane_funcs intel_cursor_plane_funcs = { .update_plane = intel_legacy_cursor_update, .disable_plane = drm_atomic_helper_disable_plane,
@@ -13671,18 +13673,21 @@ 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 ,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 ,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 ,DRM_PLANE_TYPE_PRIMARY ,"plane %c" ,plane_name (primary->plane));if (ret)
@@ -13847,7 +13852,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)0 , &intel_cursor_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats), -DRM_PLANE_TYPE_CURSOR , +NULL ,DRM_PLANE_TYPE_CURSOR , "cursor %c", pipe_name(pipe));if (ret) goto fail;
drivers/gpu/drm/i915/intel_sprite.c +2 -2
@@ -1186,13 +1186,13 @@ 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, -DRM_PLANE_TYPE_OVERLAY , +NULL ,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, -DRM_PLANE_TYPE_OVERLAY , +NULL ,DRM_PLANE_TYPE_OVERLAY ,"sprite %c" ,sprite_name (pipe, plane));if (ret) goto fail;
drivers/gpu/drm/imx/ipuv3-plane.c +2 -2
@@ -718,8 +718,8 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, ret =drm_universal_plane_init (dev, &ipu_plane->base, possible_crtcs, &ipu_plane_funcs, ipu_plane_formats, -ARRAY_SIZE (ipu_plane_formats), type, -NULL ); +ARRAY_SIZE (ipu_plane_formats), +NULL , type,NULL );if (ret) {DRM_ERROR ("failed to initialize plane\n" );kfree (ipu_plane);
drivers/gpu/drm/mediatek/mtk_drm_plane.c +1 -1
@@ -173,7 +173,7 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, err =drm_universal_plane_init (dev, plane, possible_crtcs, &mtk_plane_funcs, formats, -ARRAY_SIZE (formats), type,NULL ); +ARRAY_SIZE (formats),NULL , type,NULL );if (err) {DRM_ERROR ("failed to initialize plane\n" );return err;
drivers/gpu/drm/meson/meson_plane.c +1 -0
@@ -223,6 +223,7 @@ int meson_plane_create(struct meson_drm *priv) &meson_plane_funcs, supported_drm_formats,ARRAY_SIZE (supported_drm_formats), +NULL , DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane");drm_plane_helper_add (plane, &meson_plane_helper_funcs);
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +1 -1
@@ -398,7 +398,7 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev, type = private_plane ?DRM_PLANE_TYPE_PRIMARY :DRM_PLANE_TYPE_OVERLAY ; ret =drm_universal_plane_init (dev, plane,0xff , &mdp4_plane_funcs, mdp4_plane->formats, mdp4_plane->nformats, - type,NULL ); +NULL , type,NULL );if (ret) goto fail;
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -2
@@ -1000,12 +1000,12 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev, ret =drm_universal_plane_init (dev, plane,0xff , &mdp5_cursor_plane_funcs, mdp5_plane->formats, mdp5_plane->nformats, - type,NULL ); +NULL , type,NULL ); else ret =drm_universal_plane_init (dev, plane,0xff , &mdp5_plane_funcs, mdp5_plane->formats, mdp5_plane->nformats, - type,NULL ); +NULL , type,NULL );if (ret) goto fail;
drivers/gpu/drm/mxsfb/mxsfb_drv.c +1 -1
@@ -190,7 +190,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags) } ret =drm_simple_display_pipe_init (drm, &mxsfb->pipe, &mxsfb_funcs, - mxsfb_formats,ARRAY_SIZE (mxsfb_formats), + mxsfb_formats,ARRAY_SIZE (mxsfb_formats),NULL ,0 , &mxsfb->connector);if (ret <0 ) {dev_err (drm->dev,"Cannot setup simple display pipe\n" );
drivers/gpu/drm/nouveau/nv50_display.c +3 -2
@@ -1086,8 +1086,9 @@ nv50_wndw_ctor(const struct nv50_wndw_func *func, struct drm_device *dev, wndw->func = func; wndw->dmac = dmac; - ret =drm_universal_plane_init (dev, &wndw->plane,0 , &nv50_wndw, format, - nformat, type,"%s-%d" , name, index); + ret =drm_universal_plane_init (dev, &wndw->plane,0 , &nv50_wndw, + format, nformat,NULL , + type,"%s-%d" , name, index);if (ret)return ret;
drivers/gpu/drm/omapdrm/omap_plane.c +2 -1
@@ -360,7 +360,8 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, ret =drm_universal_plane_init (dev, plane, possible_crtcs, &omap_plane_funcs, omap_plane->formats, - omap_plane->nformats, type,NULL ); + omap_plane->nformats, +NULL , type,NULL );if (ret <0 ) goto error;
drivers/gpu/drm/qxl/qxl_display.c +1 -1
@@ -788,7 +788,7 @@ static struct drm_plane *qxl_create_plane(struct qxl_device *qdev, err =drm_universal_plane_init (&qdev->ddev, plane, possible_crtcs, funcs, formats, num_formats, - type,NULL ); +NULL , type,NULL );if (err) goto free_plane;
drivers/gpu/drm/rcar-du/rcar_du_plane.c +2 -2
@@ -743,8 +743,8 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) ret =drm_universal_plane_init (rcdu->ddev, &plane->plane, crtcs, &rcar_du_plane_funcs, formats, -ARRAY_SIZE (formats), type, -NULL ); +ARRAY_SIZE (formats), +NULL , type,NULL );if (ret <0 )return ret;
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +2 -2
@@ -368,8 +368,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp)1 << vsp->index, &rcar_du_vsp_plane_funcs, formats_kms, -ARRAY_SIZE (formats_kms), type, - NULL); +ARRAY_SIZE (formats_kms), + NULL, type, NULL);if (ret <0 )return ret;
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2 -2
@@ -1280,7 +1280,7 @@ static int vop_create_crtc(struct vop *vop)0 , &vop_plane_funcs, win_data->phy->data_formats, win_data->phy->nformats, - win_data->type, NULL); + NULL, win_data->type, NULL);if (ret) {DRM_DEV_ERROR (vop->dev,"failed to init plane %d\n" , ret);
@@ -1319,7 +1319,7 @@ static int vop_create_crtc(struct vop *vop) &vop_plane_funcs, win_data->phy->data_formats, win_data->phy->nformats, - win_data->type, NULL); + NULL, win_data->type, NULL);if (ret) {DRM_DEV_ERROR (vop->dev,"failed to init overlay %d\n" , ret);
drivers/gpu/drm/sti/sti_cursor.c +1 -1
@@ -393,7 +393,7 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev, &sti_cursor_plane_helpers_funcs, cursor_supported_formats,ARRAY_SIZE (cursor_supported_formats), - DRM_PLANE_TYPE_CURSOR, NULL); + NULL, DRM_PLANE_TYPE_CURSOR, NULL);if (res) {DRM_ERROR ("Failed to initialize universal plane\n" ); goto err_plane;
drivers/gpu/drm/sti/sti_gdp.c +1 -1
@@ -930,7 +930,7 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev, &sti_gdp_plane_helpers_funcs, gdp_supported_formats,ARRAY_SIZE (gdp_supported_formats), - type, NULL); + NULL, type, NULL);if (res) {DRM_ERROR ("Failed to initialize universal plane\n" ); goto err;
drivers/gpu/drm/sti/sti_hqvdp.c +1 -1
@@ -1296,7 +1296,7 @@ static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev, &sti_hqvdp_plane_helpers_funcs, hqvdp_supported_formats,ARRAY_SIZE (hqvdp_supported_formats), - DRM_PLANE_TYPE_OVERLAY, NULL); + NULL, DRM_PLANE_TYPE_OVERLAY, NULL);if (res) {DRM_ERROR ("Failed to initialize universal plane\n" );return NULL ;
drivers/gpu/drm/sun4i/sun4i_layer.c +1 -1
@@ -117,7 +117,7 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, ret =drm_universal_plane_init (drm, &layer->plane,BIT (0 ), &sun4i_backend_layer_funcs, plane->formats, plane->nformats, - plane->type,NULL ); +NULL , plane->type,NULL );if (ret) {dev_err (drm->dev,"Couldn't initialize layer\n" );return ERR_PTR (ret);
drivers/gpu/drm/tegra/dc.c +6 -6
@@ -655,8 +655,8 @@ static struct drm_plane *tegra_dc_primary_plane_create(struct drm_device *drm, err =drm_universal_plane_init (drm, &plane->base, possible_crtcs, &tegra_primary_plane_funcs, formats, - num_formats,DRM_PLANE_TYPE_PRIMARY , -NULL ); + num_formats,NULL , +DRM_PLANE_TYPE_PRIMARY ,NULL );if (err <0 ) {kfree (plane);return ERR_PTR (err);
@@ -821,8 +821,8 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm, err =drm_universal_plane_init (drm, &plane->base,1 << dc->pipe, &tegra_cursor_plane_funcs, formats, - num_formats,DRM_PLANE_TYPE_CURSOR , -NULL ); + num_formats,NULL , +DRM_PLANE_TYPE_CURSOR ,NULL );if (err <0 ) {kfree (plane);return ERR_PTR (err);
@@ -883,8 +883,8 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, err =drm_universal_plane_init (drm, &plane->base,1 << dc->pipe, &tegra_overlay_plane_funcs, formats, - num_formats,DRM_PLANE_TYPE_OVERLAY , -NULL ); + num_formats,NULL , +DRM_PLANE_TYPE_OVERLAY ,NULL );if (err <0 ) {kfree (plane);return ERR_PTR (err);
drivers/gpu/drm/vc4/vc4_plane.c +1 -1
@@ -859,7 +859,7 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, ret =drm_universal_plane_init (dev, plane,0 , &vc4_plane_funcs, formats, num_formats, - type,NULL ); +NULL , type,NULL );drm_plane_helper_add (plane, &vc4_plane_helper_funcs);
drivers/gpu/drm/virtio/virtgpu_plane.c +1 -1
@@ -226,7 +226,7 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev, ret =drm_universal_plane_init (dev, plane,1 << index, &virtio_gpu_plane_funcs, formats, nformats, - type,NULL ); +NULL , type,NULL );if (ret) goto err_plane_init;
drivers/gpu/drm/zte/zx_plane.c +1 -1
@@ -539,7 +539,7 @@ int zx_plane_init(struct drm_device *drm, struct zx_plane *zplane, ret =drm_universal_plane_init (drm, plane,VOU_CRTC_MASK , &zx_plane_funcs, formats, format_count, - type,NULL ); +NULL , type,NULL );if (ret) {DRM_DEV_ERROR (dev,"failed to init universal plane: %d\n" , ret);return ret;
include/drm/drm_plane.h +20 -1
@@ -389,6 +389,20 @@ struct drm_plane_funcs {*/ void (*atomic_print_state)(struct drm_printer *p,const struct drm_plane_state *state); + +/** +* @format_mod_supported: +* +* This optional hook is used for the DRM to determine if the given +* format/modifier combination is valid for the plane. This allows the +* DRM to generate the correct format bitmask (which formats apply to +* which modifier). +* +* True if the given modifier is valid for that format on the plane. +* False otherwise. +*/ +bool (*format_mod_supported)(struct drm_plane *plane,uint32_t format, +uint64_t modifier); };/**
@@ -483,6 +497,10 @@ struct drm_plane {unsigned int format_count;bool format_default; +uint32_t *formats; +uint64_t *modifiers; +unsigned int modifier_count; +struct drm_crtc *crtc;struct drm_framebuffer *fb;
@@ -510,13 +528,14 @@ struct drm_plane {#define obj_to_plane (x) container_of(x, struct drm_plane, base) -__printf(8, 9) +__printf(9, 10)int drm_universal_plane_init (struct drm_device *dev,struct drm_plane *plane,uint32_t possible_crtcs,const struct drm_plane_funcs *funcs,const uint32_t *formats,unsigned int format_count, +const uint64_t *format_modifiers,enum drm_plane_type type,const char *name, ...); int drm_plane_init(struct drm_device *dev,
include/drm/drm_simple_kms_helper.h +1 -0
@@ -122,6 +122,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev,struct drm_simple_display_pipe *pipe, const struct drm_simple_display_pipe_funcs *funcs, const uint32_t *formats, unsigned int format_count, + const uint64_t *format_modifiers, struct drm_connector *connector);#endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
include/uapi/drm/drm.h +1 -0
@@ -805,6 +805,7 @@ extern "C" {#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) +#define DRM_IOCTL_MODE_GETPLANE2 DRM_IOWR(0xB6, struct drm_mode_get_plane2)#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
include/uapi/drm/drm_fourcc.h +11 -0
@@ -184,6 +184,8 @@ extern "C" {#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06/* add more to the end as needed */ +#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) +#define fourcc_mod_code (vendor, val) \ ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL))
@@ -196,6 +198,15 @@ extern "C" {*/ /* +* Invalid Modifier +* +* This modifier can be used as a sentinel to terminate list, or to initialize a +* variable with an invalid modifier. It might also be used to report an error +* back to userspace for certain APIs. +*/ +#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) + +/* * Linear Layout * * Just plain linear layout. Note that this is different from no specifying any
include/uapi/drm/drm_mode.h +44 -0
50 lines not on this page · raw message
Signature · 6 lines
2.12.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/i915: Add format modifiers for Intel
In reply to Ben WidawskyThis was based on a patch originally by Kristian. It has been modified pretty heavily to use the new callbacks from the previous patch.
v2:
- Add LINEAR and Yf modifiers to list (Ville)
- Combine i8xx and i965 into one list of formats (Ville)
- Allow 1010102 formats for Y/Yf tiled (Ville)
v3:
- Handle cursor formats (Ville)
- Put handling for LINEAR in the mod_support functions (Ville)
--- drivers/gpu/drm/i915/intel_display.c | 112 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 25 +++++++- 2 files changed, 131 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +108 -4
@@ -72,6 +72,12 @@ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_XBGR2101010, }; +static const uint64_t i9xx_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t skl_primary_formats[] = {DRM_FORMAT_C8 ,DRM_FORMAT_RGB565 ,
@@ -87,6 +93,14 @@ static const uint32_t skl_primary_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +/* Cursor formats */ static const uint32_t intel_cursor_formats[] = {DRM_FORMAT_ARGB8888 ,
@@ -13453,6 +13467,83 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (to_intel_plane (plane)); } +static bool i8xx_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_XRGB8888 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i965_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool skl_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier < I915_FORMAT_MOD_Yf_TILED); +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier <= I915_FORMAT_MOD_Yf_TILED); +case DRM_FORMAT_YUYV : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_VYUY : +return modifier ==DRM_FORMAT_MOD_LINEAR ; +default : +return false; + } + +} + +static bool intel_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false; + +if (INTEL_GEN (dev_priv) >=9 ) +return skl_mod_supported (format, modifier); +else if (INTEL_GEN (dev_priv) >=4 ) +return i965_mod_supported (format, modifier); +else +return i8xx_mod_supported (format, modifier); + +return false; +} +const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,
@@ -13462,6 +13553,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static int
@@ -13598,6 +13690,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static struct intel_plane *
@@ -13608,6 +13701,7 @@ 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 uint64_t *intel_format_modifiers;int ret; primary =kzalloc (sizeof (*primary),GFP_KERNEL );
@@ -13646,24 +13740,28 @@ 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; 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 = i9xx_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 = i9xx_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 = i9xx_format_modifiers; primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;
@@ -13673,21 +13771,21 @@ 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 , + intel_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 , + intel_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 , + intel_format_modifiers,DRM_PLANE_TYPE_PRIMARY ,"plane %c" ,plane_name (primary->plane));if (ret)
@@ -13817,6 +13915,11 @@ intel_update_cursor_plane(struct drm_plane *plane,intel_crtc_update_cursor (crtc, crtc_state, state); } +static const uint64_t cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static struct intel_plane *intel_cursor_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) {
@@ -13852,7 +13955,8 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)0 , &intel_cursor_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats), -NULL ,DRM_PLANE_TYPE_CURSOR , + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , "cursor %c", pipe_name(pipe));if (ret) goto fail;
drivers/gpu/drm/i915/intel_sprite.c +23 -2
@@ -1053,6 +1053,12 @@ static const uint32_t ilk_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t i9xx_plane_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t snb_plane_formats[] = {DRM_FORMAT_XBGR8888 ,DRM_FORMAT_XRGB8888 ,
@@ -1088,6 +1094,14 @@ static uint32_t skl_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_plane_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +struct intel_plane *intel_sprite_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe,int plane)
@@ -1096,6 +1110,7 @@ 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 uint64_t *modifiers;unsigned int supported_rotations;int num_plane_formats;int ret;
@@ -1122,6 +1137,7 @@ 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 (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { intel_plane->can_scale = false; intel_plane->max_downscale =1 ;
@@ -1131,6 +1147,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = vlv_plane_formats; num_plane_formats =ARRAY_SIZE (vlv_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else if (INTEL_GEN (dev_priv) >=7 ) {if (IS_IVYBRIDGE (dev_priv)) { intel_plane->can_scale = true;
@@ -1145,6 +1162,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else { intel_plane->can_scale = true; intel_plane->max_downscale =16 ;
@@ -1152,6 +1170,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane; + modifiers = i9xx_plane_format_modifiers;if (IS_GEN6 (dev_priv)) { plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats);
@@ -1186,13 +1205,15 @@ 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + modifiers, +DRM_PLANE_TYPE_OVERLAY ,"sprite %c" ,sprite_name (pipe, plane));if (ret) goto fail;
Signature · 6 lines
2.12.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/i915: Add format modifiers for Intel
Quoted 83 lines · Ben Widawsky
This was based on a patch originally by Kristian. It has been modified pretty heavily to use the new callbacks from the previous patch.
v2:
- Add LINEAR and Yf modifiers to list (Ville)
- Combine i8xx and i965 into one list of formats (Ville)
- Allow 1010102 formats for Y/Yf tiled (Ville)v3:
- Handle cursor formats (Ville)
- Put handling for LINEAR in themod_supportfunctions (Ville)Cc Ville Syrjälä <[email protected]>Cc Kristian H. Kristensen <[email protected]>Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 112 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 25 +++++++- 2 files changed, 131 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +41
-0@@ -72,6 +72,12 @@ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_XBGR2101010, }; +static const uint64_t i9xx_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t skl_primary_formats[] = {DRM_FORMAT_C8 ,DRM_FORMAT_RGB565 ,@@ -87,6 +93,14 @@ static const uint32_t skl_primary_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +/* Cursor formats */ static const uint32_t intel_cursor_formats[] = {DRM_FORMAT_ARGB8888 ,@@ -13453,6 +13467,83 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (to_intel_plane (plane)); } +static bool i8xx_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_XRGB8888 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i965_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false;
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13506
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ } +} + +static bool skl_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier < I915_FORMAT_MOD_Yf_TILED);
The >= stuff makes this harder to parse than it should be IMO. I'd just list each modifier explicitly.
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13516
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier <= I915_FORMAT_MOD_Yf_TILED);
ditto. At first I couldn't even spot the difference between this and the C8 case.
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13521
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+case DRM_FORMAT_YUYV : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_VYUY : +return modifier ==DRM_FORMAT_MOD_LINEAR ;
Any modifier will do for these formats.
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +14
-0+default : +return false; + } + +} + +static bool intel_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false;
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13545
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ +if (INTEL_GEN (dev_priv) >=9 ) +return skl_mod_supported (format, modifier); +else if (INTEL_GEN (dev_priv) >=4 ) +return i965_mod_supported (format, modifier); +else +return i8xx_mod_supported (format, modifier); + +return false; +}
I'd also like to see .format_mod_supported() + modifiers[] for cursors as well. Those should only accept LINEAR+ARGB8888.
Apart from those issues, I think this is looking pretty good.
Quoted 196 lines
drivers/gpu/drm/i915/intel_display.c +18
-4+const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -13462,6 +13553,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static int@@ -13598,6 +13690,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static struct intel_plane *@@ -13608,6 +13701,7 @@ 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 uint64_t *intel_format_modifiers;int ret; primary =kzalloc (sizeof (*primary),GFP_KERNEL );@@ -13646,24 +13740,28 @@ 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; 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 = i9xx_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 = i9xx_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 = i9xx_format_modifiers; primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;@@ -13673,21 +13771,21 @@ 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 , + intel_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 , + intel_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 , + intel_format_modifiers,DRM_PLANE_TYPE_PRIMARY ,"plane %c" ,plane_name (primary->plane));if (ret)@@ -13817,6 +13915,11 @@ intel_update_cursor_plane(struct drm_plane *plane,intel_crtc_update_cursor (crtc, crtc_state, state); } +static const uint64_t cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static struct intel_plane *intel_cursor_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) {@@ -13852,7 +13955,8 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)0 , &intel_cursor_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats), -NULL ,DRM_PLANE_TYPE_CURSOR , + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , "cursor %c", pipe_name(pipe));if (ret) goto fail;drivers/gpu/drm/i915/intel_sprite.c +23
-2@@ -1053,6 +1053,12 @@ static const uint32_t ilk_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t i9xx_plane_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t snb_plane_formats[] = {DRM_FORMAT_XBGR8888 ,DRM_FORMAT_XRGB8888 ,@@ -1088,6 +1094,14 @@ static uint32_t skl_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_plane_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +struct intel_plane *intel_sprite_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe,int plane)@@ -1096,6 +1110,7 @@ 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 uint64_t *modifiers;unsigned int supported_rotations;int num_plane_formats;int ret;@@ -1122,6 +1137,7 @@ 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 (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { intel_plane->can_scale = false; intel_plane->max_downscale =1 ;@@ -1131,6 +1147,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = vlv_plane_formats; num_plane_formats =ARRAY_SIZE (vlv_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else if (INTEL_GEN (dev_priv) >=7 ) {if (IS_IVYBRIDGE (dev_priv)) { intel_plane->can_scale = true;@@ -1145,6 +1162,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else { intel_plane->can_scale = true; intel_plane->max_downscale =16 ;@@ -1152,6 +1170,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane; + modifiers = i9xx_plane_format_modifiers;if (IS_GEN6 (dev_priv)) { plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats);@@ -1186,13 +1205,15 @@ 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + modifiers, +DRM_PLANE_TYPE_OVERLAY ,"sprite %c" ,sprite_name (pipe, plane));if (ret) goto fail;Signature · 1 line
2.12.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/i915: Add format modifiers for Intel
Quoted 98 lines · Ville Syrjälä
Quoted 83 lines · Ben Widawsky
This was based on a patch originally by Kristian. It has been modified pretty heavily to use the new callbacks from the previous patch.
v2:
- Add LINEAR and Yf modifiers to list (Ville)
- Combine i8xx and i965 into one list of formats (Ville)
- Allow 1010102 formats for Y/Yf tiled (Ville)v3:
- Handle cursor formats (Ville)
- Put handling for LINEAR in themod_supportfunctions (Ville)Cc Ville Syrjälä <[email protected]>Cc Kristian H. Kristensen <[email protected]>Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 112 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 25 +++++++- 2 files changed, 131 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +41
-0@@ -72,6 +72,12 @@ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_XBGR2101010, }; +static const uint64_t i9xx_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t skl_primary_formats[] = {DRM_FORMAT_C8 ,DRM_FORMAT_RGB565 ,@@ -87,6 +93,14 @@ static const uint32_t skl_primary_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +/* Cursor formats */ static const uint32_t intel_cursor_formats[] = {DRM_FORMAT_ARGB8888 ,@@ -13453,6 +13467,83 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (to_intel_plane (plane)); } +static bool i8xx_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_XRGB8888 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i965_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false;drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13506
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ } +} + +static bool skl_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier < I915_FORMAT_MOD_Yf_TILED);The >= stuff makes this harder to parse than it should be IMO. I'd just list each modifier explicitly.
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13516
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier <= I915_FORMAT_MOD_Yf_TILED);ditto. At first I couldn't even spot the difference between this and the C8 case.
Okay, got those both. I think for now it's just:
switch (format) {
case DRM_FORMAT_C8:
switch (modifier) {
case DRM_FORMAT_MOD_LINEAR:
case I915_FORMAT_MOD_X_TILED:
case I915_FORMAT_MOD_Y_TILED:
return true;
default:
return false;
}
case DRM_FORMAT_RGB565:
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_ABGR8888:
case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
/* All i915 modifiers are fine */
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:
return true;
default:
return false;
}
default:
return false;
}Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13521
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+case DRM_FORMAT_YUYV : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_VYUY : +return modifier ==DRM_FORMAT_MOD_LINEAR ;Any modifier will do for these formats.
Oops, thanks. See above.
Quoted 28 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +14
-0+default : +return false; + } + +} + +static bool intel_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false;drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13545
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ +if (INTEL_GEN (dev_priv) >=9 ) +return skl_mod_supported (format, modifier); +else if (INTEL_GEN (dev_priv) >=4 ) +return i965_mod_supported (format, modifier); +else +return i8xx_mod_supported (format, modifier); + +return false; +}I'd also like to see .format_mod_supported() + modifiers[] for cursors as well. Those should only accept LINEAR+ARGB8888.
Quoted 2 lines
Apart from those issues, I think this is looking pretty good.
How about:
struct drm_i915_private *dev_priv = to_i915(plane->dev);
if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
return false;
if (plane->base.type == DRM_PLANE_TYPE_PRIMARY)
return modifier == DRM_FORMAT_MOD_LINEAR &&
format == DRM_FORMAT_ARGB8888;
if (INTEL_GEN(dev_priv) >= 9)
return skl_mod_supported(format, modifier);
else if (INTEL_GEN(dev_priv) >= 4)
return i965_mod_supported(format, modifier);
else
return i8xx_mod_supported(format, modifier);
return false;Quoted 188 lines
Quoted 188 lines
drivers/gpu/drm/i915/intel_display.c +18
-4+const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -13462,6 +13553,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static int@@ -13598,6 +13690,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static struct intel_plane *@@ -13608,6 +13701,7 @@ 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 uint64_t *intel_format_modifiers;int ret; primary =kzalloc (sizeof (*primary),GFP_KERNEL );@@ -13646,24 +13740,28 @@ 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; 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 = i9xx_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 = i9xx_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 = i9xx_format_modifiers; primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;@@ -13673,21 +13771,21 @@ 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 , + intel_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 , + intel_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 , + intel_format_modifiers,DRM_PLANE_TYPE_PRIMARY ,"plane %c" ,plane_name (primary->plane));if (ret)@@ -13817,6 +13915,11 @@ intel_update_cursor_plane(struct drm_plane *plane,intel_crtc_update_cursor (crtc, crtc_state, state); } +static const uint64_t cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static struct intel_plane *intel_cursor_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) {@@ -13852,7 +13955,8 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)0 , &intel_cursor_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats), -NULL ,DRM_PLANE_TYPE_CURSOR , + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , "cursor %c", pipe_name(pipe));if (ret) goto fail;drivers/gpu/drm/i915/intel_sprite.c +21
-1@@ -1053,6 +1053,12 @@ static const uint32_t ilk_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t i9xx_plane_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t snb_plane_formats[] = {DRM_FORMAT_XBGR8888 ,DRM_FORMAT_XRGB8888 ,@@ -1088,6 +1094,14 @@ static uint32_t skl_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_plane_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +struct intel_plane *intel_sprite_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe,int plane)@@ -1096,6 +1110,7 @@ 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 uint64_t *modifiers;unsigned int supported_rotations;int num_plane_formats;int ret;@@ -1122,6 +1137,7 @@ 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 (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { intel_plane->can_scale = false; intel_plane->max_downscale =1 ;@@ -1131,6 +1147,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = vlv_plane_formats; num_plane_formats =ARRAY_SIZE (vlv_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else if (INTEL_GEN (dev_priv) >=7 ) {if (IS_IVYBRIDGE (dev_priv)) { intel_plane->can_scale = true;@@ -1145,6 +1162,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else { intel_plane->can_scale = true; intel_plane->max_downscale =16 ;@@ -1152,6 +1170,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane; + modifiers = i9xx_plane_format_modifiers;if (IS_GEN6 (dev_priv)) { plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats);@@ -1186,13 +1205,15 @@ 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + 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,
Quoted 12 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +2
-2-NULL ,DRM_PLANE_TYPE_OVERLAY , + modifiers, +DRM_PLANE_TYPE_OVERLAY , "sprite %c", sprite_name(pipe, plane));if (ret) goto fail; --2.12.1
Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/i915: Add format modifiers for Intel
Quoted 141 lines · Ben Widawsky
Quoted 98 lines · Ville Syrjälä
Quoted 83 lines · Ben Widawsky
This was based on a patch originally by Kristian. It has been modified pretty heavily to use the new callbacks from the previous patch.
v2:
- Add LINEAR and Yf modifiers to list (Ville)
- Combine i8xx and i965 into one list of formats (Ville)
- Allow 1010102 formats for Y/Yf tiled (Ville)v3:
- Handle cursor formats (Ville)
- Put handling for LINEAR in themod_supportfunctions (Ville)Cc Ville Syrjälä <[email protected]>Cc Kristian H. Kristensen <[email protected]>Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 112 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 25 +++++++- 2 files changed, 131 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +41
-0@@ -72,6 +72,12 @@ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_XBGR2101010, }; +static const uint64_t i9xx_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t skl_primary_formats[] = {DRM_FORMAT_C8 ,DRM_FORMAT_RGB565 ,@@ -87,6 +93,14 @@ static const uint32_t skl_primary_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +/* Cursor formats */ static const uint32_t intel_cursor_formats[] = {DRM_FORMAT_ARGB8888 ,@@ -13453,6 +13467,83 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (to_intel_plane (plane)); } +static bool i8xx_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_XRGB8888 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i965_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false;drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13506
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ } +} + +static bool skl_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier < I915_FORMAT_MOD_Yf_TILED);The >= stuff makes this harder to parse than it should be IMO. I'd just list each modifier explicitly.
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13516
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + (modifier >=I915_FORMAT_MOD_X_TILED && + modifier <= I915_FORMAT_MOD_Yf_TILED);ditto. At first I couldn't even spot the difference between this and the C8 case.
Okay, got those both. I think for now it's just:
switch (format) { case DRM_FORMAT_C8: switch (modifier) { case DRM_FORMAT_MOD_LINEAR: case I915_FORMAT_MOD_X_TILED: case I915_FORMAT_MOD_Y_TILED: return true; default: return false; } case DRM_FORMAT_RGB565: case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XBGR8888: case DRM_FORMAT_ARGB8888: case DRM_FORMAT_ABGR8888: case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_YUYV: case DRM_FORMAT_YVYU: case DRM_FORMAT_UYVY: case DRM_FORMAT_VYUY: /* All i915 modifiers are fine */ switch (modifier) { case DRM_FORMAT_MOD_LINEAR: case I915_FORMAT_MOD_X_TILED: case I915_FORMAT_MOD_Y_TILED:
Quoted 8 lines
case I915_FORMAT_MOD_Yf_TILED:
return true;
default:
return false;
}
default:
return false;
}lgtm
Quoted 45 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13521
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+case DRM_FORMAT_YUYV : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_VYUY : +return modifier ==DRM_FORMAT_MOD_LINEAR ;Any modifier will do for these formats.
Oops, thanks. See above.
Quoted 28 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +14
-0+default : +return false; + } + +} + +static bool intel_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false;drivers/gpu/drm/i915/intel_display.c void intel_plane_destroy(struct drm_plane *plane) · line 13545
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ +if (INTEL_GEN (dev_priv) >=9 ) +return skl_mod_supported (format, modifier); +else if (INTEL_GEN (dev_priv) >=4 ) +return i965_mod_supported (format, modifier); +else +return i8xx_mod_supported (format, modifier); + +return false; +}I'd also like to see .format_mod_supported() + modifiers[] for cursors as well. Those should only accept LINEAR+ARGB8888.
Quoted 2 lines
Apart from those issues, I think this is looking pretty good.
Quoted 7 lines
How about:
struct drm_i915_private *dev_priv = to_i915(plane->dev); if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) return false; if (plane->base.type == DRM_PLANE_TYPE_PRIMARY)
I presume you meant CURSOR. But there's no need to mess up this function with cursor information. It can have its own function.
Quoted 9 lines
return modifier == DRM_FORMAT_MOD_LINEAR &&
format == DRM_FORMAT_ARGB8888;
if (INTEL_GEN(dev_priv) >= 9)
return skl_mod_supported(format, modifier);
else if (INTEL_GEN(dev_priv) >= 4)
return i965_mod_supported(format, modifier);
else
return i8xx_mod_supported(format, modifier);It would probably make sense to avoid this indirection as well by plugging these directly into .format_mod_supported(), but that would need some more work as we'd have to have separate plane funcs for each platform.
Actually, now that I think about it, what you have here will work for the primary planes, but it will not work for the sprite planes as those support some extra formats. So either we need to a split between primary vs. sprite, or we just add all the sprite formats into these functions as well. Well, I guess this only affects pre-SKL platforms, so just adding the sprite formats into the i965 function seems like it should work.
Quoted 204 lines
return false;Quoted 200 lines
Quoted 196 lines
drivers/gpu/drm/i915/intel_display.c +18
-4+const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -13462,6 +13553,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static int@@ -13598,6 +13690,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_plane_format_mod_supported, }; static struct intel_plane *@@ -13608,6 +13701,7 @@ 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 uint64_t *intel_format_modifiers;int ret; primary =kzalloc (sizeof (*primary),GFP_KERNEL );@@ -13646,24 +13740,28 @@ 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; 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 = i9xx_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 = i9xx_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 = i9xx_format_modifiers; primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;@@ -13673,21 +13771,21 @@ 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 , + intel_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 , + intel_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 , + intel_format_modifiers,DRM_PLANE_TYPE_PRIMARY ,"plane %c" ,plane_name (primary->plane));if (ret)@@ -13817,6 +13915,11 @@ intel_update_cursor_plane(struct drm_plane *plane,intel_crtc_update_cursor (crtc, crtc_state, state); } +static const uint64_t cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static struct intel_plane *intel_cursor_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) {@@ -13852,7 +13955,8 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)0 , &intel_cursor_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats), -NULL ,DRM_PLANE_TYPE_CURSOR , + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , "cursor %c", pipe_name(pipe));if (ret) goto fail;drivers/gpu/drm/i915/intel_sprite.c +23
-3@@ -1053,6 +1053,12 @@ static const uint32_t ilk_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t i9xx_plane_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t snb_plane_formats[] = {DRM_FORMAT_XBGR8888 ,DRM_FORMAT_XRGB8888 ,@@ -1088,6 +1094,14 @@ static uint32_t skl_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_plane_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +struct intel_plane *intel_sprite_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe,int plane)@@ -1096,6 +1110,7 @@ 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 uint64_t *modifiers;unsigned int supported_rotations;int num_plane_formats;int ret;@@ -1122,6 +1137,7 @@ 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 (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { intel_plane->can_scale = false; intel_plane->max_downscale =1 ;@@ -1131,6 +1147,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = vlv_plane_formats; num_plane_formats =ARRAY_SIZE (vlv_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else if (INTEL_GEN (dev_priv) >=7 ) {if (IS_IVYBRIDGE (dev_priv)) { intel_plane->can_scale = true;@@ -1145,6 +1162,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats); + modifiers = i9xx_plane_format_modifiers; }else { intel_plane->can_scale = true; intel_plane->max_downscale =16 ;@@ -1152,6 +1170,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane; + modifiers = i9xx_plane_format_modifiers;if (IS_GEN6 (dev_priv)) { plane_formats = snb_plane_formats; num_plane_formats =ARRAY_SIZE (snb_plane_formats);@@ -1186,13 +1205,15 @@ 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + 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, -NULL ,DRM_PLANE_TYPE_OVERLAY , + modifiers, +DRM_PLANE_TYPE_OVERLAY ,"sprite %c" ,sprite_name (pipe, plane));if (ret) goto fail; --2.12.1
Signature · 2 lines
Ville Syrjälä Intel OTC
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 squash! drm/i915: Add format modifiers for Intel
make sprite and cursor have separate functions
---
Ville, I think this addresses most of your comments. I'm guessing you're going to ask for separate gen sprite plane functions, but I think this looks pretty decent as is.
---
drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++------ drivers/gpu/drm/i915/intel_sprite.c | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +18 -8
@@ -13535,18 +13535,16 @@ static bool skl_mod_supported(uint32_t format, uint64_t modifier) } } -static bool intel_plane_format_mod_supported (struct drm_plane *plane, -uint32_t format, -uint64_t modifier) +static bool intel_primary_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) {struct drm_i915_private *dev_priv =to_i915 (plane->dev);if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID ))return false; -if (plane->base.type ==DRM_PLANE_TYPE_PRIMARY ) -return modifier ==DRM_FORMAT_MOD_LINEAR && - format ==DRM_FORMAT_ARGB8888 ; +BUG_ON (plane->base.type !=DRM_PLANE_TYPE_PRIMARY );if (INTEL_GEN (dev_priv) >=9 )return skl_mod_supported (format, modifier);
@@ -13558,6 +13556,18 @@ static bool intel_plane_format_mod_supported(struct drm_plane *plane,return false; } +static bool intel_cursor_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false; + +BUG_ON (plane->base.type !=DRM_PLANE_TYPE_CURSOR ); + +return modifier ==DRM_FORMAT_MOD_LINEAR && format ==DRM_FORMAT_ARGB8888 ; +} +const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,
@@ -13567,7 +13577,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_plane_format_mod_supported, + .format_mod_supported = intel_primary_plane_format_mod_supported, }; static int
@@ -13704,7 +13714,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_plane_format_mod_supported, + .format_mod_supported = intel_cursor_plane_format_mod_supported, }; static struct intel_plane *
drivers/gpu/drm/i915/intel_sprite.c +51 -0
63 lines not on this page · raw message
Signature · 6 lines
2.12.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] squash! drm/i915: Add format modifiers for Intel
Quoted 7 lines · Ben Widawsky
make sprite and cursor have separate functions
---Ville, I think this addresses most of your comments. I'm guessing you're going to ask for separate gen sprite plane functions, but I think this looks pretty decent as is.
Yeah, separate might be nice, but I'm fine with this. I think I want to see if I can rethink some of the format check stuff all over anyway. That might want the separate the functions or it might not. I don't think I'll know until I try and see how it would all turn out. In the meantime we can proceed with this.
But plese drop the plane type BUG_ON()s. We've generally decided to not do BUGs anymore, and we don't have such things in any other plane vfunc either. Oh, and it looks like you have some tabs vs. spaces mess in that sprite funciton.
Quoted 141 lines
---
drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++------ drivers/gpu/drm/i915/intel_sprite.c | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 8 deletions(-)drivers/gpu/drm/i915/intel_display.c +18
-8@@ -13535,18 +13535,16 @@ static bool skl_mod_supported(uint32_t format, uint64_t modifier) } } -static bool intel_plane_format_mod_supported (struct drm_plane *plane, -uint32_t format, -uint64_t modifier) +static bool intel_primary_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) {struct drm_i915_private *dev_priv =to_i915 (plane->dev);if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID ))return false; -if (plane->base.type ==DRM_PLANE_TYPE_PRIMARY ) -return modifier ==DRM_FORMAT_MOD_LINEAR && - format ==DRM_FORMAT_ARGB8888 ; +BUG_ON (plane->base.type !=DRM_PLANE_TYPE_PRIMARY );if (INTEL_GEN (dev_priv) >=9 )return skl_mod_supported (format, modifier);@@ -13558,6 +13556,18 @@ static bool intel_plane_format_mod_supported(struct drm_plane *plane,return false; } +static bool intel_cursor_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false; + +BUG_ON (plane->base.type !=DRM_PLANE_TYPE_CURSOR ); + +return modifier ==DRM_FORMAT_MOD_LINEAR && format ==DRM_FORMAT_ARGB8888 ; +} +const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -13567,7 +13577,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_plane_format_mod_supported, + .format_mod_supported = intel_primary_plane_format_mod_supported, }; static int@@ -13704,7 +13714,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_plane_format_mod_supported, + .format_mod_supported = intel_cursor_plane_format_mod_supported, }; static struct intel_plane *drivers/gpu/drm/i915/intel_sprite.c +51
-0@@ -30,6 +30,7 @@* support. */ #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_fourcc.h> #include <drm/drm_rect.h> @@ -1102,6 +1103,56 @@ static const uint64_t skl_plane_format_modifiers[] = {DRM_FORMAT_MOD_INVALID }; +static bool intel_sprite_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false; + +BUG_ON (plane->base.type !=DRM_PLANE_TYPE_OVERLAY ); + +switch (format) { +case DRM_FORMAT_XBGR2101010 : +case DRM_FORMAT_ABGR2101010 : +if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) +return true; +break ; +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_ARGB8888 : +if (INTEL_GEN (dev_priv) >=9 ||IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) +return true; +break ; +case DRM_FORMAT_XBGR8888 : +if (INTEL_GEN (dev_priv) >=6 ) +return true; +break ; +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_YUYV : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_VYUY : +return true; + } + +return false; +} + +const struct drm_plane_funcs intel_sprite_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .set_property = drm_atomic_helper_plane_set_property, + .atomic_get_property = intel_plane_atomic_get_property, + .atomic_set_property = intel_plane_atomic_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_sprite_plane_format_mod_supported, +}; +struct intel_plane *intel_sprite_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe,int plane)Signature · 1 line
2.12.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 3/3 drm/i915: Add format modifiers for Intel
This was based on a patch originally by Kristian. It has been modified pretty heavily to use the new callbacks from the previous patch.
v2:
- Add LINEAR and Yf modifiers to list (Ville)
- Combine i8xx and i965 into one list of formats (Ville)
- Allow 1010102 formats for Y/Yf tiled (Ville)
v3:
- Handle cursor formats (Ville)
- Put handling for LINEAR in the mod_support functions (Ville)
v4:
- List each modifier explicitly in supported modifiers (Ville)
- Handle the CURSOR plane (Ville)
v5:
- Split out cursor and sprite handling (Ville)
--- drivers/gpu/drm/i915/intel_display.c | 132 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 76 +++++++++++++++++++- 2 files changed, 202 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +128 -4
@@ -72,6 +72,12 @@ static const uint32_t i965_primary_formats[] = { DRM_FORMAT_XBGR2101010, }; +static const uint64_t i9xx_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static const uint32_t skl_primary_formats[] = {DRM_FORMAT_C8 ,DRM_FORMAT_RGB565 ,
@@ -87,6 +93,14 @@ static const uint32_t skl_primary_formats[] = { DRM_FORMAT_VYUY, }; +static const uint64_t skl_format_modifiers[] = { + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED , +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +/* Cursor formats */ static const uint32_t intel_cursor_formats[] = {DRM_FORMAT_ARGB8888 ,
@@ -13453,6 +13467,103 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (to_intel_plane (plane)); } +static bool i8xx_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_XRGB8888 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i965_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool skl_mod_supported (uint32_t format,uint64_t modifier) +{ +switch (format) { +case DRM_FORMAT_C8 : +switch (modifier) { +case DRM_FORMAT_MOD_LINEAR : +case I915_FORMAT_MOD_X_TILED : +case I915_FORMAT_MOD_Y_TILED : +return true; +default : +return false; + } +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +case DRM_FORMAT_YUYV : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_VYUY : +/* All i915 modifiers are fine */ +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: +return true; +default : +return false; + } +default : +return false; + } +} + +static bool intel_primary_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false; + +if (INTEL_GEN (dev_priv) >=9 ) +return skl_mod_supported (format, modifier); +else if (INTEL_GEN (dev_priv) >=4 ) +return i965_mod_supported (format, modifier); +else +return i8xx_mod_supported (format, modifier); + +return false; +} + +static bool intel_cursor_plane_format_mod_supported (struct drm_plane *plane, +uint32_t format, +uint64_t modifier) +{ +if (WARN_ON (modifier ==DRM_FORMAT_MOD_INVALID )) +return false; + +return modifier ==DRM_FORMAT_MOD_LINEAR && format ==DRM_FORMAT_ARGB8888 ; +} +const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,
@@ -13462,6 +13573,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_primary_plane_format_mod_supported, }; static int
@@ -13598,6 +13710,7 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_cursor_plane_format_mod_supported, }; static struct intel_plane *
@@ -13608,6 +13721,7 @@ 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 uint64_t *intel_format_modifiers;int ret; primary =kzalloc (sizeof (*primary),GFP_KERNEL );
@@ -13646,24 +13760,28 @@ 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; 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 = i9xx_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 = i9xx_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 = i9xx_format_modifiers; primary->update_plane = i9xx_update_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;
@@ -13673,21 +13791,21 @@ 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 , + intel_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 , + intel_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 , + intel_format_modifiers,DRM_PLANE_TYPE_PRIMARY ,"plane %c" ,plane_name (primary->plane));if (ret)
@@ -13817,6 +13935,11 @@ intel_update_cursor_plane(struct drm_plane *plane,intel_crtc_update_cursor (crtc, crtc_state, state); } +static const uint64_t cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; +static struct intel_plane *intel_cursor_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) {
@@ -13852,7 +13975,8 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)0 , &intel_cursor_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats), -NULL ,DRM_PLANE_TYPE_CURSOR , + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , "cursor %c", pipe_name(pipe));if (ret) goto fail;
drivers/gpu/drm/i915/intel_sprite.c +74 -2
135 lines not on this page · raw message
Signature · 6 lines
2.12.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE
In reply to Ben Widawsky== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE
URL : https://patchwork.freedesktop.org/series/21854/
State : success
== Summary ==
Series 21854v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/21854/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
fail -> PASS (fi-snb-2600) fdo#100007fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fi-bdw-5557u total:278 pass:262 dwarn:0 dfail:0 fail:5 skip:11 time: 466s fi-bdw-gvtdvm total:278 pass:251 dwarn:8 dfail:0 fail:5 skip:14 time: 453s fi-bsw-n3050 total:278 pass:234 dwarn:0 dfail:0 fail:5 skip:39 time: 592s fi-bxt-j4205 total:278 pass:254 dwarn:0 dfail:0 fail:5 skip:19 time: 539s fi-bxt-t5700 total:278 pass:253 dwarn:0 dfail:0 fail:5 skip:20 time: 564s fi-byt-j1900 total:278 pass:246 dwarn:0 dfail:0 fail:5 skip:27 time: 510s fi-byt-n2820 total:278 pass:242 dwarn:0 dfail:0 fail:5 skip:31 time: 504s fi-hsw-4770 total:278 pass:257 dwarn:0 dfail:0 fail:5 skip:16 time: 438s fi-hsw-4770r total:278 pass:257 dwarn:0 dfail:0 fail:5 skip:16 time: 432s fi-ilk-650 total:278 pass:223 dwarn:0 dfail:0 fail:5 skip:50 time: 447s fi-ivb-3520m total:278 pass:255 dwarn:0 dfail:0 fail:5 skip:18 time: 516s fi-ivb-3770 total:278 pass:255 dwarn:0 dfail:0 fail:5 skip:18 time: 503s fi-kbl-7500u total:278 pass:255 dwarn:0 dfail:0 fail:5 skip:18 time: 481s fi-skl-6260u total:278 pass:263 dwarn:0 dfail:0 fail:5 skip:10 time: 486s fi-skl-6700hq total:278 pass:255 dwarn:0 dfail:0 fail:5 skip:18 time: 608s fi-skl-6700k total:278 pass:251 dwarn:4 dfail:0 fail:5 skip:18 time: 480s fi-skl-6770hq total:278 pass:263 dwarn:0 dfail:0 fail:5 skip:10 time: 517s fi-skl-gvtdvm total:278 pass:260 dwarn:0 dfail:0 fail:5 skip:13 time: 461s fi-snb-2520m total:278 pass:245 dwarn:0 dfail:0 fail:5 skip:28 time: 552s fi-snb-2600 total:278 pass:244 dwarn:0 dfail:0 fail:5 skip:29 time: 424s
36ae70c6a67b894a97ba4098a32e091334ef51bc drm-tip: 2017y-03m-24d-19h-36m-19s UTC integration manifest 816a758 drm/i915: Add format modifiers for Intel
e906273 drm: Add new DRM_IOCTL_MODE_GETPLANE2
45b6fd7 drm/i915: Use LINEAR modifier instead of NONE
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4299/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Ben Widawsky
They're the same, so use the one which makes more sense.
Signed-off-by Ben Widawsky <[email protected]>
Quoted 141 lines
--- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_display.c +14
-14@@ -1997,7 +1997,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)unsigned int cpp = fb->format->cpp[plane];switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :return cpp;case I915_FORMAT_MOD_X_TILED :if (IS_GEN2 (dev_priv))@@ -2033,7 +2033,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)static unsigned int intel_tile_height (const struct drm_framebuffer *fb,int plane) { -if (fb->modifier ==DRM_FORMAT_MOD_NONE ) +if (fb->modifier ==DRM_FORMAT_MOD_LINEAR )return 1 ;else return intel_tile_size(to_i915(fb->dev)) /@@ -2107,7 +2107,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,return 4096 ;switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :return intel_linear_alignment (dev_priv);case I915_FORMAT_MOD_X_TILED :if (INTEL_GEN (dev_priv) >=9 )@@ -2290,7 +2290,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,WARN_ON (new_offset > old_offset); -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_size, tile_width, tile_height;unsigned int pitch_tiles;@@ -2345,7 +2345,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,if (alignment) alignment--; -if (fb_modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb_modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_size, tile_width, tile_height;unsigned int tile_rows, tiles, pitch_tiles;@@ -2471,7 +2471,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv, DRM_ROTATE_0, tile_size); offset /= tile_size; -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_width, tile_height;unsigned int pitch_tiles;struct drm_rect r;@@ -2803,7 +2803,7 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, int plane,int cpp = fb->format->cpp[plane];switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :case I915_FORMAT_MOD_X_TILED :switch (cpp) {case 8 :@@ -3199,7 +3199,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,static u32 intel_fb_stride_alignment (const struct drm_framebuffer *fb,int plane) { -if (fb->modifier ==DRM_FORMAT_MOD_NONE ) +if (fb->modifier ==DRM_FORMAT_MOD_LINEAR )return 64 ;else return intel_tile_width_bytes (fb, plane);@@ -3298,7 +3298,7 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :break ;case I915_FORMAT_MOD_X_TILED :return PLANE_CTL_TILED_X ;@@ -8426,7 +8426,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, tiling = val &PLANE_CTL_TILED_MASK ;switch (tiling) {case PLANE_CTL_TILED_LINEAR : - fb->modifier =DRM_FORMAT_MOD_NONE ; + fb->modifier =DRM_FORMAT_MOD_LINEAR ;break ;case PLANE_CTL_TILED_X : plane_config->tiling =I915_TILING_X ;@@ -10399,7 +10399,7 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc, ctl =I915_READ (PLANE_CTL (pipe,0 )); ctl &= ~PLANE_CTL_TILED_MASK ;switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :break ;case I915_FORMAT_MOD_X_TILED : ctl |=PLANE_CTL_TILED_X ;@@ -13756,7 +13756,7 @@ intel_check_cursor_plane(struct drm_plane *plane,return -ENOMEM ; } -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {DRM_DEBUG_KMS ("cursor cannot be tiled\n" );return -EINVAL ; }@@ -14412,7 +14412,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, mode_cmd->modifier[0]); goto err; } -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :case I915_FORMAT_MOD_X_TILED :break ;default :@@ -14435,7 +14435,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, mode_cmd->pixel_format);if (mode_cmd->pitches[0 ] > pitch_limit) {DRM_DEBUG_KMS ("%s pitch (%u) must be at most %d\n" , - mode_cmd->modifier[0 ] !=DRM_FORMAT_MOD_NONE ? + mode_cmd->modifier[0 ] !=DRM_FORMAT_MOD_LINEAR ?"tiled" :"linear" , mode_cmd->pitches[0 ], pitch_limit); goto err;Signature · 6 lines
2.12.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Ville Syrjälä
Quoted 3 lines · Ben Widawsky
They're the same, so use the one which makes more sense.
Signed-off-by Ben Widawsky <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>
And pushed to dinq immediately. Thanks for the patch.
Quoted 150 lines
Quoted 142 lines
--- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_display.c +14
-14@@ -1997,7 +1997,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)unsigned int cpp = fb->format->cpp[plane];switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :return cpp;case I915_FORMAT_MOD_X_TILED :if (IS_GEN2 (dev_priv))@@ -2033,7 +2033,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int plane)static unsigned int intel_tile_height (const struct drm_framebuffer *fb,int plane) { -if (fb->modifier ==DRM_FORMAT_MOD_NONE ) +if (fb->modifier ==DRM_FORMAT_MOD_LINEAR )return 1 ;else return intel_tile_size(to_i915(fb->dev)) /@@ -2107,7 +2107,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,return 4096 ;switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :return intel_linear_alignment (dev_priv);case I915_FORMAT_MOD_X_TILED :if (INTEL_GEN (dev_priv) >=9 )@@ -2290,7 +2290,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,WARN_ON (new_offset > old_offset); -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_size, tile_width, tile_height;unsigned int pitch_tiles;@@ -2345,7 +2345,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,if (alignment) alignment--; -if (fb_modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb_modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_size, tile_width, tile_height;unsigned int tile_rows, tiles, pitch_tiles;@@ -2471,7 +2471,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv, DRM_ROTATE_0, tile_size); offset /= tile_size; -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {unsigned int tile_width, tile_height;unsigned int pitch_tiles;struct drm_rect r;@@ -2803,7 +2803,7 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, int plane,int cpp = fb->format->cpp[plane];switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :case I915_FORMAT_MOD_X_TILED :switch (cpp) {case 8 :@@ -3199,7 +3199,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,static u32 intel_fb_stride_alignment (const struct drm_framebuffer *fb,int plane) { -if (fb->modifier ==DRM_FORMAT_MOD_NONE ) +if (fb->modifier ==DRM_FORMAT_MOD_LINEAR )return 64 ;else return intel_tile_width_bytes (fb, plane);@@ -3298,7 +3298,7 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)static u32 skl_plane_ctl_tiling (uint64_t fb_modifier) {switch (fb_modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :break ;case I915_FORMAT_MOD_X_TILED :return PLANE_CTL_TILED_X ;@@ -8426,7 +8426,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, tiling = val &PLANE_CTL_TILED_MASK ;switch (tiling) {case PLANE_CTL_TILED_LINEAR : - fb->modifier =DRM_FORMAT_MOD_NONE ; + fb->modifier =DRM_FORMAT_MOD_LINEAR ;break ;case PLANE_CTL_TILED_X : plane_config->tiling =I915_TILING_X ;@@ -10399,7 +10399,7 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc, ctl =I915_READ (PLANE_CTL (pipe,0 )); ctl &= ~PLANE_CTL_TILED_MASK ;switch (fb->modifier) { -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :break ;case I915_FORMAT_MOD_X_TILED : ctl |=PLANE_CTL_TILED_X ;@@ -13756,7 +13756,7 @@ intel_check_cursor_plane(struct drm_plane *plane,return -ENOMEM ; } -if (fb->modifier !=DRM_FORMAT_MOD_NONE ) { +if (fb->modifier !=DRM_FORMAT_MOD_LINEAR ) {DRM_DEBUG_KMS ("cursor cannot be tiled\n" );return -EINVAL ; }@@ -14412,7 +14412,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, mode_cmd->modifier[0]); goto err; } -case DRM_FORMAT_MOD_NONE : +case DRM_FORMAT_MOD_LINEAR :case I915_FORMAT_MOD_X_TILED :break ;default :@@ -14435,7 +14435,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, mode_cmd->pixel_format);if (mode_cmd->pitches[0 ] > pitch_limit) {DRM_DEBUG_KMS ("%s pitch (%u) must be at most %d\n" , - mode_cmd->modifier[0 ] !=DRM_FORMAT_MOD_NONE ? + mode_cmd->modifier[0 ] !=DRM_FORMAT_MOD_LINEAR ?"tiled" :"linear" , mode_cmd->pitches[0 ], pitch_limit); goto err;Signature · 6 lines
2.12.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE (rev2)
In reply to Ben Widawsky== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE (rev2)
URL : https://patchwork.freedesktop.org/series/21854/
State : success
== Summary ==
Series 21854v2 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/21854/revisions/2/mbox/
Test gem_exec_suspend:
Subgroup basic-s4-devices:
dmesg-warn -> PASS (fi-kbl-7560u) fdo#100125fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 430s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 424s fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 564s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 508s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 550s fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 484s fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 482s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 412s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 410s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 421s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 481s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 467s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 453s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 565s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 457s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 574s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 463s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 491s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 432s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 528s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 403s
a544b108466ecc1d3819b735f7c35f7f8c071b9a drm-tip: 2017y-03m-31d-14h-34m-10s UTC integration manifest 6ed3e31 drm: Add new DRM_IOCTL_MODE_GETPLANE2
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4375/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE (rev3)
In reply to Ben Widawsky== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: Use LINEAR modifier instead of NONE (rev3)
URL : https://patchwork.freedesktop.org/series/21854/
State : failure
== Summary ==
LD drivers/acpi/acpica/built-in.o CC [M] drivers/gpu/drm/i915/gvt/execlist.o CC [M] drivers/gpu/drm/i915/gvt/scheduler.o LD lib/raid6/built-in.o CC [M] drivers/gpu/drm/i915/gvt/sched_policy.o CC [M] drivers/gpu/drm/i915/gvt/render.o CC [M] drivers/gpu/drm/i915/gvt/cmd_parser.o CC [M] drivers/gpu/drm/i915/intel_lpe_audio.o LD drivers/pci/pcie/aer/aerdriver.o LD drivers/pci/pcie/aer/built-in.o LD drivers/pci/pcie/built-in.o LD [M] drivers/usb/serial/usbserial.o LD drivers/acpi/built-in.o LD [M] sound/pci/hda/snd-hda-codec-realtek.o LD [M] sound/pci/hda/snd-hda-codec-hdmi.o LD drivers/spi/built-in.o LD drivers/scsi/scsi_mod.o LD drivers/pci/built-in.o LD net/packet/built-in.o LD drivers/video/fbdev/core/fb.o LD drivers/video/fbdev/core/built-in.o LD drivers/iommu/built-in.o LD [M] drivers/gpu/drm/vgem/vgem.o LD drivers/usb/storage/usb-storage.o LD drivers/usb/storage/built-in.o LD drivers/video/fbdev/built-in.o LD drivers/usb/gadget/libcomposite.o LD [M] drivers/net/ethernet/intel/e1000/e1000.o LD lib/lz4/built-in.o LD drivers/scsi/sd_mod.o LD drivers/scsi/built-in.o LD kernel/sched/built-in.o LD [M] drivers/net/ethernet/intel/igbvf/igbvf.o LD kernel/built-in.o LD drivers/tty/serial/8250/8250_base.o LD drivers/tty/serial/8250/built-in.o LD drivers/tty/serial/built-in.o LD net/xfrm/built-in.o LD drivers/usb/gadget/udc/udc-core.o LD drivers/usb/gadget/udc/built-in.o LD drivers/usb/gadget/built-in.o
drivers/gpu/drm/i915/intel_display.c: In function ‘intel_primary_plane_create’:drivers/gpu/drm/i915/intel_display.c:13746:1: error: expected expression before ‘<<’ token
<<<<<<< f09b91b0901f5fd3fabeb887a6fd38b0dafd1474
^drivers/gpu/drm/i915/intel_display.c:13753:27: error: ‘ironlake_update_primary_plane’ undeclared (first use in this function)
primary->update_plane = ironlake_update_primary_plane;
^drivers/gpu/drm/i915/intel_display.c:13753:27: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/i915/intel_display.c:13755:1: error: expected expression before ‘>>’ token
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drm/i915: Add format modifiers for Intel
^
LD drivers/gpu/drm/drm.o LD drivers/video/console/built-in.o LD drivers/video/built-in.o LD net/ipv6/ipv6.o AR lib/lib.a
scripts/Makefile.build:294: recipe for target 'drivers/gpu/drm/i915/intel_display.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_display.o] Error 1
make[4]: *** Waiting for unfinished jobs....
EXPORTS lib/lib-ksyms.o
LD net/ipv6/built-in.o LD lib/built-in.o LD fs/btrfs/btrfs.o LD drivers/usb/core/usbcore.o LD drivers/usb/core/built-in.o LD drivers/md/md-mod.o LD drivers/md/built-in.o LD fs/btrfs/built-in.o LD drivers/tty/vt/built-in.o LD drivers/tty/built-in.o LD [M] sound/pci/hda/snd-hda-codec-generic.o LD sound/pci/built-in.o LD sound/built-in.o CC arch/x86/kernel/cpu/capflags.o LD arch/x86/kernel/cpu/built-in.o LD arch/x86/kernel/built-in.o LD arch/x86/built-in.o LD [M] drivers/net/ethernet/intel/igb/igb.o LD net/ipv4/built-in.o LD drivers/usb/host/xhci-hcd.o LD fs/ext4/ext4.o LD fs/ext4/built-in.o LD drivers/usb/host/built-in.o LD fs/built-in.o LD drivers/usb/built-in.o LD [M] drivers/net/ethernet/intel/e1000e/e1000e.o LD net/core/built-in.o LD net/built-in.o
scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2 scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2 scripts/Makefile.build:553: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
make[1]: *** Waiting for unfinished jobs....
LD drivers/net/ethernet/built-in.o
LD drivers/net/built-in.o
Makefile:1002: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx