~ubuntu-branches/ubuntu/quantal/mesa-glw/quantal

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/nouveau/nouveau_lock.h

  • Committer: Bazaar Package Importer
  • Author(s): Morten Kjeldgaard
  • Date: 2008-05-06 16:19:15 UTC
  • Revision ID: james.westby@ubuntu.com-20080506161915-uynz7nftmfixu6bq
Tags: upstream-7.0.3
ImportĀ upstreamĀ versionĀ 7.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
 
 
3
Copyright 2006 Stephane Marchesin
 
4
All Rights Reserved.
 
5
 
 
6
Permission is hereby granted, free of charge, to any person obtaining a
 
7
copy of this software and associated documentation files (the "Software"),
 
8
to deal in the Software without restriction, including without limitation
 
9
on the rights to use, copy, modify, merge, publish, distribute, sub
 
10
license, and/or sell copies of the Software, and to permit persons to whom
 
11
the Software is furnished to do so, subject to the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice (including the next
 
14
paragraph) shall be included in all copies or substantial portions of the
 
15
Software.
 
16
 
 
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
19
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 
20
ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
 
21
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 
22
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 
23
USE OR OTHER DEALINGS IN THE SOFTWARE.
 
24
 
 
25
**************************************************************************/
 
26
 
 
27
 
 
28
#ifndef __NOUVEAU_LOCK_H__
 
29
#define __NOUVEAU_LOCK_H__
 
30
 
 
31
#include "nouveau_context.h"
 
32
 
 
33
extern void nouveauGetLock( nouveauContextPtr nmesa, GLuint flags );
 
34
 
 
35
/*
 
36
 * !!! We may want to separate locks from locks with validation.  This
 
37
 * could be used to improve performance for those things commands that
 
38
 * do not do any drawing !!!
 
39
 */
 
40
 
 
41
/* Lock the hardware and validate our state.
 
42
 */
 
43
#define LOCK_HARDWARE( nmesa )                                          \
 
44
   do {                                                                 \
 
45
      char __ret = 0;                                                   \
 
46
      DEBUG_CHECK_LOCK();                                               \
 
47
      DRM_CAS( nmesa->driHwLock, nmesa->hHWContext,                     \
 
48
               (DRM_LOCK_HELD | nmesa->hHWContext), __ret );            \
 
49
      if ( __ret )                                                      \
 
50
         nouveauGetLock( nmesa, 0 );                                    \
 
51
      DEBUG_LOCK();                                                     \
 
52
   } while (0)
 
53
 
 
54
/* Unlock the hardware.
 
55
 */
 
56
#define UNLOCK_HARDWARE( nmesa )                                        \
 
57
   do {                                                                 \
 
58
      DRM_UNLOCK( nmesa->driFd,                                         \
 
59
                  nmesa->driHwLock,                                     \
 
60
                  nmesa->hHWContext );                                  \
 
61
      DEBUG_RESET();                                                    \
 
62
   } while (0)
 
63
 
 
64
#define DEBUG_LOCK()
 
65
#define DEBUG_RESET()
 
66
#define DEBUG_CHECK_LOCK()
 
67
 
 
68
 
 
69
#endif /* __NOUVEAU_LOCK_H__ */