[Intel-gfx] [PATCH] UXA: Fallback to dri_bo_map() if pin failed

Eric Anholt eric at anholt.net
Wed Dec 31 07:06:45 CET 2008


On Wed, 2008-12-31 at 10:14 +0800, Zhenyu Wang wrote:
> This fixes VT switch issue with UXA after Eric's
> aae4008096399a0e84abc7c016b35092caf9db25 on 2D side.

Looks good to me.

(Now, we also need a version of this that does bo_map_gtt for KMS.
Because we don't have enough codepaths in our driver.)

> ---
>  src/i830_exa.c |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/src/i830_exa.c b/src/i830_exa.c
> index 636aa0a..aeffedd 100644
> --- a/src/i830_exa.c
> +++ b/src/i830_exa.c
> @@ -785,11 +785,15 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
>  	    i830->need_sync = FALSE;
>  	}
>  
> -	if (drm_intel_bo_pin(bo, 4096) != 0)
> -	    return FALSE;
> -
> -	drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
> -	pixmap->devPrivate.ptr = pI830->FbBase + bo->offset;
> +	if (drm_intel_bo_pin(bo, 4096) != 0) {
> +	    /* happen in vt switched */
> +	    if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
> +		return FALSE;
> +	    pixmap->devPrivate.ptr = bo->virtual;
> +	} else {
> +	    drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
> +	    pixmap->devPrivate.ptr = pI830->FbBase + bo->offset;
> +	}
>      }
>      return TRUE;
>  }
> @@ -804,7 +808,10 @@ i830_uxa_finish_access (PixmapPtr pixmap)
>  	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
>  	I830Ptr i830 = I830PTR(scrn);
>  
> -	drm_intel_bo_unpin(bo);
> +	if (bo->virtual)
> +	    dri_bo_unmap(bo);
> +	else
> +	    drm_intel_bo_unpin(bo);
>  
>  	pixmap->devPrivate.ptr = NULL;
>  	if (bo == i830->front_buffer->bo)
-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081230/76d3422c/attachment.sig>


More information about the Intel-gfx mailing list