[Mesa-dev] [v8 8/9] egl/dri2: support for creating images out of dma buffers
Chad Versace
chad.versace at linux.intel.com
Thu Jul 25 09:35:19 PDT 2013
On 07/24/2013 11:22 PM, Pohjolainen, Topi wrote:
> On Wed, Jul 24, 2013 at 05:02:50PM -0700, Chad Versace wrote:
>> On 07/24/2013 03:23 AM, Topi Pohjolainen wrote:
>>> +
>>> + /**
>>> + * The spec says:
>>> + *
>>> + * "If <target> is EGL_LINUX_DMA_BUF_EXT, and the EGL_LINUX_DRM_FOURCC_EXT
>>> + * attribute indicates a single-plane format, EGL_BAD_ATTRIBUTE is
>>> + * generated if any of the EGL_DMA_BUF_PLANE1_* or EGL_DMA_BUF_PLANE2_*
>>> + * attributes are specified."
>>> + */
>>> + for ( ; i < 3; ++i) {
>>> + if (attrs->DMABufPlaneFds[i].IsPresent ||
>>> + attrs->DMABufPlaneOffsets[i].IsPresent ||
>>> + attrs->DMABufPlanePitches[i].IsPresent) {
>>> + _eglError(EGL_BAD_ATTRIBUTE, "too many plane attributes");
>>> + return 0;
>>> + }
>>> + }
>>> +
>>> + return plane_n;
>>> +}
>>
>> This loop looks buggy. I think the loop head should be
>> for (i = plane_n; i < 3; ++i)
>
> If the 'return' statement in the previous loop is not taken, one always ends up
> here with 'i == plane_n'. I can reset 'i' explicitly also if you think it is
> clearer.
Ah, I see now. Please set 'i' explicitly. Otherwise, this loop poses a difficult
puzzle for everyone who encounters it.
More information about the mesa-dev
mailing list