[Mesa-dev] [PATCH 15/18] i965: Drop region usage from DRI2 winsys-allocated buffers.
Kristian Høgsberg
krh at bitplanet.net
Wed Apr 30 21:46:04 PDT 2014
On Tue, Apr 29, 2014 at 4:34 PM, Eric Anholt <eric at anholt.net> wrote:
> ---
> src/mesa/drivers/dri/i965/intel_screen.c | 30 +++++++++++++++++-------------
> 1 file changed, 17 insertions(+), 13 deletions(-)
Oh, right, I forgot about the __DRIbuffer usage. This really show how
intel_region just added redundancy.
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index ab95a39..454f1cb 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -1371,7 +1371,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
>
> struct intel_buffer {
> __DRIbuffer base;
> - struct intel_region *region;
> + drm_intel_bo *bo;
> };
>
> static __DRIbuffer *
> @@ -1390,23 +1390,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;
> }
> @@ -1416,7 +1420,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);
> }
>
> --
> 1.9.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list