Commit 071eb50f authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

mfplat: Fix locking flags usage for DXGI buffers.

parent df660e80
...@@ -1041,9 +1041,13 @@ static HRESULT dxgi_surface_buffer_lock(struct buffer *buffer, MF2DBuffer_LockFl ...@@ -1041,9 +1041,13 @@ static HRESULT dxgi_surface_buffer_lock(struct buffer *buffer, MF2DBuffer_LockFl
hr = MF_E_UNEXPECTED; hr = MF_E_UNEXPECTED;
else if (!buffer->_2d.locks) else if (!buffer->_2d.locks)
hr = dxgi_surface_buffer_map(buffer); hr = dxgi_surface_buffer_map(buffer);
else if (buffer->_2d.lock_flags == MF2DBuffer_LockFlags_Write && flags != MF2DBuffer_LockFlags_Write)
hr = HRESULT_FROM_WIN32(ERROR_WAS_LOCKED);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
if (!buffer->_2d.locks)
buffer->_2d.lock_flags = flags;
buffer->_2d.locks++; buffer->_2d.locks++;
*scanline0 = buffer->dxgi_surface.map_desc.pData; *scanline0 = buffer->dxgi_surface.map_desc.pData;
*pitch = buffer->dxgi_surface.map_desc.RowPitch; *pitch = buffer->dxgi_surface.map_desc.RowPitch;
...@@ -1087,7 +1091,10 @@ static HRESULT WINAPI dxgi_surface_buffer_Unlock2D(IMF2DBuffer2 *iface) ...@@ -1087,7 +1091,10 @@ static HRESULT WINAPI dxgi_surface_buffer_Unlock2D(IMF2DBuffer2 *iface)
if (buffer->_2d.locks) if (buffer->_2d.locks)
{ {
if (!--buffer->_2d.locks) if (!--buffer->_2d.locks)
{
dxgi_surface_buffer_unmap(buffer); dxgi_surface_buffer_unmap(buffer);
buffer->_2d.lock_flags = 0;
}
} }
else else
hr = HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED); hr = HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED);
......
...@@ -7529,13 +7529,10 @@ static void test_d3d11_surface_buffer(void) ...@@ -7529,13 +7529,10 @@ static void test_d3d11_surface_buffer(void)
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Write, &data, &pitch, &data2, &length); hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Write, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length); hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr); ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length); hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr); ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer_Lock2D(_2d_buffer, &data, &pitch); hr = IMF2DBuffer_Lock2D(_2d_buffer, &data, &pitch);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr); ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2); hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
...@@ -7543,7 +7540,6 @@ static void test_d3d11_surface_buffer(void) ...@@ -7543,7 +7540,6 @@ static void test_d3d11_surface_buffer(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2); hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED), "Unexpected hr %#lx.\n", hr); ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED), "Unexpected hr %#lx.\n", hr);
IMF2DBuffer2_Release(_2dbuffer2); IMF2DBuffer2_Release(_2dbuffer2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment