1e0ee3b79SGerald Zajac /* 2e0ee3b79SGerald Zajac * Copyright 2007-2012 Haiku, Inc. All rights reserved. 3e0ee3b79SGerald Zajac * Distributed under the terms of the MIT license. 4e0ee3b79SGerald Zajac * 5e0ee3b79SGerald Zajac * Authors: 6e0ee3b79SGerald Zajac * Gerald Zajac 7e0ee3b79SGerald Zajac */ 8e0ee3b79SGerald Zajac #ifndef DRIVERINTERFACE_H 9e0ee3b79SGerald Zajac #define DRIVERINTERFACE_H 10e0ee3b79SGerald Zajac 11e0ee3b79SGerald Zajac 12e0ee3b79SGerald Zajac #include <Accelerant.h> 13e0ee3b79SGerald Zajac #include <GraphicsDefs.h> 14e0ee3b79SGerald Zajac #include <Drivers.h> 15e0ee3b79SGerald Zajac #include <edid.h> 16e0ee3b79SGerald Zajac 17e0ee3b79SGerald Zajac 18e0ee3b79SGerald Zajac // This file contains info that is shared between the kernel driver and the 19e0ee3b79SGerald Zajac // accelerant, and info that is shared among the source files of the 20e0ee3b79SGerald Zajac // accelerant. 21e0ee3b79SGerald Zajac 22e0ee3b79SGerald Zajac 23e0ee3b79SGerald Zajac #define ENABLE_DEBUG_TRACE // if defined, turns on debug output to syslog 24e0ee3b79SGerald Zajac 25e0ee3b79SGerald Zajac 26e0ee3b79SGerald Zajac struct Benaphore { 27e0ee3b79SGerald Zajac sem_id sem; 28e0ee3b79SGerald Zajac int32 count; 29e0ee3b79SGerald Zajac InitBenaphore30e0ee3b79SGerald Zajac status_t Init(const char* name) 31e0ee3b79SGerald Zajac { 32e0ee3b79SGerald Zajac count = 0; 33e0ee3b79SGerald Zajac sem = create_sem(0, name); 34e0ee3b79SGerald Zajac return sem < 0 ? sem : B_OK; 35e0ee3b79SGerald Zajac } 36e0ee3b79SGerald Zajac AcquireBenaphore37e0ee3b79SGerald Zajac status_t Acquire() 38e0ee3b79SGerald Zajac { 39e0ee3b79SGerald Zajac if (atomic_add(&count, 1) > 0) 40e0ee3b79SGerald Zajac return acquire_sem(sem); 41e0ee3b79SGerald Zajac return B_OK; 42e0ee3b79SGerald Zajac } 43e0ee3b79SGerald Zajac ReleaseBenaphore44e0ee3b79SGerald Zajac status_t Release() 45e0ee3b79SGerald Zajac { 46e0ee3b79SGerald Zajac if (atomic_add(&count, -1) > 1) 47e0ee3b79SGerald Zajac return release_sem(sem); 48e0ee3b79SGerald Zajac return B_OK; 49e0ee3b79SGerald Zajac } 50e0ee3b79SGerald Zajac DeleteBenaphore51e0ee3b79SGerald Zajac void Delete() { delete_sem(sem); } 52e0ee3b79SGerald Zajac }; 53e0ee3b79SGerald Zajac 54e0ee3b79SGerald Zajac 55e0ee3b79SGerald Zajac 56e0ee3b79SGerald Zajac enum { 57e0ee3b79SGerald Zajac INTEL_GET_SHARED_DATA = B_DEVICE_OP_CODES_END + 234, 58e0ee3b79SGerald Zajac INTEL_DEVICE_NAME, 59e0ee3b79SGerald Zajac INTEL_GET_EDID, 60e0ee3b79SGerald Zajac }; 61e0ee3b79SGerald Zajac 62e0ee3b79SGerald Zajac 63e0ee3b79SGerald Zajac struct DisplayModeEx : display_mode { 64e0ee3b79SGerald Zajac uint8 bitsPerPixel; 65e0ee3b79SGerald Zajac uint8 bytesPerPixel; 66e0ee3b79SGerald Zajac uint16 bytesPerRow; // number of bytes in one line/row 67e0ee3b79SGerald Zajac }; 68e0ee3b79SGerald Zajac 69e0ee3b79SGerald Zajac 70e0ee3b79SGerald Zajac struct SharedInfo { 71e0ee3b79SGerald Zajac // Device ID info. 72e0ee3b79SGerald Zajac uint16 vendorID; // PCI vendor ID, from pci_info 73e0ee3b79SGerald Zajac uint16 deviceID; // PCI device ID, from pci_info 74e0ee3b79SGerald Zajac uint8 revision; // PCI device revsion, from pci_info 75e0ee3b79SGerald Zajac char chipName[32]; // user recognizable name of chip 76e0ee3b79SGerald Zajac 77e0ee3b79SGerald Zajac bool bAccelerantInUse; // true = accelerant has been initialized 78e0ee3b79SGerald Zajac 79e0ee3b79SGerald Zajac // Memory mappings. 80*0e8316ccSAlexander von Gluck IV area_id regsArea; // area_id for the memory mapped registers. It 81*0e8316ccSAlexander von Gluck IV // will be cloned into accelerant address space. 82*0e8316ccSAlexander von Gluck IV area_id videoMemArea; // addr shared with all teams. 83e0ee3b79SGerald Zajac addr_t videoMemAddr; // virtual video memory addr 84e0ee3b79SGerald Zajac phys_addr_t videoMemPCI; // physical video memory addr 85*0e8316ccSAlexander von Gluck IV uint32 videoMemSize; // video memory size in bytes (for frame buffer) 86e0ee3b79SGerald Zajac 87e0ee3b79SGerald Zajac uint32 maxFrameBufferSize; // max available video memory for frame buffer 88e0ee3b79SGerald Zajac 89e0ee3b79SGerald Zajac // Color spaces supported by current video chip/driver. 90e0ee3b79SGerald Zajac color_space colorSpaces[6]; 91e0ee3b79SGerald Zajac uint32 colorSpaceCount; // number of color spaces in array colorSpaces 92e0ee3b79SGerald Zajac 93e0ee3b79SGerald Zajac // List of screen modes. 94*0e8316ccSAlexander von Gluck IV area_id modeArea; // area containing list of display modes 95e0ee3b79SGerald Zajac uint32 modeCount; // number of display modes in the list 96e0ee3b79SGerald Zajac 97e0ee3b79SGerald Zajac DisplayModeEx displayMode; // current display mode configuration 98e0ee3b79SGerald Zajac 99e0ee3b79SGerald Zajac edid1_info edidInfo; 100e0ee3b79SGerald Zajac bool bHaveEDID; // true = EDID info from device is in edidInfo 101e0ee3b79SGerald Zajac 102*0e8316ccSAlexander von Gluck IV Benaphore engineLock; // serializing access to the acceleration engine 103e0ee3b79SGerald Zajac }; 104e0ee3b79SGerald Zajac 105e0ee3b79SGerald Zajac 106e0ee3b79SGerald Zajac #endif // DRIVERINTERFACE_H 107