Hi,

On 18 November 2016 at 14:50, Emil Velikov <emil.l.veli...@gmail.com> wrote:
> On 16 November 2016 at 09:28, Varad Gautam <varadgau...@gmail.com> wrote:
>> +   if (nonzero_modifier_found && dri2_dpy->image->createImageFromDmaBufs2) {
>> +      dri_image =
>> +         dri2_dpy->image->createImageFromDmaBufs2(dri2_dpy->dri_screen,
>> +            attrs.Width, attrs.Height, attrs.DMABufFourCC.Value,
>> +            fds, num_fds, pitches, offsets, modifiers,
>> +            attrs.DMABufYuvColorSpaceHint.Value,
>> +            attrs.DMABufSampleRangeHint.Value,
>> +            attrs.DMABufChromaHorizontalSiting.Value,
>> +            attrs.DMABufChromaVerticalSiting.Value,
>> +            &error,
>> +            NULL);
>> +   } else {
>> +      if (nonzero_modifier_found) {
>> +         _eglError(EGL_BAD_MATCH, "unsupported dma_buf format modifier");
>> +         return EGL_NO_IMAGE_KHR;
>> +      }
>> +
> Using something like the following might be better?
>
> if (nonzero_modifier_found) {
>    if (!dri2_dpy->image->createImageFromDmaBufs2)
>      # assert should never reach here, since the extension should be
> advertised only if the API is available.
>    use new API
> else
>    use old API

Actually, present-and-zero modifier has a very well-defined meaning:
it _forces_ linear interpretation of the buffer, whereas a non-present
modifier may cause a kernel query (e.g. i915_gem_get_tiling) to
discover a hidden tiling mode. So, if present, the modifier should be
passed.

Cheers,
Daniel
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to