~ubuntu-branches/ubuntu/lucid/mesa/lucid

« back to all changes in this revision

Viewing changes to src/mesa/main/shared.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen, Timo Aaltonen, Rolf Leggewie
  • Date: 2010-03-02 17:11:31 UTC
  • mfrom: (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100302171131-gf6gvuqrhzoq8c8e
Tags: 7.7-4ubuntu1
[Timo Aaltonen]
* libgl1-mesa-dri: Get rid of the old hook (65mesa-check-x86-64).
  (LP: #460809)

[Rolf Leggewie]
* debian/control: depend on dpkg package where u-a supports --force
  (LP: #525592)

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
   shared->BufferObjects = _mesa_NewHashTable();
94
94
#endif
95
95
 
96
 
   /* Allocate the default buffer object and set refcount so high that
97
 
    * it never gets deleted.
98
 
    * XXX with recent/improved refcounting this may not longer be needed.
99
 
    */
 
96
   /* Allocate the default buffer object */
100
97
   shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0);
101
 
   shared->NullBufferObj->RefCount = 1000 * 1000 * 1000;
102
98
 
103
99
   /* Create default texture objects */
104
100
   for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
202
198
      ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
203
199
      bufObj->Pointer = NULL;
204
200
   }
205
 
   ctx->Driver.DeleteBuffer(ctx, bufObj);
 
201
   _mesa_reference_buffer_object(ctx, &bufObj, NULL);
206
202
}
207
203
 
208
204
 
288
284
 *
289
285
 * \sa alloc_shared_state().
290
286
 */
291
 
void
292
 
_mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
 
287
static void
 
288
free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
293
289
{
294
290
   GLuint i;
295
291
 
335
331
#endif
336
332
 
337
333
#if FEATURE_ARB_vertex_buffer_object
338
 
   ctx->Driver.DeleteBuffer(ctx, shared->NullBufferObj);
 
334
   _mesa_reference_buffer_object(ctx, &shared->NullBufferObj, NULL);
339
335
#endif
340
336
 
341
337
#if FEATURE_ARB_sync
368
364
 
369
365
   _mesa_free(shared);
370
366
}
 
367
 
 
368
 
 
369
/**
 
370
 * Decrement shared state object reference count and potentially free it
 
371
 * and all children structures.
 
372
 *
 
373
 * \param ctx GL context.
 
374
 * \param shared shared state pointer.
 
375
 *
 
376
 * \sa free_shared_state().
 
377
 */
 
378
void
 
379
_mesa_release_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
 
380
{
 
381
   GLint RefCount;
 
382
 
 
383
   _glthread_LOCK_MUTEX(shared->Mutex);
 
384
   RefCount = --shared->RefCount;
 
385
   _glthread_UNLOCK_MUTEX(shared->Mutex);
 
386
 
 
387
   assert(RefCount >= 0);
 
388
 
 
389
   if (RefCount == 0) {
 
390
      /* free shared state */
 
391
      free_shared_state( ctx, shared );
 
392
   }
 
393
}