* Copyright 2007-2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Gerald Zajac
*/
#ifndef DRIVERINTERFACE_H
#define DRIVERINTERFACE_H
#include <Accelerant.h>
#include <GraphicsDefs.h>
#include <Drivers.h>
#include <edid.h>
#define ENABLE_DEBUG_TRACE
struct Benaphore {
sem_id sem;
int32 count;
status_t Init(const char* name)
{
count = 0;
sem = create_sem(0, name);
return sem < 0 ? sem : B_OK;
}
status_t Acquire()
{
if (atomic_add(&count, 1) > 0)
return acquire_sem(sem);
return B_OK;
}
status_t Release()
{
if (atomic_add(&count, -1) > 1)
return release_sem(sem);
return B_OK;
}
void Delete() { delete_sem(sem); }
};
enum {
INTEL_GET_SHARED_DATA = B_DEVICE_OP_CODES_END + 234,
INTEL_DEVICE_NAME,
INTEL_GET_EDID,
};
struct DisplayModeEx : display_mode {
uint8 bitsPerPixel;
uint8 bytesPerPixel;
uint16 bytesPerRow;
};
struct SharedInfo {
uint16 vendorID;
uint16 deviceID;
uint8 revision;
char chipName[32];
bool bAccelerantInUse;
area_id regsArea;
area_id videoMemArea;
addr_t videoMemAddr;
phys_addr_t videoMemPCI;
uint32 videoMemSize;
uint32 maxFrameBufferSize;
color_space colorSpaces[6];
uint32 colorSpaceCount;
area_id modeArea;
uint32 modeCount;
DisplayModeEx displayMode;
edid1_info edidInfo;
bool bHaveEDID;
Benaphore engineLock;
};
#endif