Re: [PATCH v5 3/3] drm/i915: Add format modifiers for Intel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ben,

A couple of small questions/suggestions that I hope you find useful.
Please don't block any of this work based on my comments.

On 16 May 2017 at 22:31, Ben Widawsky <ben@xxxxxxxxxxxx> wrote:

> +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);
> +
Nit: if you rewrite this as below, the control flow should be clearer.
Thus the 'return false;' at the end, will be [more] obvious that it's
unreachable ;-)

       if (INTEL_GEN(dev_priv) >= 9)
               return skl_mod_supported(format, modifier);

       if (INTEL_GEN(dev_priv) >= 4)
               return i965_mod_supported(format, modifier);

       return i8xx_mod_supported(format, modifier);


> +       return false;
> +}
> +


> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c

> +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,
> +};
> +
Having a dull moment - is intel_sprite_plane_funcs (+
intel_sprite_plane_format_mod_supported) unused or I'm seeing things?
If one is to keep it, for future work, perhaps it's worth adding a 2-3
word comment,

Regards,
Emil
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux