Very basic driver for the "Intel Extreme Graphics 2" chips, only supports i865G for now.
Only mode switches do work, doesn't yet make sure the mode is valid, though. At this point, this driver only works on Haiku, the R5 app_server is crashing for some reason I need to investigate some day (maybe tomorrow :)). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16872 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
#ifndef LOCK_H
|
||||
#define LOCK_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
typedef struct lock {
|
||||
sem_id sem;
|
||||
vint32 count;
|
||||
} lock;
|
||||
|
||||
|
||||
static inline status_t
|
||||
init_lock(struct lock *lock, const char *name)
|
||||
{
|
||||
lock->sem = create_sem(0, name);
|
||||
lock->count = 0;
|
||||
|
||||
return lock->sem < B_OK ? lock->sem : B_OK;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
uninit_lock(struct lock *lock)
|
||||
{
|
||||
delete_sem(lock->sem);
|
||||
}
|
||||
|
||||
|
||||
static inline status_t
|
||||
acquire_lock(struct lock *lock)
|
||||
{
|
||||
if (atomic_add(&lock->count, 1) > 0)
|
||||
return acquire_sem(lock->sem);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
static inline status_t
|
||||
release_lock(struct lock *lock)
|
||||
{
|
||||
if (atomic_add(&lock->count, -1) > 1)
|
||||
return release_sem(lock->sem);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
#endif /* LOCK_H */
|
||||
Reference in New Issue
Block a user