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

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

 



On 18 May 2017 at 02:14, Ben Widawsky <ben@xxxxxxxxxxxx> wrote:
> On 17-05-17 01:20:50, Emil Velikov wrote:
>>
>> 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);
>>
>>
>
> It's a good point, however many other blocks of code do the same thing, and
> I
> think the nature of if/else if/else implies unreachable. I can add
> unreachable()... In fact, I just did.
>
>
The "implies" argument is a bit odd, but that's just bikesheding, so
feel free to ignore me.

>>> +       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
>
>
> Not sure how this happened, it is a mistake.
I've spotted an actual bug alongside my bikeshedding, Yay!

Fwiw
Reviewed-by: Emil Velikov <emil.velikov@xxxxxxxxxxxxx>

-Emil
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux