pre-work style cleanup; no functional change

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41028 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-03-19 18:49:14 +00:00
parent d1901581f4
commit 47ad511f59
9 changed files with 185 additions and 168 deletions

View File

@ -42,7 +42,7 @@ public:
uint32 spec, uint32 protection,
area_id sourceArea);
status_t InitCheck()
{ return fArea < 0 ? (status_t)fArea : B_OK; }
{return fArea < 0 ? (status_t)fArea : B_OK;}
void Keep();
private:
@ -118,8 +118,8 @@ init_common(int device, bool isClone)
status_t status = sharedCloner.InitCheck();
if (status < B_OK) {
free(gInfo);
TRACE(("radeon_init_accelerant() failed shared area%i, %i\n", data.shared_info_area,
gInfo->shared_info_area));
TRACE(("radeon_init_accelerant() failed shared area%i, %i\n",
data.shared_info_area, gInfo->shared_info_area));
return status;
}

View File

@ -50,12 +50,14 @@ read32(uint32 offset)
return *(volatile uint32 *)(gInfo->regs + offset);
}
inline void
write32(uint32 offset, uint32 value)
{
*(volatile uint32 *)(gInfo->regs + offset) = value;
}
// modes.cpp
extern status_t create_mode_list(void);

View File

@ -30,8 +30,8 @@ static engine_token sEngineToken = {1, 0 /*B_2D_ACCELERATION*/, NULL};
status_t
radeon_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *syncToken,
engine_token **_engineToken)
radeon_acquire_engine(uint32 capabilities, uint32 maxWait,
sync_token *syncToken, engine_token **_engineToken)
{
TRACE(("radeon_acquire_engine()\n"));
*_engineToken = &sEngineToken;

View File

@ -38,23 +38,26 @@ static display_mode gDisplayMode;
status_t
create_mode_list(void)
{
// TODO : Read active monitor EDID
/* Populate modeline with temporary example */
gDisplayMode.timing.pixel_clock = 71500;
gDisplayMode.timing.h_display = 1366; /* in pixels (not character clocks) */
gDisplayMode.timing.h_display = 1366; // In Pixels
gDisplayMode.timing.h_sync_start = 1406;
gDisplayMode.timing.h_sync_end = 1438;
gDisplayMode.timing.h_total = 1510;
gDisplayMode.timing.v_display = 768; /* in lines */
gDisplayMode.timing.v_display = 768; // In Pixels
gDisplayMode.timing.v_sync_start = 771;
gDisplayMode.timing.v_sync_end = 777;
gDisplayMode.timing.v_total = 789;
gDisplayMode.timing.flags = 0; /* sync polarity, etc. */
gDisplayMode.timing.flags = 0; // Polarity, ex: B_POSITIVE_HSYNC
gDisplayMode.space = B_RGB32_LITTLE; /* pixel configuration */
gDisplayMode.virtual_width = 1366; /* in pixels */
gDisplayMode.virtual_height = 768; /* in lines */
gDisplayMode.h_display_start = 0; /* first displayed pixel in line */
gDisplayMode.v_display_start = 0; /* first displayed line */
gDisplayMode.flags = 0; /* mode flags (Some drivers use this */
gDisplayMode.space = B_RGB32_LITTLE; // Pixel configuration
gDisplayMode.virtual_width = 1366; // In Pixels
gDisplayMode.virtual_height = 768; // In Pixels
gDisplayMode.h_display_start = 0;
gDisplayMode.v_display_start = 0;
gDisplayMode.flags = 0; // Mode flags (Some drivers use this
gInfo->mode_list = &gDisplayMode;
gInfo->shared_info->mode_count = 1;
@ -196,6 +199,7 @@ get_color_space_format(const display_mode &mode, uint32 &colorMode,
bytesPerRow = (bytesPerRow + 63) & ~63;
}
#define D1_REG_OFFSET 0x0000
#define D2_REG_OFFSET 0x0800
@ -214,26 +218,26 @@ DxModeSet(display_mode *mode)
/* Horizontal */
write32(regOffset + D1CRTC_H_TOTAL, displayTiming.h_total - 1);
uint16 blankStart = displayTiming.h_display; //displayTiming.h_sync_end;
uint16 blankEnd = displayTiming.h_sync_start;//displayTiming.h_total;
// write32(regOffset + D1CRTC_H_BLANK_START_END,
// blankStart | (blankEnd << 16));
uint16 blankStart = displayTiming.h_display; // displayTiming.h_sync_end;
uint16 blankEnd = displayTiming.h_sync_start; // displayTiming.h_total;
// write32(regOffset + D1CRTC_H_BLANK_START_END,
// blankStart | (blankEnd << 16));
write32(regOffset + D1CRTC_H_SYNC_A,
(displayTiming.h_sync_end - displayTiming.h_sync_start) << 16);
//write32(regOffset + D1CRTC_H_SYNC_A_CNTL, Mode->Flags & V_NHSYNC);
//!!!write32(regOffset + D1CRTC_H_SYNC_A_CNTL, V_NHSYNC);
// write32(regOffset + D1CRTC_H_SYNC_A_CNTL, Mode->Flags & V_NHSYNC);
//! write32(regOffset + D1CRTC_H_SYNC_A_CNTL, V_NHSYNC);
/* Vertical */
write32(regOffset + D1CRTC_V_TOTAL, displayTiming.v_total - 1);
blankStart = displayTiming.v_display;//displayTiming.v_sync_end;
blankEnd = displayTiming.v_sync_start;//displayTiming.v_total;
// write32(regOffset + D1CRTC_V_BLANK_START_END,
// blankStart | (blankEnd << 16));
blankStart = displayTiming.v_display; // displayTiming.v_sync_end;
blankEnd = displayTiming.v_sync_start; // displayTiming.v_total;
// write32(regOffset + D1CRTC_V_BLANK_START_END,
// blankStart | (blankEnd << 16));
/* set interlaced */
//if (Mode->Flags & V_INTERLACE) {
// if (Mode->Flags & V_INTERLACE) {
if (0) {
write32(regOffset + D1CRTC_INTERLACE_CONTROL, 0x1);
write32(regOffset + D1MODE_DATA_FORMAT, 0x1);
@ -244,10 +248,12 @@ DxModeSet(display_mode *mode)
write32(regOffset + D1CRTC_V_SYNC_A,
(displayTiming.v_sync_end - displayTiming.v_sync_start) << 16);
//write32(regOffset + D1CRTC_V_SYNC_A_CNTL, Mode->Flags & V_NVSYNC);
//!!!write32(regOffset + D1CRTC_V_SYNC_A_CNTL, V_NVSYNC);
// write32(regOffset + D1CRTC_V_SYNC_A_CNTL, Mode->Flags & V_NVSYNC);
//! write32(regOffset + D1CRTC_V_SYNC_A_CNTL, V_NVSYNC);
/* set D1CRTC_HORZ_COUNT_BY2_EN to 0; should only be set to 1 on 30bpp DVI modes */
/* set D1CRTC_HORZ_COUNT_BY2_EN to 0;
should only be set to 1 on 30bpp DVI modes
*/
write32AtMask(regOffset + D1CRTC_COUNT_CONTROL, 0x0, 0x1);
}
@ -263,7 +269,7 @@ DxModeScale(display_mode *mode)
mode->timing.v_display | (mode->timing.h_display << 16));
write32(regOffset + D1MODE_VIEWPORT_START, 0);
/* write32(regOffset + D1MODE_EXT_OVERSCAN_LEFT_RIGHT,
/* write32(regOffset + D1MODE_EXT_OVERSCAN_LEFT_RIGHT,
(Overscan.OverscanLeft << 16) | Overscan.OverscanRight);
write32(regOffset + D1MODE_EXT_OVERSCAN_TOP_BOTTOM,
(Overscan.OverscanTop << 16) | Overscan.OverscanBottom);
@ -310,7 +316,7 @@ radeon_set_display_mode(display_mode *mode)
}
/* Make sure that we are not swapping colours around */
//if (rhdPtr->ChipSet > RHD_R600)
// if (rhdPtr->ChipSet > RHD_R600)
write32(regOffset + D1GRPH_SWAP_CNTL, 0);
/* R5xx - RS690 case is GRPH_CONTROL bit 16 */

View File

@ -39,9 +39,12 @@
static status_t device_open(const char *name, uint32 flags, void **_cookie);
static status_t device_close(void *data);
static status_t device_free(void *data);
static status_t device_ioctl(void *data, uint32 opcode, void *buffer, size_t length);
static status_t device_read(void *data, off_t offset, void *buffer, size_t *length);
static status_t device_write(void *data, off_t offset, const void *buffer, size_t *length);
static status_t device_ioctl(void *data, uint32 opcode,
void *buffer, size_t length);
static status_t device_read(void *data, off_t offset,
void *buffer, size_t *length);
static status_t device_write(void *data, off_t offset,
const void *buffer, size_t *length);
device_hooks gDeviceHooks = {
@ -207,7 +210,8 @@ device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength)
static status_t
device_read(void */*data*/, off_t /*pos*/, void */*buffer*/, size_t *_length)
device_read(void */*data*/, off_t /*pos*/,
void */*buffer*/, size_t *_length)
{
*_length = 0;
return B_NOT_ALLOWED;
@ -215,7 +219,8 @@ device_read(void */*data*/, off_t /*pos*/, void */*buffer*/, size_t *_length)
static status_t
device_write(void */*data*/, off_t /*pos*/, const void */*buffer*/, size_t *_length)
device_write(void */*data*/, off_t /*pos*/,
const void */*buffer*/, size_t *_length)
{
*_length = 0;
return B_NOT_ALLOWED;

View File

@ -137,7 +137,7 @@ init_hardware(void)
{
TRACE((DEVICE_NAME ": init_hardware()\n"));
status_t status = get_module(B_PCI_MODULE_NAME,(module_info **)&gPCI);
status_t status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPCI);
if (status != B_OK) {
TRACE((DEVICE_NAME ": pci module unavailable\n"));
return status;

View File

@ -50,4 +50,6 @@ set_pci_config(pci_info* info, uint8 offset, uint8 size, uint32 value)
size, value);
}
#endif /* DRIVER_H */

View File

@ -42,8 +42,9 @@
status_t
radeon_hd_init(radeon_info &info)
{
// memory mapped I/O
TRACE((DEVICE_NAME ": radeon_hd_init() called\n"));
// memory mapped I/O
AreaKeeper sharedCreator;
info.shared_area = sharedCreator.Create("radeon hd shared info",
(void **)&info.shared_info, B_ANY_KERNEL_ADDRESS,
@ -86,9 +87,10 @@ radeon_hd_init(radeon_info &info)
info.shared_info->registers_area = info.registers_area;
info.shared_info->frame_buffer_offset = 0;
info.shared_info->physical_graphics_memory = info.pci->u.h0.base_registers[RHD_FB_BAR];
info.shared_info->physical_graphics_memory
= info.pci->u.h0.base_registers[RHD_FB_BAR];
TRACE((DEVICE_NAME "radeon_hd_init() completed successfully!\n"));
TRACE((DEVICE_NAME ": radeon_hd_init() completed successfully!\n"));
return B_OK;
}