Commit 4066587f authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Remove DIB locking calls from all blitting entry points.

parent c1297ac0
......@@ -762,8 +762,6 @@ BOOL X11DRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
if (usePat && !X11DRV_SetupGCForBrush( physDev )) return TRUE;
X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod );
wine_tsx11_lock();
XSetFunction( gdi_display, physDev->gc, OP_ROP(*opcode) );
......@@ -802,8 +800,6 @@ BOOL X11DRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
dst->visrect.right - dst->visrect.left,
dst->visrect.bottom - dst->visrect.top );
wine_tsx11_unlock();
X11DRV_UnlockDIBSection( physDev, TRUE );
return TRUE;
}
......@@ -832,10 +828,6 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
width = dst->visrect.right - dst->visrect.left;
height = dst->visrect.bottom - dst->visrect.top;
X11DRV_LockDIBSection( physDevDst, DIB_Status_GdiMod );
if (physDevDst != physDevSrc) X11DRV_LockDIBSection( physDevSrc, DIB_Status_GdiMod );
opcode = BITBLT_Opcodes[(rop >> 16) & 0xff];
/* a few optimizations for single-op ROPs */
......@@ -854,7 +846,7 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
physDevDst->dc_rect.top + dst->visrect.top );
physDevDst->exposures++;
wine_tsx11_unlock();
goto done;
return TRUE;
}
if (physDevSrc->depth == 1)
{
......@@ -871,7 +863,7 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
physDevDst->dc_rect.top + dst->visrect.top, 1 );
physDevDst->exposures++;
wine_tsx11_unlock();
goto done;
return TRUE;
}
}
......@@ -919,10 +911,6 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
XFreePixmap( gdi_display, src_pixmap );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
done:
if (physDevDst != physDevSrc) X11DRV_UnlockDIBSection( physDevSrc, FALSE );
X11DRV_UnlockDIBSection( physDevDst, TRUE );
return TRUE;
}
......@@ -1263,7 +1251,6 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
GC gc;
if (clip) clip_data = X11DRV_GetRegionData( clip, 0 );
X11DRV_DIB_Lock( bitmap, DIB_Status_GdiMod );
wine_tsx11_lock();
gc = XCreateGC( gdi_display, bitmap->pixmap, 0, NULL );
......@@ -1274,16 +1261,12 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
dst->visrect.left, dst->visrect.top, width, height );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
X11DRV_DIB_Unlock( bitmap, TRUE );
HeapFree( GetProcessHeap(), 0, clip_data );
}
else
{
BOOL restore_region = add_extra_clipping_region( physdev, clip );
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
/* optimization for single-op ROPs */
if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST))
{
......@@ -1315,7 +1298,6 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
wine_tsx11_unlock();
}
X11DRV_UnlockDIBSection( physdev, !ret );
if (restore_region) restore_clipping_region( physdev );
}
image->data = NULL;
......@@ -1408,15 +1390,12 @@ DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
GetObjectW( hbitmap, sizeof(bm), &bm );
width = min( width, bm.bmWidth - x );
height = min( height, bm.bmHeight - y );
X11DRV_DIB_Lock( bitmap, DIB_Status_GdiMod );
wine_tsx11_lock();
image = XGetImage( gdi_display, bitmap->pixmap, x, y, width, height, AllPlanes, ZPixmap );
wine_tsx11_unlock();
X11DRV_DIB_Unlock( bitmap, TRUE );
}
else if (GetObjectType( dev->hdc ) == OBJ_MEMDC)
{
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
width = min( width, physdev->dc_rect.right - physdev->dc_rect.left - x );
height = min( height, physdev->dc_rect.bottom - physdev->dc_rect.top - y );
wine_tsx11_lock();
......@@ -1424,7 +1403,6 @@ DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
physdev->dc_rect.left + x, physdev->dc_rect.top + y,
width, height, AllPlanes, ZPixmap );
wine_tsx11_unlock();
X11DRV_UnlockDIBSection( physdev, FALSE );
}
else
{
......
......@@ -1074,10 +1074,6 @@ COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
LPtoDP( dev->hdc, &pt, 1 );
pixel = X11DRV_PALETTE_ToPhysical( physDev, color );
/* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod);
/* inefficient but simple... */
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, pixel );
XSetFunction( gdi_display, physDev->gc, GXcopy );
......@@ -1085,9 +1081,6 @@ COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
physDev->dc_rect.left + pt.x, physDev->dc_rect.top + pt.y );
wine_tsx11_unlock();
/* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(physDev, TRUE);
return X11DRV_PALETTE_ToLogical(physDev, pixel);
}
......@@ -1113,11 +1106,9 @@ BOOL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
rect[i].y += physDev->dc_rect.top;
}
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod);
wine_tsx11_lock();
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
wine_tsx11_unlock();
X11DRV_UnlockDIBSection(physDev, TRUE);
HeapFree( GetProcessHeap(), 0, data );
}
return TRUE;
......@@ -1488,7 +1479,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock();
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
for (i = 0; i < ngrad; i++, rect++)
{
int pos, x, dx;
......@@ -1521,7 +1511,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
wine_tsx11_unlock();
}
}
X11DRV_UnlockDIBSection( physdev, TRUE );
return TRUE;
case GRADIENT_FILL_RECT_V:
......@@ -1535,7 +1524,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock();
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
for (i = 0; i < ngrad; i++, rect++)
{
int pos, y, dy;
......@@ -1568,7 +1556,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
wine_tsx11_unlock();
}
}
X11DRV_UnlockDIBSection( physdev, TRUE );
return TRUE;
}
......
......@@ -2192,9 +2192,6 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
/* if not stretching, we only need to handle format conversion */
if (!stretch && physdev_dst->format == physdev_src->format) goto x11drv_fallback;
X11DRV_LockDIBSection( physdev_dst->x11dev, DIB_Status_GdiMod );
if (physdev_dst != physdev_src) X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_GdiMod );
if (rop != SRCCOPY)
{
GC tmpGC;
......@@ -2225,8 +2222,6 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
}
else xrender_stretch_blit( physdev_src, physdev_dst, 0, src, dst );
if (physdev_dst != physdev_src) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE );
X11DRV_UnlockDIBSection( physdev_dst->x11dev, TRUE );
return TRUE;
x11drv_fallback:
......@@ -2292,18 +2287,12 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMA
HRGN rgn = CreateRectRgnIndirect( &dst->visrect );
if (clip) CombineRgn( rgn, rgn, clip, RGN_AND );
X11DRV_DIB_Lock( bitmap, DIB_Status_GdiMod );
xrender_put_image( src_pixmap, src_pict, mask_pict, rgn,
pict_formats[dst_format], NULL, bitmap->pixmap, src, dst, use_repeat );
X11DRV_DIB_Unlock( bitmap, TRUE );
DeleteObject( rgn );
}
else
{
X11DRV_LockDIBSection( physdev->x11dev, DIB_Status_GdiMod );
if (rop != SRCCOPY)
{
BOOL restore_region = add_extra_clipping_region( physdev->x11dev, clip );
......@@ -2335,8 +2324,6 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMA
}
else xrender_put_image( src_pixmap, src_pict, mask_pict, clip,
physdev->pict_format, physdev, 0, src, dst, use_repeat );
X11DRV_UnlockDIBSection( physdev->x11dev, TRUE );
}
wine_tsx11_lock();
......@@ -2401,8 +2388,6 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
{
double xscale, yscale;
X11DRV_LockDIBSection( physdev->x11dev, DIB_Status_GdiMod );
if (!use_repeat)
{
xscale = src->width / (double)dst->width;
......@@ -2426,8 +2411,6 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs );
X11DRV_UnlockDIBSection( physdev->x11dev, TRUE );
}
return ret;
......@@ -2464,9 +2447,6 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
return FALSE;
}
X11DRV_LockDIBSection( physdev_dst->x11dev, DIB_Status_GdiMod );
if (physdev_dst != physdev_src) X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_GdiMod );
dst_pict = get_xrender_picture( physdev_dst, 0, &dst->visrect );
use_repeat = use_source_repeat( physdev_src );
......@@ -2535,8 +2515,6 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs );
if (physdev_src != physdev_dst) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE );
X11DRV_UnlockDIBSection( physdev_dst->x11dev, TRUE );
return TRUE;
}
......@@ -2566,7 +2544,6 @@ static BOOL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG n
{
case GRADIENT_FILL_RECT_H:
case GRADIENT_FILL_RECT_V:
X11DRV_LockDIBSection( physdev->x11dev, DIB_Status_GdiMod );
for (i = 0; i < ngrad; i++, rect++)
{
const TRIVERTEX *v1 = vert_array + rect->UpperLeft;
......@@ -2631,7 +2608,6 @@ static BOOL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG n
pXRenderFreePicture( gdi_display, src_pict );
wine_tsx11_unlock();
}
X11DRV_UnlockDIBSection( physdev->x11dev, TRUE );
return TRUE;
}
......
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