From 48888b918b9c09a14056f925c2af60ea16dcc88d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 12 Dec 2009 20:02:34 +0100 Subject: vmware/xorg: Fix failure paths and add some debug printing --- src/gallium/state_trackers/xorg/xorg_driver.c | 66 +++++++++++++++++++-------- 1 file changed, 46 insertions(+), 20 deletions(-) (limited to 'src/gallium/state_trackers/xorg') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 5391595891..8a24aa10a3 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -480,7 +480,7 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, if (num_cliprects) { drmModeClip *clip = alloca(num_cliprects * sizeof(drmModeClip)); BoxPtr rect = REGION_RECTS(dirty); - int i; + int i, ret; /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { @@ -491,7 +491,11 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, } /* TODO query connector property to see if this is needed */ - drmModeDirtyFB(ms->fd, ms->fb_id, clip, num_cliprects); + ret = drmModeDirtyFB(ms->fd, ms->fb_id, clip, num_cliprects); + if (ret) { + debug_printf("%s: failed to send dirty (%i, %s)\n", + __func__, ret, strerror(-ret)); + } DamageEmpty(ms->damage); } @@ -837,6 +841,7 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) modesettingPtr ms = modesettingPTR(pScrn); unsigned handle, stride; struct pipe_texture *tex; + int ret; ms->noEvict = TRUE; @@ -850,16 +855,21 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) tex, &stride, &handle)) - return FALSE; + goto err_destroy; - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); + ret = drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + if (ret) { + debug_printf("%s: failed to create framebuffer (%i, %s)", + __func__, ret, strerror(-ret)); + goto err_destroy; + } pScrn->frameX0 = 0; pScrn->frameY0 = 0; @@ -869,6 +879,10 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) pipe_texture_reference(&tex, NULL); return TRUE; + +err_destroy: + pipe_texture_reference(&tex, NULL); + return FALSE; } static Bool @@ -898,6 +912,8 @@ static Bool drv_destroy_front_buffer_kms(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; + PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); if (!ms->root_bo) return TRUE; @@ -914,6 +930,7 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn) unsigned handle, stride; struct kms_bo *bo; unsigned attr[8]; + int ret; attr[0] = KMS_BO_TYPE; attr[1] = KMS_BO_TYPE_SCANOUT; @@ -932,14 +949,19 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn) if (kms_bo_get_prop(bo, KMS_HANDLE, &handle)) goto err_destroy; - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); + ret = drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + if (ret) { + debug_printf("%s: failed to create framebuffer (%i, %s)", + __func__, ret, strerror(-ret)); + goto err_destroy; + } pScrn->frameX0 = 0; pScrn->frameY0 = 0; @@ -966,7 +988,7 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn) return FALSE; if (kms_bo_map(ms->root_bo, &ptr)) - return FALSE; + goto err_destroy; pScreen->ModifyPixmapHeader(rootPixmap, pScreen->width, @@ -976,6 +998,10 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn) stride, ptr); return TRUE; + +err_destroy: + kms_bo_destroy(&ms->root_bo); + return FALSE; } #endif /* HAVE_LIBKMS */ -- cgit v1.2.3 From f44f6473e60fdcde24b0d8b166fce8a2ffe366b7 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 8 Dec 2009 12:48:56 +0100 Subject: st/xorg Fail early if we don't intend to accelerate. Saves a number of unneeded computations and log noise. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/xorg/xorg_exa.c | 31 +++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/gallium/state_trackers/xorg') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 32485add94..17a032ee87 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -343,6 +343,9 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) #if DEBUG_PRINT debug_printf("ExaPrepareSolid(0x%x)\n", fg); #endif + if (!exa->accel) + return FALSE; + if (!exa->pipe) XORG_FALLBACK("accle not enabled"); @@ -361,7 +364,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) XORG_FALLBACK("format %s", pf_name(priv->tex->format)); } - return exa->accel && xorg_solid_bind_state(exa, priv, fg); + return xorg_solid_bind_state(exa, priv, fg); } static void @@ -417,6 +420,10 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, #if DEBUG_PRINT debug_printf("ExaPrepareCopy\n"); #endif + + if (!exa->accel) + return FALSE; + if (!exa->pipe) XORG_FALLBACK("accle not enabled"); @@ -490,7 +497,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, } - return exa->accel; + return TRUE; } static void @@ -598,15 +605,19 @@ ExaCheckComposite(int op, ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; - boolean accelerated = xorg_composite_accelerated(op, - pSrcPicture, - pMaskPicture, - pDstPicture); + #if DEBUG_PRINT debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); #endif - return exa->accel && accelerated; + + if (!exa->accel) + return FALSE; + + return xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture); } @@ -620,6 +631,9 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv; + if (!exa->accel) + return FALSE; + #if DEBUG_PRINT debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n", op, pSrcPicture, pMaskPicture, pDstPicture); @@ -678,8 +692,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, render_format_name(pMaskPicture->format)); } - return exa->accel && - xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, + return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, -- cgit v1.2.3