diff options
Diffstat (limited to 'src/i965_render.c')
-rw-r--r-- | src/i965_render.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index bd693cab..a4334c65 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -1441,6 +1441,7 @@ gen4_render_state_init(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); struct gen4_render_state *render_state; + int ret; if (pI830->gen4_render_state == NULL) pI830->gen4_render_state = calloc(sizeof(*render_state), 1); @@ -1449,12 +1450,19 @@ gen4_render_state_init(ScrnInfoPtr pScrn) render_state->card_state_offset = pI830->gen4_render_state_mem->offset; - if (dri_bo_map(pI830->gen4_render_state_mem->bo, 1)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to map gen4 state\n"); - return; + if (pI830->gen4_render_state_mem->bo) { + ret = dri_bo_map(pI830->gen4_render_state_mem->bo, 1); + if (ret) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to map gen4 state\n"); + return; + } + render_state->card_state = pI830->gen4_render_state_mem->bo->virtual; + } else { + render_state->card_state = (gen4_state_t *) + (pI830->FbBase + render_state->card_state_offset); } - render_state->card_state = pI830->gen4_render_state_mem->bo->virtual; gen4_state_init(render_state); } @@ -1466,8 +1474,10 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - dri_bo_unmap(pI830->gen4_render_state_mem->bo); - dri_bo_unreference(pI830->gen4_render_state_mem->bo); + if (pI830->gen4_render_state_mem->bo) { + dri_bo_unmap(pI830->gen4_render_state_mem->bo); + dri_bo_unreference(pI830->gen4_render_state_mem->bo); + } pI830->gen4_render_state->card_state = NULL; } |