From 925b901ba313a3ddd7567eca088951be39414430 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 15 Feb 2010 15:15:05 -0500 Subject: dri2: Allocate cliprect as part of the __DRIdrawableRec --- src/mesa/drivers/dri/common/dri_util.c | 8 ++++---- src/mesa/drivers/dri/common/dri_util.h | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index f5e7923835f..befe1675a04 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -485,8 +485,8 @@ dri2CreateNewDrawable(__DRIscreen *screen, if (!pdraw) return NULL; - pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); - pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + pdraw->pClipRects = &pdraw->dri2.clipRect; + pdraw->pBackClipRects = &pdraw->dri2.clipRect; return pdraw; } @@ -507,11 +507,11 @@ static void dri_put_drawable(__DRIdrawable *pdp) psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); - if (pdp->pClipRects) { + if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; } - if (pdp->pBackClipRects) { + if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) { _mesa_free(pdp->pBackClipRects); pdp->pBackClipRects = NULL; } diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index e9d5a9d9864..8d02524f386 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -378,6 +378,10 @@ struct __DRIdrawableRec { unsigned int swap_interval; GLboolean validBuffers; + + struct { + drm_clip_rect_t clipRect; + } dri2; }; /** -- cgit v1.2.3