centering update for external monitor only mode

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7670 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2004-05-29 12:19:22 +00:00
parent e3964db291
commit a38565b80b
4 changed files with 52 additions and 49 deletions

View File

@ -3,7 +3,7 @@
This file may be used under the terms of the Be Sample Code License.
Other authors:
Rudolf Cornelissen 4/2003-4/2004
Rudolf Cornelissen 4/2003-5/2004
*/
#define MODULE_BIT 0x00200000
@ -127,7 +127,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
nm_crtc_set_timing(target, crt_only);
/* always setup centering so a KB BIOS switch to flatpanel will go OK... */
nm_crtc_center(target);
nm_crtc_center(target, crt_only);
}
/* update driver's mode store */

View File

@ -504,7 +504,7 @@ status_t nm_crtc_set_display_start(uint32 startadd,uint8 bpp)
}
/* setup centering mode for current internal or simultaneous flatpanel mode */
status_t nm_crtc_center(display_mode target)
status_t nm_crtc_center(display_mode target, bool crt_only)
{
/* note:
* NM2070 apparantly doesn't support horizontal centering this way... */
@ -521,56 +521,59 @@ status_t nm_crtc_center(display_mode target)
ctrl2 = ctrl3 = 0x00;
/* calculate offsets for centering if prudent */
if (target.timing.h_display < si->ps.panel_width)
if (!crt_only)
{
hoffset = (si->ps.panel_width - target.timing.h_display);
/* adjust for register contraints:
* horizontal center granularity is 16 pixels */
hoffset = ((hoffset >> 4) - 1);
/* turn on horizontal centering? */
ctrl3 = 0x10;
}
if (target.timing.v_display < si->ps.panel_height)
{
voffset = (si->ps.panel_height - target.timing.v_display);
/* adjust for register contraints:
* vertical center granularity is 2 pixels */
voffset = ((voffset >> 1) - 2);
/* turn on vertical centering? */
ctrl2 = 0x01;
}
switch(target.timing.h_display)
{
case 640:
hcent1 = hoffset;
vcent3 = voffset;
break;
case 800:
hcent2 = hoffset;
switch(target.timing.v_display)
if (target.timing.h_display < si->ps.panel_width)
{
case 480:
//Linux fixme: check this out...
hoffset = (si->ps.panel_width - target.timing.h_display);
/* adjust for register contraints:
* horizontal center granularity is 16 pixels */
hoffset = ((hoffset >> 4) - 1);
/* turn on horizontal centering? */
ctrl3 = 0x10;
}
if (target.timing.v_display < si->ps.panel_height)
{
voffset = (si->ps.panel_height - target.timing.v_display);
/* adjust for register contraints:
* vertical center granularity is 2 pixels */
voffset = ((voffset >> 1) - 2);
/* turn on vertical centering? */
ctrl2 = 0x01;
}
switch(target.timing.h_display)
{
case 640:
hcent1 = hoffset;
vcent3 = voffset;
break;
case 600:
vcent4 = voffset;
case 800:
hcent2 = hoffset;
switch(target.timing.v_display)
{
case 480:
//Linux fixme: check this out...
vcent3 = voffset;
break;
case 600:
vcent4 = voffset;
break;
}
break;
case 1024:
hcent5 = hoffset;
vcent5 = voffset;
break;
case 1280:
/* this mode equals the largest possible panel on the newest chip:
* so no centering needed here. */
break;
default:
//fixme?: block non-standard modes? for now: not centered.
break;
}
break;
case 1024:
hcent5 = hoffset;
vcent5 = voffset;
break;
case 1280:
/* this mode equals the largest possible panel on the newest chip:
* so no centering needed here. */
break;
default:
//fixme?: block non-standard modes? for now: not centered.
break;
}
/* now program the card's registers */

View File

@ -47,7 +47,7 @@ status_t nm_general_powerup()
{
status_t status;
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-12 running.\n"));
LOG(1,("POWERUP: Neomagic (open)BeOS Accelerant 0.06-13 running.\n"));
/* detect card type and power it up */
switch(CFGR(DEVID))

View File

@ -41,7 +41,7 @@ status_t nm_crtc_set_timing(display_mode target, bool crt_only);
status_t nm_crtc_depth(int mode);
status_t nm_crtc_set_display_start(uint32 startadd,uint8 bpp);
status_t nm_crtc_set_display_pitch(void);
status_t nm_crtc_center(display_mode target);
status_t nm_crtc_center(display_mode target, bool crt_only);
status_t nm_crtc_dpms(bool, bool, bool);
status_t nm_crtc_dpms_fetch(bool*, bool*, bool*);