diff options
author | Eric Anholt <[email protected]> | 2014-04-25 13:44:41 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-05-01 15:12:27 -0700 |
commit | 3278f96a5231daef2a3f1a57b8f657ae6a96a6ff (patch) | |
tree | 1899eeab4efdd8e37069ed8b1271fd33202a0e2c /src | |
parent | 835f90692fe3de9d5100d9877c033039f5bdb4a1 (diff) |
i965: Drop region usage from DRI2 winsys-allocated buffers.
v2: Fix bad pointer on unreference (caught by Chad)
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index f3daad0675c..f7394ae2950 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1376,7 +1376,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) struct intel_buffer { __DRIbuffer base; - struct intel_region *region; + drm_intel_bo *bo; }; static __DRIbuffer * @@ -1395,23 +1395,27 @@ intelAllocateBuffer(__DRIscreen *screen, return NULL; /* The front and back buffers are color buffers, which are X tiled. */ - intelBuffer->region = intel_region_alloc(intelScreen, - I915_TILING_X, - format / 8, - width, - height, - true); - - if (intelBuffer->region == NULL) { + uint32_t tiling = I915_TILING_X; + unsigned long pitch; + int cpp = format / 8; + intelBuffer->bo = drm_intel_bo_alloc_tiled(intelScreen->bufmgr, + "intelAllocateBuffer", + width, + height, + cpp, + &tiling, &pitch, + BO_ALLOC_FOR_RENDER); + + if (intelBuffer->bo == NULL) { free(intelBuffer); return NULL; } - drm_intel_bo_flink(intelBuffer->region->bo, &intelBuffer->base.name); + drm_intel_bo_flink(intelBuffer->bo, &intelBuffer->base.name); intelBuffer->base.attachment = attachment; - intelBuffer->base.cpp = intelBuffer->region->cpp; - intelBuffer->base.pitch = intelBuffer->region->pitch; + intelBuffer->base.cpp = cpp; + intelBuffer->base.pitch = pitch; return &intelBuffer->base; } @@ -1421,7 +1425,7 @@ intelReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer) { struct intel_buffer *intelBuffer = (struct intel_buffer *) buffer; - intel_region_release(&intelBuffer->region); + drm_intel_bo_unreference(intelBuffer->bo); free(intelBuffer); } |