[PATCH] mfplat: Properly align memory allocated by IMF2DBuffer.

Giovanni Mascellani gmascellani at codeweavers.com
Mon Mar 14 08:59:49 CDT 2022


Hi,

Il 14/03/22 09:40, Nikolay Sivov ha scritto:
> +    /* Alignment tests */
> +    for (i = 0; i < ARRAY_SIZE(_2d_buffer_tests); ++i)
> +    {
> +        const struct _2d_buffer_test *ptr = &_2d_buffer_tests[i];
> +
> +        hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->fourcc, FALSE, &buffer);
> +        ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
> +
> +        hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer);
> +        ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
> +
> +        hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch);
> +        ok(hr == S_OK, "Failed to lock buffer, hr %#lx.\n", hr);
> +        ok(((uintptr_t)data & (pitch - 1)) == 0, "Misaligned data at %p.\n", data);

This doesn't really make sense to me: pitch is not necessarily a power 
of two. I think that either you just test with 64 bytes alignment (and 
ignore stronger alignments), or you annotate the tests to know which 
require 64 bytes and which require 128 byte.

Thanks, Giovanni.



More information about the wine-devel mailing list