Matrox: fix 64bit warnings.

This commit is contained in:
Adrien Destugues
2014-10-19 12:51:51 +00:00
parent 13af65c402
commit c8113d4d63
5 changed files with 176 additions and 161 deletions
+15 -15
View File
@@ -75,18 +75,19 @@ uint32 OVERLAY_SUPPORTED_FEATURES(uint32 a_color_space)
} }
} }
const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint16 height) const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint16 height)
{ {
int offset = 0; /* used to determine next buffer to create */ int offset = 0; /* used to determine next buffer to create */
uint32 adress, adress2, temp32; /* used to calculate buffer adresses */ uintptr_t adress, adress2, temp32; /* used to calculate buffer adresses */
uint32 oldsize = 0; /* used to 'squeeze' new buffers between already existing ones */ uint32 oldsize = 0; /* used to 'squeeze' new buffers between already existing ones */
int cnt; /* loopcounter */ int cnt; /* loopcounter */
/* acquire the shared benaphore */ /* acquire the shared benaphore */
AQUIRE_BEN(si->overlay.lock) AQUIRE_BEN(si->overlay.lock)
LOG(4,("Overlay: cardRAM_start = $%08x\n",(uint32)((uint8*)si->framebuffer))); LOG(4, ("Overlay: cardRAM_start = $%p\n", (uint8*)si->framebuffer));
LOG(4,("Overlay: cardRAM_start_DMA = $%08x\n",(uint32)((uint8*)si->framebuffer_pci))); LOG(4, ("Overlay: cardRAM_start_DMA = $%p\n", (uint8*)si->framebuffer_pci));
LOG(4, ("Overlay: cardRAM_size = %dMb\n", si->ps.memory_size)); LOG(4, ("Overlay: cardRAM_size = %dMb\n", si->ps.memory_size));
/* find first empty slot (room for another buffer?) */ /* find first empty slot (room for another buffer?) */
@@ -245,14 +246,14 @@ const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint
* Driver setup is as follows: * Driver setup is as follows:
* card base: - hardware cursor bitmap (if used), * card base: - hardware cursor bitmap (if used),
* directly above - screen memory for both heads */ * directly above - screen memory for both heads */
adress2 = (((uint32)((uint8*)si->fbc.frame_buffer)) + /* cursor already included here */ adress2 = (((uintptr_t)((uint8*)si->fbc.frame_buffer)) + /* cursor already included here */
(si->fbc.bytes_per_row * si->dm.virtual_height)); /* size in bytes of screen(s) */ (si->fbc.bytes_per_row * si->dm.virtual_height)); /* size in bytes of screen(s) */
LOG(4, ("Overlay: first free cardRAM virtual adress $%08x\n", adress2)); LOG(4, ("Overlay: first free cardRAM virtual adress $%08x\n", adress2));
/* calculate 'preliminary' buffer size including slopspace */ /* calculate 'preliminary' buffer size including slopspace */
oldsize = si->overlay.myBufInfo[offset].size; oldsize = si->overlay.myBufInfo[offset].size;
si->overlay.myBufInfo[offset].size = si->overlay.myBufInfo[offset].size
si->overlay.myBuffer[offset].bytes_per_row * si->overlay.myBuffer[offset].height; = si->overlay.myBuffer[offset].bytes_per_row * si->overlay.myBuffer[offset].height;
/* calculate virtual memory adress that would be needed for a new bitmap */ /* calculate virtual memory adress that would be needed for a new bitmap */
/* NOTE to app programmers: /* NOTE to app programmers:
@@ -265,7 +266,7 @@ const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint
* If you switch now to settings: 1600x1200x32bit (single head) the app needs to fallback to * If you switch now to settings: 1600x1200x32bit (single head) the app needs to fallback to
* bitmap output or maybe single buffered overlay output if small bitmaps are used. */ * bitmap output or maybe single buffered overlay output if small bitmaps are used. */
adress = (((uint32)((uint8*)si->framebuffer)) + (si->ps.memory_size * 1024 * 1024)); adress = (((uintptr_t)((uint8*)si->framebuffer)) + (si->ps.memory_size * 1024 * 1024));
for (cnt = 0; cnt <= offset; cnt++) for (cnt = 0; cnt <= offset; cnt++)
{ {
adress -= si->overlay.myBufInfo[cnt].size; adress -= si->overlay.myBufInfo[cnt].size;
@@ -276,7 +277,7 @@ const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint
/* Check if we need to modify the buffers starting adress and thus the size */ /* Check if we need to modify the buffers starting adress and thus the size */
/* calculate 'would be' cardRAM offset */ /* calculate 'would be' cardRAM offset */
temp32 = (adress - ((uint32)((vuint32 *)si->framebuffer))); temp32 = (adress - ((uintptr_t)((vuint32 *)si->framebuffer)));
/* check if it is aligned */ /* check if it is aligned */
if (temp32 != (temp32 & 0xfffffff0)) if (temp32 != (temp32 & 0xfffffff0))
{ {
@@ -359,7 +360,7 @@ const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint
* If you switch now to settings: 1600x1200x32bit (single head) the app needs to fallback to * If you switch now to settings: 1600x1200x32bit (single head) the app needs to fallback to
* bitmap output or maybe single buffered overlay output if small bitmaps are used. */ * bitmap output or maybe single buffered overlay output if small bitmaps are used. */
adress = (((uint32)((uint8*)si->framebuffer_pci)) + (si->ps.memory_size * 1024 * 1024)); adress = (((uintptr_t)((uint8*)si->framebuffer_pci)) + (si->ps.memory_size * 1024 * 1024));
for (cnt = 0; cnt <= offset; cnt++) for (cnt = 0; cnt <= offset; cnt++)
{ {
adress -= si->overlay.myBufInfo[cnt].size; adress -= si->overlay.myBufInfo[cnt].size;
@@ -367,19 +368,17 @@ const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint
/* this adress is already aligned to the scaler's requirements (via the already modified sizes) */ /* this adress is already aligned to the scaler's requirements (via the already modified sizes) */
si->overlay.myBuffer[offset].buffer_dma = (void *) adress; si->overlay.myBuffer[offset].buffer_dma = (void *) adress;
LOG(4,("Overlay: New buffer: addr $%08x, dma_addr $%08x, color space $%08x\n", LOG(4, ("Overlay: New buffer: addr $%p, dma_addr $%p, color space $%08x\n",
(uint32)((uint8*)si->overlay.myBuffer[offset].buffer), (uint8*)si->overlay.myBuffer[offset].buffer,
(uint32)((uint8*)si->overlay.myBuffer[offset].buffer_dma), cs)); (uint8*)si->overlay.myBuffer[offset].buffer_dma, cs));
LOG(4, ("Overlay: New buffer's size is $%08x\n", si->overlay.myBufInfo[offset].size)); LOG(4, ("Overlay: New buffer's size is $%08x\n", si->overlay.myBufInfo[offset].size));
/* release the shared benaphore */ /* release the shared benaphore */
RELEASE_BEN(si->overlay.lock) RELEASE_BEN(si->overlay.lock)
return &si->overlay.myBuffer[offset]; return &si->overlay.myBuffer[offset];
} } else {
else
/* sorry, no more room for buffers */ /* sorry, no more room for buffers */
{
LOG(4, ("Overlay: Sorry, no more space for buffers: aborted\n")); LOG(4, ("Overlay: Sorry, no more space for buffers: aborted\n"));
/* release the shared benaphore */ /* release the shared benaphore */
@@ -389,6 +388,7 @@ const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint
} }
} }
status_t RELEASE_OVERLAY_BUFFER(const overlay_buffer *ob) status_t RELEASE_OVERLAY_BUFFER(const overlay_buffer *ob)
/* Note that the user can delete the buffers in any order desired! */ /* Note that the user can delete the buffers in any order desired! */
{ {
@@ -14,7 +14,7 @@ struct move_overlay_info
uint32 hsrcstv; /* horizontal source start in source buffer (clipping) */ uint32 hsrcstv; /* horizontal source start in source buffer (clipping) */
uint32 hsrcendv; /* horizontal source end in source buffer (clipping) */ uint32 hsrcendv; /* horizontal source end in source buffer (clipping) */
uint32 v1srcstv; /* vertical source start in source buffer (clipping) */ uint32 v1srcstv; /* vertical source start in source buffer (clipping) */
uint32 a1orgv; /* alternate source clipping via startadress of source buffer */ uintptr_t a1orgv; /* alternate source clipping via startadress of source buffer */
}; };
static void gx00_bes_calc_move_overlay(move_overlay_info *moi); static void gx00_bes_calc_move_overlay(move_overlay_info *moi);
@@ -270,8 +270,8 @@ static void gx00_bes_calc_move_overlay(move_overlay_info *moi)
/* calculate relative base_adress and 'vertical weight fractional part' */ /* calculate relative base_adress and 'vertical weight fractional part' */
moi->v1srcstv = 0; moi->v1srcstv = 0;
/* calculate origin adress */ /* calculate origin adress */
moi->a1orgv = (uint32)((vuint32 *)si->overlay.ob.buffer); moi->a1orgv = (uintptr_t)((vuint32 *)si->overlay.ob.buffer);
moi->a1orgv -= (uint32)((vuint32 *)si->framebuffer); moi->a1orgv -= (uintptr_t)((vuint32 *)si->framebuffer);
LOG(4, ("Overlay: topleft corner of input bitmap (cardRAM offset) $%08x\n", moi->a1orgv)); LOG(4, ("Overlay: topleft corner of input bitmap (cardRAM offset) $%08x\n", moi->a1orgv));
/* check for destination vertical clipping at top side */ /* check for destination vertical clipping at top side */
if (si->overlay.ow.v_start < crtc_vstart) if (si->overlay.ow.v_start < crtc_vstart)
@@ -285,9 +285,7 @@ static void gx00_bes_calc_move_overlay(move_overlay_info *moi)
* bytes per row source picture */ * bytes per row source picture */
moi->v1srcstv = (si->overlay.ow.height - 2) * si->overlay.v_ifactor; moi->v1srcstv = (si->overlay.ow.height - 2) * si->overlay.v_ifactor;
moi->a1orgv += ((moi->v1srcstv >> 16) * si->overlay.ob.bytes_per_row); moi->a1orgv += ((moi->v1srcstv >> 16) * si->overlay.ob.bytes_per_row);
} } else {
else
{
/* increase source buffer origin with: /* increase source buffer origin with:
* (integer part of (number of destination picture clipping pixels * inverse scaling factor)) * * (integer part of (number of destination picture clipping pixels * inverse scaling factor)) *
* bytes per row source picture */ * bytes per row source picture */
+26 -15
View File
@@ -337,13 +337,15 @@ status_t gx00_dac_pix_pll_find
return B_ERROR; return B_ERROR;
} }
/* find nearest valid pixel PLL setting: rewritten by rudolf */ /* find nearest valid pixel PLL setting: rewritten by rudolf */
static status_t milx_dac_pix_pll_find( static status_t milx_dac_pix_pll_find(
display_mode target,float * calc_pclk,uint8 * m_result,uint8 * n_result,uint8 * p_result) display_mode target, float* calc_pclk, uint8* m_result, uint8* n_result,
uint8* p_result)
{ {
int m = 0, n = 0, p = 0; int m = 0, n = 0, p = 0;
float error, error_best = 999999999; float error, error_best = INFINITY;
int best[3]; int best[3] = {0, 0, 0};
float f_vco, max_pclk; float f_vco, max_pclk;
float req_pclk = target.timing.pixel_clock / 1000.0; float req_pclk = target.timing.pixel_clock / 1000.0;
@@ -455,13 +457,15 @@ static status_t milx_dac_pix_pll_find(
return B_OK; return B_OK;
} }
/* find nearest valid pixel PLL setting: rewritten by rudolf */ /* find nearest valid pixel PLL setting: rewritten by rudolf */
static status_t g100_g400max_dac_pix_pll_find( static status_t g100_g400max_dac_pix_pll_find(
display_mode target,float * calc_pclk,uint8 * m_result,uint8 * n_result,uint8 * p_result, uint8 test) display_mode target, float* calc_pclk, uint8* m_result, uint8* n_result,
uint8* p_result, uint8 test)
{ {
int m = 0, n = 0, p = 0, m_max; int m = 0, n = 0, p = 0, m_max;
float error, error_best = 999999999; float error, error_best = INFINITY;
int best[3]; int best[3] = {0, 0, 0};
float f_vco, max_pclk; float f_vco, max_pclk;
float req_pclk = target.timing.pixel_clock/1000.0; float req_pclk = target.timing.pixel_clock/1000.0;
@@ -613,14 +617,16 @@ static status_t g100_g400max_dac_pix_pll_find(
return B_OK; return B_OK;
} }
/* find nearest valid pixel PLL setting: rewritten by rudolf */ /* find nearest valid pixel PLL setting: rewritten by rudolf */
static status_t g450_g550_dac_pix_pll_find static status_t g450_g550_dac_pix_pll_find
(display_mode target,float * calc_pclk,uint8 * m_result,uint8 * n_result,uint8 * p_result, uint8 test) (display_mode target, float* calc_pclk, uint8* m_result, uint8* n_result,
uint8* p_result, uint8 test)
{ {
int m = 0, n = 0; int m = 0, n = 0;
uint8 p = 0, q = 0; uint8 p = 0, q = 0;
float error, error_best = 999999999; float error, error_best = INFINITY;
int best[3]; int best[3] = {0, 0, 0};
float f_vco, max_pclk; float f_vco, max_pclk;
float req_pclk = target.timing.pixel_clock / 1000.0; float req_pclk = target.timing.pixel_clock / 1000.0;
@@ -746,13 +752,15 @@ static status_t g450_g550_dac_pix_pll_find
return B_OK; return B_OK;
} }
/* find nearest valid system PLL setting */ /* find nearest valid system PLL setting */
static status_t g100_g400max_dac_sys_pll_find( static status_t g100_g400max_dac_sys_pll_find(
float req_sclk,float * calc_sclk,uint8 * m_result,uint8 * n_result,uint8 * p_result) float req_sclk, float* calc_sclk, uint8* m_result, uint8* n_result,
uint8 * p_result)
{ {
int m = 0, n = 0, p = 0, m_max; int m = 0, n = 0, p = 0, m_max;
float error, error_best = 999999999; float error, error_best = INFINITY;
int best[3]; int best[3] = {0, 0, 0};
float f_vco; float f_vco;
/* determine the max. reference-frequency postscaler setting for the /* determine the max. reference-frequency postscaler setting for the
@@ -867,6 +875,7 @@ static status_t g100_g400max_dac_sys_pll_find(
return B_OK; return B_OK;
} }
static status_t gx50_dac_check_sys_pll(uint8 m, uint8 n, uint8 p) static status_t gx50_dac_check_sys_pll(uint8 m, uint8 n, uint8 p)
{ {
uint time = 0, count = 0; uint time = 0, count = 0;
@@ -952,14 +961,16 @@ static status_t gx50_dac_check_sys_pll_range(uint8 m, uint8 n, uint8 *p, uint8 *
return B_ERROR; return B_ERROR;
} }
/* find nearest valid system PLL setting */ /* find nearest valid system PLL setting */
static status_t g450_g550_dac_sys_pll_find( static status_t g450_g550_dac_sys_pll_find(
float req_sclk,float * calc_sclk,uint8 * m_result,uint8 * n_result,uint8 * p_result) float req_sclk, float* calc_sclk, uint8* m_result, uint8* n_result,
uint8* p_result)
{ {
int m = 0, n = 0; int m = 0, n = 0;
uint8 p = 0, q = 0; uint8 p = 0, q = 0;
float error, error_best = 999999999; float error, error_best = INFINITY;
int best[3]; int best[3] = {0, 0, 0};
float f_vco; float f_vco;
LOG(4, ("DAC: G450/G550 restrictions apply\n")); LOG(4, ("DAC: G450/G550 restrictions apply\n"));
@@ -329,13 +329,15 @@ status_t g100_g400max_maven_set_vid_pll(display_mode target)
return B_OK; return B_OK;
} }
/* find nearest valid video PLL setting */ /* find nearest valid video PLL setting */
status_t g100_g400max_maven_vid_pll_find( status_t g100_g400max_maven_vid_pll_find(
display_mode target,float * calc_pclk,uint8 * m_result,uint8 * n_result,uint8 * p_result) display_mode target, float* calc_pclk, uint8* m_result, uint8* n_result,
uint8* p_result)
{ {
int m = 0, n = 0, p = 0, m_max; int m = 0, n = 0, p = 0, m_max;
float error, error_best = 999999999; float error, error_best = INT_MAX;
int best[3]; int best[3] = {0, 0, 0};
float f_vco, max_pclk; float f_vco, max_pclk;
float req_pclk = target.timing.pixel_clock/1000.0; float req_pclk = target.timing.pixel_clock/1000.0;
@@ -468,6 +470,7 @@ status_t g100_g400max_maven_vid_pll_find(
return B_OK; return B_OK;
} }
static status_t gx50_maven_check_vid_pll(uint8 m, uint8 n, uint8 p) static status_t gx50_maven_check_vid_pll(uint8 m, uint8 n, uint8 p)
{ {
uint time = 0, count = 0; uint time = 0, count = 0;
@@ -558,14 +561,16 @@ static status_t gx50_maven_check_vid_pll_range(uint8 m, uint8 n, uint8 *p, uint8
return B_ERROR; return B_ERROR;
} }
/* find nearest valid video PLL setting */ /* find nearest valid video PLL setting */
status_t g450_g550_maven_vid_pll_find status_t g450_g550_maven_vid_pll_find
(display_mode target,float * calc_pclk,uint8 * m_result,uint8 * n_result,uint8 * p_result, uint8 test) (display_mode target, float* calc_pclk, uint8* m_result, uint8* n_result,
uint8* p_result, uint8 test)
{ {
int m = 0, n = 0; int m = 0, n = 0;
uint8 p = 0, q = 0; uint8 p = 0, q = 0;
float error, error_best = 999999999; float error, error_best = INFINITY;
int best[3]; int best[3] = {0, 0, 0};
float f_vco, max_pclk; float f_vco, max_pclk;
float req_pclk = target.timing.pixel_clock/1000.0; float req_pclk = target.timing.pixel_clock/1000.0;
@@ -20,9 +20,11 @@ typedef struct {
float chroma_subcarrier; float chroma_subcarrier;
} gx50_maven_timing; } gx50_maven_timing;
//fixme: try to implement 'fast' and 'slow' settings for all modes,
// so buffer duplication or skipping won't be neccesary for realtime video. // FIXME: try to implement 'fast' and 'slow' settings for all modes, so buffer
//fixme: try to setup the CRTC2 in interlaced mode for the video modes on <= G400MAX cards. // duplication or skipping won't be neccesary for realtime video.
// FIXME: try to setup the CRTC2 in interlaced mode for the video modes
// on <= G400MAX cards.
/* find 'exact' valid video PLL setting */ /* find 'exact' valid video PLL setting */
status_t g100_g400max_maventv_vid_pll_find( status_t g100_g400max_maventv_vid_pll_find(
@@ -30,8 +32,9 @@ status_t g100_g400max_maventv_vid_pll_find(
uint8 * m_result, uint8 * n_result, uint8 * p_result) uint8 * m_result, uint8 * n_result, uint8 * p_result)
{ {
int m = 0, n = 0, p = 0, m_max; int m = 0, n = 0, p = 0, m_max;
float diff, diff_smallest = 999999999; float diff, diff_smallest = INFINITY;
int best[5], h_total_mod; int best[5] = {0, 0, 0, 0, 0};
int h_total_mod;
float fields_sec, f_vco; float fields_sec, f_vco;
/* We need to be exact, so work with clockperiods per field instead of with frequency. /* We need to be exact, so work with clockperiods per field instead of with frequency.
* Make sure however we truncate these clocks to be integers! * Make sure however we truncate these clocks to be integers!
@@ -199,9 +202,7 @@ status_t g100_g400max_maventv_vid_pll_find(
m = 0x03; m = 0x03;
n = 0x07; n = 0x07;
p = 0x03; p = 0x03;
} } else {
else
{
/* set 14.31818Mhz */ /* set 14.31818Mhz */
m = 0x01; m = 0x01;
n = 0x07; n = 0x07;