summaryrefslogtreecommitdiff
path: root/src/i965_render.c
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2008-08-14 15:48:02 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-08-14 15:48:02 -0700
commitc1687f9ca9ce7b52043272e877e070c810e6599f (patch)
treeb6d61e36ef565991bf49bad692f0afd9eb6647bf /src/i965_render.c
parent380c80712f78b3673b64ea07746a8e25e15fba8e (diff)
Map/unmap render state only when bo is available
Otherwise just use the GTT address.
Diffstat (limited to 'src/i965_render.c')
-rw-r--r--src/i965_render.c22
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;
}