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

Nikolay Sivov nsivov at codeweavers.com
Mon Mar 14 09:03:18 CDT 2022



On 3/14/22 16:59, Giovanni Mascellani wrote:
> 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.

All existing tests are already either 64 or 128.

>
> Thanks, Giovanni.




More information about the wine-devel mailing list