intel_810: Style cleanup. No functional change

* I think the FunctionNames need to change to function_name
This commit is contained in:
Alexander von Gluck IV
2012-05-30 16:11:09 -05:00
parent e0ee3b7971
commit 0e8316cc90
11 changed files with 97 additions and 102 deletions
@@ -5,7 +5,6 @@
* Authors: * Authors:
* Gerald Zajac * Gerald Zajac
*/ */
#ifndef DRIVERINTERFACE_H #ifndef DRIVERINTERFACE_H
#define DRIVERINTERFACE_H #define DRIVERINTERFACE_H
@@ -23,7 +22,6 @@
#define ENABLE_DEBUG_TRACE // if defined, turns on debug output to syslog #define ENABLE_DEBUG_TRACE // if defined, turns on debug output to syslog
#define ARRAY_SIZE(a) (int(sizeof(a) / sizeof(a[0]))) // get number of elements in an array #define ARRAY_SIZE(a) (int(sizeof(a) / sizeof(a[0]))) // get number of elements in an array
@@ -81,12 +79,12 @@ struct SharedInfo {
bool bAccelerantInUse; // true = accelerant has been initialized bool bAccelerantInUse; // true = accelerant has been initialized
// Memory mappings. // Memory mappings.
area_id regsArea; // area_id for the memory mapped registers. It will area_id regsArea; // area_id for the memory mapped registers. It
// be cloned into accelerant's address space. // will be cloned into accelerant address space.
area_id videoMemArea; // video memory area_id. Addr's shared with all teams. area_id videoMemArea; // addr shared with all teams.
addr_t videoMemAddr; // virtual video memory addr addr_t videoMemAddr; // virtual video memory addr
phys_addr_t videoMemPCI; // physical video memory addr phys_addr_t videoMemPCI; // physical video memory addr
uint32 videoMemSize; // video memory size in bytes (for frame buffer). uint32 videoMemSize; // video memory size in bytes (for frame buffer)
uint32 maxFrameBufferSize; // max available video memory for frame buffer uint32 maxFrameBufferSize; // max available video memory for frame buffer
@@ -95,7 +93,7 @@ struct SharedInfo {
uint32 colorSpaceCount; // number of color spaces in array colorSpaces uint32 colorSpaceCount; // number of color spaces in array colorSpaces
// List of screen modes. // List of screen modes.
area_id modeArea; // area containing list of display modes the driver supports area_id modeArea; // area containing list of display modes
uint32 modeCount; // number of display modes in the list uint32 modeCount; // number of display modes in the list
DisplayModeEx displayMode; // current display mode configuration DisplayModeEx displayMode; // current display mode configuration
@@ -103,7 +101,7 @@ struct SharedInfo {
edid1_info edidInfo; edid1_info edidInfo;
bool bHaveEDID; // true = EDID info from device is in edidInfo bool bHaveEDID; // true = EDID info from device is in edidInfo
Benaphore engineLock; // for serializing access to the acceleration engine Benaphore engineLock; // serializing access to the acceleration engine
}; };
@@ -6,6 +6,7 @@
* Gerald Zajac * Gerald Zajac
*/ */
#include "accelerant.h" #include "accelerant.h"
#include <errno.h> #include <errno.h>
@@ -13,7 +14,6 @@
#include <unistd.h> #include <unistd.h>
AccelerantInfo gInfo; // global data used by source files of accelerant AccelerantInfo gInfo; // global data used by source files of accelerant
static uint32 videoValue; static uint32 videoValue;
@@ -40,8 +40,7 @@ SuppressArtifacts(void* dataPtr)
SharedInfo& si = *((SharedInfo*)dataPtr); SharedInfo& si = *((SharedInfo*)dataPtr);
while (true) while (true) {
{
uint32* src = ((uint32*)(si.videoMemAddr)) + si.videoMemSize / 4 - 1; uint32* src = ((uint32*)(si.videoMemAddr)) + si.videoMemSize / 4 - 1;
uint32 count = 65000; uint32 count = 65000;
@@ -5,12 +5,11 @@
* Authors: * Authors:
* Gerald Zajac * Gerald Zajac
*/ */
#ifndef _ACCELERANT_H #ifndef _ACCELERANT_H
#define _ACCELERANT_H #define _ACCELERANT_H
#include "DriverInterface.h"
#include "DriverInterface.h"
#undef TRACE #undef TRACE
@@ -24,7 +23,6 @@ extern "C" void _sPrintf(const char* format, ...);
// Global data used by various source files of the accelerant. // Global data used by various source files of the accelerant.
struct AccelerantInfo { struct AccelerantInfo {
int deviceFileDesc; // file descriptor of kernel driver int deviceFileDesc; // file descriptor of kernel driver
@@ -95,11 +93,9 @@ status_t SyncToToken(sync_token* st);
#endif #endif
// Prototypes for other functions that are called from source files other than // Prototypes for other functions that are called from source files other than
// where they are defined. // where they are defined.
// ============================================================================ // ============================================================================
status_t CreateModeList(bool (*checkMode)(const display_mode* mode)); status_t CreateModeList(bool (*checkMode)(const display_mode* mode));
bool IsModeUsable(const display_mode* mode); bool IsModeUsable(const display_mode* mode);
+3 -2
View File
@@ -6,6 +6,7 @@
* Gerald Zajac * Gerald Zajac
*/ */
#include "accelerant.h" #include "accelerant.h"
#include "i810_regs.h" #include "i810_regs.h"
@@ -73,9 +74,9 @@ GetSyncToken(engine_token* engineToken, sync_token* syncToken)
status_t status_t
SyncToToken(sync_token* syncToken) SyncToToken(sync_token* syncToken)
{ {
(void)syncToken; // avoid compiler warning for unused arg (void)syncToken;
// avoid compiler warning for unused arg
WaitEngineIdle(); WaitEngineIdle();
return B_OK; return B_OK;
} }
+3 -1
View File
@@ -6,13 +6,15 @@
* Gerald Zajac * Gerald Zajac
*/ */
#include "accelerant.h" #include "accelerant.h"
extern "C" void* extern "C" void*
get_accelerant_hook(uint32 feature, void* data) get_accelerant_hook(uint32 feature, void* data)
{ {
(void)data; // avoid compiler warning for unused arg (void)data;
// avoid compiler warning for unused arg
switch (feature) { switch (feature) {
// General // General
@@ -19,7 +19,6 @@
#include "i810_regs.h" #include "i810_regs.h"
bool bool
I810_GetColorSpaceParams(int colorSpace, uint8& bitsPerPixel, I810_GetColorSpaceParams(int colorSpace, uint8& bitsPerPixel,
uint32& maxPixelClock) uint32& maxPixelClock)
@@ -14,6 +14,7 @@
All Rights Reserved. All Rights Reserved.
*/ */
#include "accelerant.h" #include "accelerant.h"
#include "i810_regs.h" #include "i810_regs.h"
@@ -22,15 +23,14 @@
#include <unistd.h> #include <unistd.h>
// I810_CalcVCLK -- Determine closest clock frequency to the one requested. // I810_CalcVCLK -- Determine closest clock frequency to the one requested.
#define MAX_VCO_FREQ 600.0 #define MAX_VCO_FREQ 600.0
#define TARGET_MAX_N 30 #define TARGET_MAX_N 30
#define REF_FREQ 24.0 #define REF_FREQ 24.0
#define CALC_VCLK(m,n,p) (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ #define CALC_VCLK(m,n,p) (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ
static void static void
CalcVCLK(double freq, uint16& clkM, uint16& clkN, uint16& clkP) { CalcVCLK(double freq, uint16& clkM, uint16& clkN, uint16& clkP) {
int m, n, p; int m, n, p;
@@ -65,8 +65,8 @@ CalcVCLK(double freq, uint16& clkM, uint16& clkN, uint16& clkP) {
f_best = f_out; f_best = f_out;
errBest = f_err; errBest = f_err;
} }
} while ((fabs(f_err) >= errTarget) && } while ((fabs(f_err) >= errTarget) && ((n <= TARGET_MAX_N)
((n <= TARGET_MAX_N) || (fabs(errBest) > errMax))); || (fabs(errBest) > errMax)));
if (fabs(f_err) < errTarget) { if (fabs(f_err) < errTarget) {
m_best = m; m_best = m;
@@ -236,8 +236,8 @@ I810_SetDisplayMode(const DisplayModeEx& mode)
OUTREG16(EIR, 0); OUTREG16(EIR, 0);
temp32 = INREG32(FWATER_BLC); temp32 = INREG32(FWATER_BLC);
temp32 &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK | temp32 &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK
MM_BURST_LENGTH | MM_FIFO_WATERMARK); | MM_BURST_LENGTH | MM_FIFO_WATERMARK);
temp32 |= I810_GetWatermark(mode); temp32 |= I810_GetWatermark(mode);
OUTREG32(FWATER_BLC, temp32); OUTREG32(FWATER_BLC, temp32);
+17 -7
View File
@@ -13,7 +13,6 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved. All Rights Reserved.
*/ */
#ifndef __I810_REGS_H__ #ifndef __I810_REGS_H__
#define __I810_REGS_H__ #define __I810_REGS_H__
@@ -123,37 +122,48 @@
(OUTREG(addr, (INREG(addr) & ~mask) | (value & mask))) (OUTREG(addr, (INREG(addr) & ~mask) | (value & mask)))
static inline uint8 ReadCrtcReg(uint8 index) static inline uint8
ReadCrtcReg(uint8 index)
{ {
OUTREG8(CRTC_INDEX, index); OUTREG8(CRTC_INDEX, index);
return INREG8(CRTC_DATA); return INREG8(CRTC_DATA);
} }
static inline void WriteCrtcReg(uint8 index, uint8 value)
static inline void
WriteCrtcReg(uint8 index, uint8 value)
{ {
OUTREG8(CRTC_INDEX, index); OUTREG8(CRTC_INDEX, index);
OUTREG8(CRTC_DATA, value); OUTREG8(CRTC_DATA, value);
} }
static inline uint8 ReadGraphReg(uint8 index)
static inline uint8
ReadGraphReg(uint8 index)
{ {
OUTREG8(GRAPH_INDEX, index); OUTREG8(GRAPH_INDEX, index);
return INREG8(GRAPH_DATA); return INREG8(GRAPH_DATA);
} }
static inline void WriteGraphReg(uint8 index, uint8 value)
static inline void
WriteGraphReg(uint8 index, uint8 value)
{ {
OUTREG8(GRAPH_INDEX, index); OUTREG8(GRAPH_INDEX, index);
OUTREG8(GRAPH_DATA, value); OUTREG8(GRAPH_DATA, value);
} }
static inline uint8 ReadSeqReg(uint8 index)
static inline uint8
ReadSeqReg(uint8 index)
{ {
OUTREG8(SEQ_INDEX, index); OUTREG8(SEQ_INDEX, index);
return INREG8(SEQ_DATA); return INREG8(SEQ_DATA);
} }
static inline void WriteSeqReg(uint8 index, uint8 value)
static inline void
WriteSeqReg(uint8 index, uint8 value)
{ {
OUTREG8(SEQ_INDEX, index); OUTREG8(SEQ_INDEX, index);
OUTREG8(SEQ_DATA, value); OUTREG8(SEQ_DATA, value);
@@ -34,6 +34,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/ **************************************************************************/
#include "accelerant.h" #include "accelerant.h"
@@ -104,7 +105,6 @@ static WatermarkInfo watermarks_16[] = {
}; };
uint32 uint32
I810_GetWatermark(const DisplayModeEx& mode) I810_GetWatermark(const DisplayModeEx& mode)
{ {
+3 -9
View File
@@ -1,11 +1,12 @@
/* /*
* Copyright 2007-2012 Haiku, Inc. All rights reserved. * Copyright 2007-2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
*
* Authors: * Authors:
* Gerald Zajac * Gerald Zajac
*/ */
#include "accelerant.h" #include "accelerant.h"
#include <create_display_modes.h> // common accelerant header file #include <create_display_modes.h> // common accelerant header file
@@ -13,7 +14,6 @@
#include <unistd.h> #include <unistd.h>
static bool static bool
IsThereEnoughFBMemory(const display_mode* mode, uint32 bitsPerPixel) IsThereEnoughFBMemory(const display_mode* mode, uint32 bitsPerPixel)
{ {
@@ -35,7 +35,6 @@ IsThereEnoughFBMemory(const display_mode* mode, uint32 bitsPerPixel)
} }
bool bool
IsModeUsable(const display_mode* mode) IsModeUsable(const display_mode* mode)
{ {
@@ -134,7 +133,6 @@ CreateModeList(bool (*checkMode)(const display_mode* mode))
} }
status_t status_t
ProposeDisplayMode(display_mode* target, const display_mode* low, ProposeDisplayMode(display_mode* target, const display_mode* low,
const display_mode* high) const display_mode* high)
@@ -223,7 +221,6 @@ SetDisplayMode(display_mode* pMode)
} }
status_t status_t
MoveDisplay(uint16 horizontalStart, uint16 verticalStart) MoveDisplay(uint16 horizontalStart, uint16 verticalStart)
{ {
@@ -269,7 +266,7 @@ GetModeList(display_mode* dmList)
status_t status_t
GetDisplayMode(display_mode* current_mode) GetDisplayMode(display_mode* current_mode)
{ {
*current_mode = gInfo.sharedInfo->displayMode; // return current display mode *current_mode = gInfo.sharedInfo->displayMode; // current display mode
return B_OK; return B_OK;
} }
@@ -317,9 +314,7 @@ GetPixelClockLimits(display_mode* mode, uint32* low, uint32* high)
} }
#ifdef __HAIKU__ #ifdef __HAIKU__
status_t status_t
GetEdidInfo(void* info, size_t size, uint32* _version) GetEdidInfo(void* info, size_t size, uint32* _version)
{ {
@@ -335,5 +330,4 @@ GetEdidInfo(void* info, size_t size, uint32* _version)
*_version = EDID_VERSION_1; *_version = EDID_VERSION_1;
return B_OK; return B_OK;
} }
#endif // __HAIKU__ #endif // __HAIKU__
@@ -6,6 +6,7 @@
* Gerald Zajac * Gerald Zajac
*/ */
#include <AGP.h> #include <AGP.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <PCI.h> #include <PCI.h>
@@ -56,9 +57,9 @@ static const ChipInfo chipTable[] = {
struct DeviceInfo { struct DeviceInfo {
uint32 openCount; // count of how many times device has been opened uint32 openCount; // how many times device has been opened
int32 flags; int32 flags;
area_id sharedArea; // area shared between driver and accelerants area_id sharedArea; // shared between driver and accelerants
SharedInfo* sharedInfo; // pointer to shared info area memory SharedInfo* sharedInfo; // pointer to shared info area memory
vuint8* regs; // pointer to memory mapped registers vuint8* regs; // pointer to memory mapped registers
const ChipInfo* pChipInfo; // info about the selected chip const ChipInfo* pChipInfo; // info about the selected chip
@@ -76,7 +77,6 @@ static pci_module_info* gPCI;
// Prototypes for device hook functions. // Prototypes for device hook functions.
static status_t device_open(const char* name, uint32 flags, void** cookie); static status_t device_open(const char* name, uint32 flags, void** cookie);
static status_t device_close(void* dev); static status_t device_close(void* dev);
static status_t device_free(void* dev); static status_t device_free(void* dev);
@@ -100,7 +100,6 @@ static device_hooks gDeviceHooks =
}; };
// Video chip register definitions. // Video chip register definitions.
// ================================= // =================================
@@ -125,7 +124,6 @@ static device_hooks gDeviceHooks =
#define OUTREG32(addr, val) (*((vuint32*)(di.regs + (addr))) = (val)) #define OUTREG32(addr, val) (*((vuint32*)(di.regs + (addr))) = (val))
static inline uint32 static inline uint32
GetPCI(pci_info& info, uint8 offset, uint8 size) GetPCI(pci_info& info, uint8 offset, uint8 size)
{ {
@@ -408,7 +406,6 @@ GetNextSupportedDevice(uint32& pciIndex, pci_info& pciInfo)
} }
// #pragma mark - Kernel Interface // #pragma mark - Kernel Interface
@@ -526,7 +523,6 @@ find_device(const char* name)
} }
// #pragma mark - Device Hooks // #pragma mark - Device Hooks