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

oldstable
Alexandre Julliard 2011-12-19 11:34:44 +01:00
parent c1297ac0d8
commit 4066587f19
3 changed files with 2 additions and 61 deletions

View File

@ -762,8 +762,6 @@ BOOL X11DRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
if (usePat && !X11DRV_SetupGCForBrush( physDev )) return TRUE; if (usePat && !X11DRV_SetupGCForBrush( physDev )) return TRUE;
X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod );
wine_tsx11_lock(); wine_tsx11_lock();
XSetFunction( gdi_display, physDev->gc, OP_ROP(*opcode) ); 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.right - dst->visrect.left,
dst->visrect.bottom - dst->visrect.top ); dst->visrect.bottom - dst->visrect.top );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_UnlockDIBSection( physDev, TRUE );
return TRUE; return TRUE;
} }
@ -832,10 +828,6 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
width = dst->visrect.right - dst->visrect.left; width = dst->visrect.right - dst->visrect.left;
height = dst->visrect.bottom - dst->visrect.top; 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]; opcode = BITBLT_Opcodes[(rop >> 16) & 0xff];
/* a few optimizations for single-op ROPs */ /* 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->dc_rect.top + dst->visrect.top );
physDevDst->exposures++; physDevDst->exposures++;
wine_tsx11_unlock(); wine_tsx11_unlock();
goto done; return TRUE;
} }
if (physDevSrc->depth == 1) 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->dc_rect.top + dst->visrect.top, 1 );
physDevDst->exposures++; physDevDst->exposures++;
wine_tsx11_unlock(); 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 ); XFreePixmap( gdi_display, src_pixmap );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock(); wine_tsx11_unlock();
done:
if (physDevDst != physDevSrc) X11DRV_UnlockDIBSection( physDevSrc, FALSE );
X11DRV_UnlockDIBSection( physDevDst, TRUE );
return TRUE; return TRUE;
} }
@ -1263,7 +1251,6 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
GC gc; GC gc;
if (clip) clip_data = X11DRV_GetRegionData( clip, 0 ); if (clip) clip_data = X11DRV_GetRegionData( clip, 0 );
X11DRV_DIB_Lock( bitmap, DIB_Status_GdiMod );
wine_tsx11_lock(); wine_tsx11_lock();
gc = XCreateGC( gdi_display, bitmap->pixmap, 0, NULL ); 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 ); dst->visrect.left, dst->visrect.top, width, height );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_DIB_Unlock( bitmap, TRUE );
HeapFree( GetProcessHeap(), 0, clip_data ); HeapFree( GetProcessHeap(), 0, clip_data );
} }
else else
{ {
BOOL restore_region = add_extra_clipping_region( physdev, clip ); BOOL restore_region = add_extra_clipping_region( physdev, clip );
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
/* optimization for single-op ROPs */ /* optimization for single-op ROPs */
if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST)) 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(); wine_tsx11_unlock();
} }
X11DRV_UnlockDIBSection( physdev, !ret );
if (restore_region) restore_clipping_region( physdev ); if (restore_region) restore_clipping_region( physdev );
} }
image->data = NULL; image->data = NULL;
@ -1408,15 +1390,12 @@ DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
GetObjectW( hbitmap, sizeof(bm), &bm ); GetObjectW( hbitmap, sizeof(bm), &bm );
width = min( width, bm.bmWidth - x ); width = min( width, bm.bmWidth - x );
height = min( height, bm.bmHeight - y ); height = min( height, bm.bmHeight - y );
X11DRV_DIB_Lock( bitmap, DIB_Status_GdiMod );
wine_tsx11_lock(); wine_tsx11_lock();
image = XGetImage( gdi_display, bitmap->pixmap, x, y, width, height, AllPlanes, ZPixmap ); image = XGetImage( gdi_display, bitmap->pixmap, x, y, width, height, AllPlanes, ZPixmap );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_DIB_Unlock( bitmap, TRUE );
} }
else if (GetObjectType( dev->hdc ) == OBJ_MEMDC) 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 ); width = min( width, physdev->dc_rect.right - physdev->dc_rect.left - x );
height = min( height, physdev->dc_rect.bottom - physdev->dc_rect.top - y ); height = min( height, physdev->dc_rect.bottom - physdev->dc_rect.top - y );
wine_tsx11_lock(); 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, physdev->dc_rect.left + x, physdev->dc_rect.top + y,
width, height, AllPlanes, ZPixmap ); width, height, AllPlanes, ZPixmap );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_UnlockDIBSection( physdev, FALSE );
} }
else else
{ {

View File

@ -1074,10 +1074,6 @@ COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
LPtoDP( dev->hdc, &pt, 1 ); LPtoDP( dev->hdc, &pt, 1 );
pixel = X11DRV_PALETTE_ToPhysical( physDev, color ); 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(); wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, pixel ); XSetForeground( gdi_display, physDev->gc, pixel );
XSetFunction( gdi_display, physDev->gc, GXcopy ); 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 ); physDev->dc_rect.left + pt.x, physDev->dc_rect.top + pt.y );
wine_tsx11_unlock(); wine_tsx11_unlock();
/* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(physDev, TRUE);
return X11DRV_PALETTE_ToLogical(physDev, pixel); return X11DRV_PALETTE_ToLogical(physDev, pixel);
} }
@ -1113,11 +1106,9 @@ BOOL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
rect[i].y += physDev->dc_rect.top; rect[i].y += physDev->dc_rect.top;
} }
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod);
wine_tsx11_lock(); wine_tsx11_lock();
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount ); XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_UnlockDIBSection(physDev, TRUE);
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
return TRUE; return TRUE;
@ -1488,7 +1479,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val ); GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
for (i = 0; i < ngrad; i++, rect++) for (i = 0; i < ngrad; i++, rect++)
{ {
int pos, x, dx; int pos, x, dx;
@ -1521,7 +1511,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
} }
X11DRV_UnlockDIBSection( physdev, TRUE );
return TRUE; return TRUE;
case GRADIENT_FILL_RECT_V: 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 ); GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock(); wine_tsx11_unlock();
X11DRV_LockDIBSection( physdev, DIB_Status_GdiMod );
for (i = 0; i < ngrad; i++, rect++) for (i = 0; i < ngrad; i++, rect++)
{ {
int pos, y, dy; int pos, y, dy;
@ -1568,7 +1556,6 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
} }
X11DRV_UnlockDIBSection( physdev, TRUE );
return TRUE; return TRUE;
} }

View File

@ -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 not stretching, we only need to handle format conversion */
if (!stretch && physdev_dst->format == physdev_src->format) goto x11drv_fallback; 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) if (rop != SRCCOPY)
{ {
GC tmpGC; 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 ); 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; return TRUE;
x11drv_fallback: x11drv_fallback:
@ -2292,18 +2287,12 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMA
HRGN rgn = CreateRectRgnIndirect( &dst->visrect ); HRGN rgn = CreateRectRgnIndirect( &dst->visrect );
if (clip) CombineRgn( rgn, rgn, clip, RGN_AND ); 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, xrender_put_image( src_pixmap, src_pict, mask_pict, rgn,
pict_formats[dst_format], NULL, bitmap->pixmap, src, dst, use_repeat ); pict_formats[dst_format], NULL, bitmap->pixmap, src, dst, use_repeat );
X11DRV_DIB_Unlock( bitmap, TRUE );
DeleteObject( rgn ); DeleteObject( rgn );
} }
else else
{ {
X11DRV_LockDIBSection( physdev->x11dev, DIB_Status_GdiMod );
if (rop != SRCCOPY) if (rop != SRCCOPY)
{ {
BOOL restore_region = add_extra_clipping_region( physdev->x11dev, clip ); 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, else xrender_put_image( src_pixmap, src_pict, mask_pict, clip,
physdev->pict_format, physdev, 0, src, dst, use_repeat ); physdev->pict_format, physdev, 0, src, dst, use_repeat );
X11DRV_UnlockDIBSection( physdev->x11dev, TRUE );
} }
wine_tsx11_lock(); wine_tsx11_lock();
@ -2401,8 +2388,6 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
{ {
double xscale, yscale; double xscale, yscale;
X11DRV_LockDIBSection( physdev->x11dev, DIB_Status_GdiMod );
if (!use_repeat) if (!use_repeat)
{ {
xscale = src->width / (double)dst->width; xscale = src->width / (double)dst->width;
@ -2426,8 +2411,6 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
wine_tsx11_unlock(); wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs ); LeaveCriticalSection( &xrender_cs );
X11DRV_UnlockDIBSection( physdev->x11dev, TRUE );
} }
return ret; return ret;
@ -2464,9 +2447,6 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
return FALSE; 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 ); dst_pict = get_xrender_picture( physdev_dst, 0, &dst->visrect );
use_repeat = use_source_repeat( physdev_src ); 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(); wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs ); LeaveCriticalSection( &xrender_cs );
if (physdev_src != physdev_dst) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE );
X11DRV_UnlockDIBSection( physdev_dst->x11dev, TRUE );
return 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_H:
case GRADIENT_FILL_RECT_V: case GRADIENT_FILL_RECT_V:
X11DRV_LockDIBSection( physdev->x11dev, DIB_Status_GdiMod );
for (i = 0; i < ngrad; i++, rect++) for (i = 0; i < ngrad; i++, rect++)
{ {
const TRIVERTEX *v1 = vert_array + rect->UpperLeft; 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 ); pXRenderFreePicture( gdi_display, src_pict );
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
X11DRV_UnlockDIBSection( physdev->x11dev, TRUE );
return TRUE; return TRUE;
} }