summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-03-06 10:07:59 -0700
committerBrian <[email protected]>2007-03-06 10:07:59 -0700
commita510bc3ee1a696da120c09ee4ec33dc033f671ac (patch)
treec4c594f5f39f060f507dc13fc5e9383956bce909 /src/mesa/drivers/dri
parent593802c0b0f451299ac2598c6de61e884fb44830 (diff)
Fix/improve framebuffer object reference counting.
Use _mesa_reference_framebuffer() and _mesa_unreference_framebuffer() functions to be sure reference counting is done correctly. Additional assertions are done too. Note _mesa_dereference_framebuffer() renamed to "unreference" as that's more accurate.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/fb/fb_dri.c6
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c3
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c2
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c2
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c2
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c2
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c2
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.c2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c2
18 files changed, 18 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c
index 08b52b4d8f7..a6d7590eff7 100644
--- a/src/mesa/drivers/dri/fb/fb_dri.c
+++ b/src/mesa/drivers/dri/fb/fb_dri.c
@@ -480,11 +480,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- struct gl_framebuffer *mesa_framebuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate;
-
- _mesa_free(mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data);
- _mesa_destroy_framebuffer(mesa_framebuffer);
- driDrawPriv->driverPrivate = NULL;
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index 215aaf8ffba..4c5323d230e 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -392,7 +392,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
static void
ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c
index e8922b15036..f41682cea71 100644
--- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c
+++ b/src/mesa/drivers/dri/gamma/gamma_xmesa.c
@@ -97,7 +97,7 @@ gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
static void
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index ebe2615fe87..f64c10a9ae0 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -398,8 +398,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
- _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 942e1e9c226..67e176a1c6f 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -449,8 +449,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
- _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c
index bc538902b4c..ac83254593b 100644
--- a/src/mesa/drivers/dri/i915tex/intel_screen.c
+++ b/src/mesa/drivers/dri/i915tex/intel_screen.c
@@ -609,8 +609,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
static void
intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
{
- /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
- _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 06e5d0c5bd7..5dac50df32c 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -457,8 +457,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
- _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 1014b8acd52..4e9e216e7db 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -435,7 +435,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index f024f73eb6a..67a6f8bdf09 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -831,7 +831,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
static void
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 24e77750f93..e00080fce1e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -202,7 +202,7 @@ nouveauCreateBuffer(__DRIscreenPrivate *driScrnPriv,
static void
nouveauDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
static int
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index 4f1b20aadd7..880dee85c25 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -357,7 +357,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index fc5aa114621..abb14faaa13 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -901,7 +901,7 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)
diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
index c451f7452bf..c66fd6dac31 100644
--- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c
+++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
@@ -131,7 +131,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
static void
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index ad79b9235c1..f859217069c 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -710,7 +710,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
savageDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
#if 0
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index 8f52cfe098e..89d734ba786 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -233,7 +233,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
static void sisCopyBuffer( __DRIdrawablePrivate *dPriv )
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 646f5126eb0..1f9ff4e30ca 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -233,7 +233,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c
index dbbd1ac0c69..8dc7f0dc781 100644
--- a/src/mesa/drivers/dri/trident/trident_context.c
+++ b/src/mesa/drivers/dri/trident/trident_context.c
@@ -279,7 +279,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
static void
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 28e1f9451e6..90f76be44d4 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -320,7 +320,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
static void
viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}