[Mesa-dev] [PATCH v2] egl_dri2: add support for using modifier attributes in eglCreateImageKHR
Daniel Stone
daniel at fooishbar.org
Fri Nov 18 15:17:07 UTC 2016
Hi,
On 18 November 2016 at 14:50, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 16 November 2016 at 09:28, Varad Gautam <varadgautam at 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
More information about the mesa-dev
mailing list