mirror of
https://github.com/X11Libre/xf86-video-ati.git
synced 2026-03-26 02:18:52 +00:00
Propagate failure from radeon_set_pixmap_bo
(Ported from amdgpu commits c315c00e44afc91a7c8e2eab5af836d9643ebb88 and 0d42082108c264568e2aadd15ace70e72388bc65)
This commit is contained in:
committed by
Michel Dänzer
parent
53be26b00e
commit
8523a733b6
@@ -126,12 +126,11 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
|
||||
|
||||
if (!(*pScreen->ModifyPixmapHeader)(pixmap, width, height,
|
||||
depth, bpp, pitch, NULL)) {
|
||||
return NULL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!info->use_glamor)
|
||||
exaMoveInPixmap(pixmap);
|
||||
radeon_set_pixmap_bo(pixmap, bo);
|
||||
if (info->ChipFamily >= CHIP_FAMILY_R600) {
|
||||
surface = radeon_get_pixmap_surface(pixmap);
|
||||
if (surface && psurf)
|
||||
@@ -163,22 +162,25 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
|
||||
surface->flags |= RADEON_SURF_SET(RADEON_SURF_MODE_2D, MODE);
|
||||
}
|
||||
if (radeon_surface_best(info->surf_man, surface)) {
|
||||
return NULL;
|
||||
goto fail;
|
||||
}
|
||||
if (radeon_surface_init(info->surf_man, surface)) {
|
||||
return NULL;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (info->use_glamor &&
|
||||
!radeon_glamor_create_textured_pixmap(pixmap,
|
||||
radeon_get_pixmap_private(pixmap))) {
|
||||
pScreen->DestroyPixmap(pixmap);
|
||||
return NULL;
|
||||
}
|
||||
if (!radeon_set_pixmap_bo(pixmap, bo))
|
||||
goto fail;
|
||||
|
||||
return pixmap;
|
||||
if (!info->use_glamor ||
|
||||
radeon_glamor_create_textured_pixmap(pixmap,
|
||||
radeon_get_pixmap_private(pixmap)))
|
||||
return pixmap;
|
||||
|
||||
fail:
|
||||
pScreen->DestroyPixmap(pixmap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void drmmode_destroy_bo_pixmap(PixmapPtr pixmap)
|
||||
@@ -2121,7 +2123,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
|
||||
goto fail;
|
||||
|
||||
if (!info->r600_shadow_fb) {
|
||||
radeon_set_pixmap_bo(ppix, info->front_bo);
|
||||
psurface = radeon_get_pixmap_surface(ppix);
|
||||
*psurface = info->front_surface;
|
||||
screen->ModifyPixmapHeader(ppix,
|
||||
@@ -2145,6 +2146,11 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
|
||||
if (info->use_glamor)
|
||||
radeon_glamor_create_screen_resources(scrn->pScreen);
|
||||
|
||||
if (!info->r600_shadow_fb) {
|
||||
if (!radeon_set_pixmap_bo(ppix, info->front_bo))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Clear new buffer */
|
||||
gc = GetScratchGC(ppix->drawable.depth, scrn->pScreen);
|
||||
force = info->accel_state->force;
|
||||
|
||||
14
src/radeon.h
14
src/radeon.h
@@ -678,7 +678,7 @@ static inline struct radeon_surface *radeon_get_pixmap_surface(PixmapPtr pPix)
|
||||
|
||||
uint32_t radeon_get_pixmap_tiling(PixmapPtr pPix);
|
||||
|
||||
static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)
|
||||
static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)
|
||||
{
|
||||
#ifdef USE_GLAMOR
|
||||
RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(pPix->drawable.pScreen));
|
||||
@@ -688,11 +688,11 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)
|
||||
|
||||
priv = radeon_get_pixmap_private(pPix);
|
||||
if (priv == NULL && bo == NULL)
|
||||
return;
|
||||
return TRUE;
|
||||
|
||||
if (priv) {
|
||||
if (priv->bo == bo)
|
||||
return;
|
||||
return TRUE;
|
||||
|
||||
if (priv->bo)
|
||||
radeon_bo_unref(priv->bo);
|
||||
@@ -709,7 +709,7 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)
|
||||
if (!priv) {
|
||||
priv = calloc(1, sizeof (struct radeon_pixmap));
|
||||
if (!priv)
|
||||
goto out;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
radeon_bo_ref(bo);
|
||||
@@ -717,8 +717,9 @@ static inline void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo)
|
||||
|
||||
radeon_bo_get_tiling(bo, &priv->tiling_flags, &pitch);
|
||||
}
|
||||
out:
|
||||
|
||||
radeon_set_pixmap_private(pPix, priv);
|
||||
return TRUE;
|
||||
} else
|
||||
#endif /* USE_GLAMOR */
|
||||
{
|
||||
@@ -735,7 +736,10 @@ out:
|
||||
driver_priv->bo = bo;
|
||||
|
||||
radeon_bo_get_tiling(bo, &driver_priv->tiling_flags, &pitch);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -312,14 +312,17 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle,
|
||||
struct radeon_bo *bo;
|
||||
int ihandle = (int)(long)fd_handle;
|
||||
uint32_t size = ppix->devKind * ppix->drawable.height;
|
||||
Bool ret = FALSE;
|
||||
|
||||
bo = radeon_gem_bo_open_prime(info->bufmgr, ihandle, size);
|
||||
if (!bo)
|
||||
return FALSE;
|
||||
goto error;
|
||||
|
||||
memset(surface, 0, sizeof(struct radeon_surface));
|
||||
|
||||
radeon_set_pixmap_bo(ppix, bo);
|
||||
ret = radeon_set_pixmap_bo(ppix, bo);
|
||||
if (!ret)
|
||||
goto error;
|
||||
|
||||
if (info->ChipFamily >= CHIP_FAMILY_R600 && info->surf_man) {
|
||||
uint32_t tiling_flags;
|
||||
@@ -360,10 +363,12 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle,
|
||||
surface->stencil_tile_split = (tiling_flags >> RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT) & RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK;
|
||||
surface->mtilea = (tiling_flags >> RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT) & RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK;
|
||||
if (radeon_surface_best(info->surf_man, surface)) {
|
||||
return FALSE;
|
||||
ret = FALSE;
|
||||
goto error;
|
||||
}
|
||||
if (radeon_surface_init(info->surf_man, surface)) {
|
||||
return FALSE;
|
||||
ret = FALSE;
|
||||
goto error;
|
||||
}
|
||||
/* we have to post hack the surface to reflect the actual size
|
||||
of the shared pixmap */
|
||||
@@ -371,11 +376,12 @@ Bool radeon_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle,
|
||||
surface->level[0].nblk_x = ppix->devKind / surface->bpe;
|
||||
}
|
||||
|
||||
error:
|
||||
close(ihandle);
|
||||
/* we have a reference from the alloc and one from set pixmap bo,
|
||||
drop one */
|
||||
radeon_bo_unref(bo);
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* RADEON_PIXMAP_SHARING */
|
||||
|
||||
@@ -347,7 +347,8 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
|
||||
if (info->dri2.enabled || info->use_glamor) {
|
||||
if (info->front_bo) {
|
||||
PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen);
|
||||
radeon_set_pixmap_bo(pPix, info->front_bo);
|
||||
if (!radeon_set_pixmap_bo(pPix, info->front_bo))
|
||||
return FALSE;
|
||||
surface = radeon_get_pixmap_surface(pPix);
|
||||
if (surface) {
|
||||
*surface = info->front_surface;
|
||||
|
||||
Reference in New Issue
Block a user