[PATCH] Fail more gracefully when drm surface manager can't be initialized

Jerome Glisse jglisse at redhat.com
Thu May 10 08:56:16 PDT 2012


----- Original Message -----
> On Thu, 10 May 2012 17:08:55 +0200, Michel Dänzer
> <michel at daenzer.net> wrote :
> 
> > On Don, 2012-05-10 at 16:56 +0200, Anisse Astier wrote:
> > > Should make bugs like
> > > https://bugs.freedesktop.org/show_bug.cgi?id=48138
> > > easier to diagnose.
> > 
> > FWIW, commit 1e656cd5973bbcf85b63406638ede0bccd65e28f should help
> > for
> > that already.
> 
> Yes, this patch was inspired by this commit.
> I found the source of this bug: missing PCI ids in libdrm's
> radeon/r600_pci_ids.h, therefore failed initialization of the drm
> surface
> manager. Patch to follow.
> 
> > 
> > 
> > > Signed-off-by: Anisse Astier <anisse at astier.eu>
> > > ---
> > >  src/radeon_kms.c |    5 +++++
> > >  1 files changed, 5 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> > > index edc8fe3..d2089d1 100644
> > > --- a/src/radeon_kms.c
> > > +++ b/src/radeon_kms.c
> > > @@ -947,6 +947,11 @@ Bool RADEONScreenInit_KMS(int scrnIndex,
> > > ScreenPtr pScreen,
> > >      front_ptr = info->FB;
> > >  
> > >      info->surf_man =
> > >      radeon_surface_manager_new(info->dri->drmFD);
> > > +    if(!info->surf_man) {
> > > +        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> > > +		   "failed to initialise surface manager");
> > > +        return FALSE;
> > > +    }
> > >      if (!info->bufmgr)
> > >          info->bufmgr =
> > >          radeon_bo_manager_gem_ctor(info->dri->drmFD);
> > >      if (!info->bufmgr) {
> > 
> > This would probably break pre-R600 cards, which aren't supported by
> > the
> > surface manager.
> Indeed, I didn't know about that.
> 
> How about the version below ?
> 
> 
> From: Anisse Astier <anisse at astier.eu>
> Subject: [PATCH] Fail more gracefully when drm surface manager can't
> be
>  initialized
> 
> Should make bugs like
> https://bugs.freedesktop.org/show_bug.cgi?id=48138
> easier to diagnose.
> 
> Signed-off-by: Anisse Astier <anisse at astier.eu>
> ---
>  src/radeon_kms.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index edc8fe3..c47897e 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -1256,6 +1256,11 @@ static Bool radeon_setup_kernel_mem(ScreenPtr
> pScreen)
>      screen_size = RADEON_ALIGN(pScrn->virtualY,
>      drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
>      base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
>  	if (info->ChipFamily >= CHIP_FAMILY_R600) {
> +		if(!info->surf_man) {
> +			xf86DrvMsg(pScreen->myNum, X_ERROR,
> +				   "failed to initialise surface manager");
> +			return FALSE;
> +		}
>  		memset(&surface, 0, sizeof(struct radeon_surface));
>  		surface.npix_x = pScrn->displayWidth;
>  		surface.npix_y = pScrn->virtualY;
> --
> 1.7.9
> 

Yeah looks good.

Cheers,
Jerome


More information about the xorg-driver-ati mailing list