~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h,v 1.3 2002/10/30 12:51:55 alanh Exp $ */
 
2
/**************************************************************************
 
3
 
 
4
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
 
5
                     VA Linux Systems Inc., Fremont, California.
 
6
 
 
7
All Rights Reserved.
 
8
 
 
9
Permission is hereby granted, free of charge, to any person obtaining a
 
10
copy of this software and associated documentation files (the "Software"),
 
11
to deal in the Software without restriction, including without limitation
 
12
on the rights to use, copy, modify, merge, publish, distribute, sub
 
13
license, and/or sell copies of the Software, and to permit persons to whom
 
14
the Software is furnished to do so, subject to the following conditions:
 
15
 
 
16
The above copyright notice and this permission notice (including the next
 
17
paragraph) shall be included in all copies or substantial portions of the
 
18
Software.
 
19
 
 
20
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
21
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
22
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 
23
ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
 
24
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 
25
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 
26
USE OR OTHER DEALINGS IN THE SOFTWARE.
 
27
 
 
28
**************************************************************************/
 
29
 
 
30
/*
 
31
 * Authors:
 
32
 *   Kevin E. Martin <martin@valinux.com>
 
33
 *   Gareth Hughes <gareth@valinux.com>
 
34
 *
 
35
 */
 
36
 
 
37
#ifndef __RADEON_LOCK_H__
 
38
#define __RADEON_LOCK_H__
 
39
 
 
40
#ifdef GLX_DIRECT_RENDERING
 
41
 
 
42
extern void radeonGetLock( radeonContextPtr rmesa, GLuint flags );
 
43
 
 
44
/* Turn DEBUG_LOCKING on to find locking conflicts.
 
45
 */
 
46
#define DEBUG_LOCKING   0
 
47
 
 
48
#if DEBUG_LOCKING
 
49
extern char *prevLockFile;
 
50
extern int prevLockLine;
 
51
 
 
52
#define DEBUG_LOCK()                                                    \
 
53
   do {                                                                 \
 
54
      prevLockFile = (__FILE__);                                        \
 
55
      prevLockLine = (__LINE__);                                        \
 
56
   } while (0)
 
57
 
 
58
#define DEBUG_RESET()                                                   \
 
59
   do {                                                                 \
 
60
      prevLockFile = 0;                                                 \
 
61
      prevLockLine = 0;                                                 \
 
62
   } while (0)
 
63
 
 
64
#define DEBUG_CHECK_LOCK()                                              \
 
65
   do {                                                                 \
 
66
      if ( prevLockFile ) {                                             \
 
67
         fprintf( stderr,                                               \
 
68
                  "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n",    \
 
69
                  prevLockFile, prevLockLine, __FILE__, __LINE__ );     \
 
70
         exit( 1 );                                                     \
 
71
      }                                                                 \
 
72
   } while (0)
 
73
 
 
74
#else
 
75
 
 
76
#define DEBUG_LOCK()
 
77
#define DEBUG_RESET()
 
78
#define DEBUG_CHECK_LOCK()
 
79
 
 
80
#endif
 
81
 
 
82
/*
 
83
 * !!! We may want to separate locks from locks with validation.  This
 
84
 * could be used to improve performance for those things commands that
 
85
 * do not do any drawing !!!
 
86
 */
 
87
 
 
88
 
 
89
/* Lock the hardware and validate our state.
 
90
 */
 
91
#define LOCK_HARDWARE( rmesa )                                  \
 
92
   do {                                                         \
 
93
      char __ret = 0;                                           \
 
94
      DEBUG_CHECK_LOCK();                                       \
 
95
      DRM_CAS( rmesa->dri.hwLock, rmesa->dri.hwContext,         \
 
96
               (DRM_LOCK_HELD | rmesa->dri.hwContext), __ret ); \
 
97
      if ( __ret )                                              \
 
98
         radeonGetLock( rmesa, 0 );                             \
 
99
      DEBUG_LOCK();                                             \
 
100
   } while (0)
 
101
 
 
102
/* Unlock the hardware.
 
103
 */
 
104
#define UNLOCK_HARDWARE( rmesa )                                        \
 
105
   do {                                                                 \
 
106
      DRM_UNLOCK( rmesa->dri.fd,                                        \
 
107
                  rmesa->dri.hwLock,                                    \
 
108
                  rmesa->dri.hwContext );                               \
 
109
      DEBUG_RESET();                                                    \
 
110
   } while (0)
 
111
 
 
112
#endif
 
113
#endif /* __RADEON_LOCK_H__ */