mirror of
https://review.haiku-os.org/haiku
synced 2025-02-01 03:06:08 +01:00
rewrote/simplified DPMS code: much cleaner now. Bumped version to 0.14.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16036 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
998c7c5496
commit
454bde192e
@ -219,6 +219,9 @@ status_t INIT_ACCELERANT(int the_fd)
|
||||
/* ensure cursor state */
|
||||
SHOW_CURSOR(false);
|
||||
|
||||
/* ensure DPMS state */
|
||||
si->dpms_flags = B_DPMS_ON;
|
||||
|
||||
/* a winner! */
|
||||
result = B_OK;
|
||||
/* ensure that INIT_ACCELERANT won't be executed again (copies should be clones) */
|
||||
|
@ -51,7 +51,6 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
|
||||
|
||||
uint8 colour_depth = 24;
|
||||
uint32 startadd;
|
||||
bool display, h, v;
|
||||
|
||||
/* if internal panel is active we don't touch the CRTC timing and the pixelPLL */
|
||||
bool crt_only = true;
|
||||
@ -80,8 +79,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
|
||||
crt_only = false;
|
||||
}
|
||||
|
||||
/* find current DPMS state, then turn off screen(s) */
|
||||
nm_crtc_dpms_fetch(&display, &h, &v);
|
||||
/* turn off screen(s) */
|
||||
nm_crtc_dpms(false, false, false);
|
||||
|
||||
/* where in framebuffer the screen is (should this be dependant on previous MOVEDISPLAY?) */
|
||||
@ -139,12 +137,12 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
|
||||
/* update driver's mode store */
|
||||
si->dm = target;
|
||||
|
||||
/* turn screen on */
|
||||
nm_crtc_dpms(display,h,v);
|
||||
|
||||
/* set up acceleration for this mode */
|
||||
nm_acc_init();
|
||||
|
||||
/* restore screen(s) output state(s) */
|
||||
SET_DPMS_MODE(si->dpms_flags);
|
||||
|
||||
/* log currently selected output */
|
||||
nm_general_output_select();
|
||||
|
||||
@ -253,7 +251,10 @@ status_t SET_DPMS_MODE(uint32 dpms_flags)
|
||||
interrupt_enable(false);
|
||||
|
||||
LOG(4,("SET_DPMS_MODE: $%08x\n", dpms_flags));
|
||||
|
||||
|
||||
/* note current DPMS state for our reference */
|
||||
si->dpms_flags = dpms_flags;
|
||||
|
||||
switch(dpms_flags)
|
||||
{
|
||||
case B_DPMS_ON: /* H: on, V: on */
|
||||
@ -292,31 +293,5 @@ uint32 DPMS_CAPABILITIES(void)
|
||||
/* Return the current DPMS mode. */
|
||||
uint32 DPMS_MODE(void)
|
||||
{
|
||||
bool display, h, v;
|
||||
|
||||
interrupt_enable(false);
|
||||
nm_crtc_dpms_fetch(&display, &h, &v);
|
||||
interrupt_enable(true);
|
||||
|
||||
if (si->ps.card_type < NM2200)
|
||||
{
|
||||
/* MagicGraph cards don't have full DPMS support */
|
||||
if (display && h && v)
|
||||
return B_DPMS_ON;
|
||||
else
|
||||
return B_DPMS_OFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* MagicMedia cards do have full DPMS support for external monitors */
|
||||
//fixme: checkout if this is true...
|
||||
if (display && h && v)
|
||||
return B_DPMS_ON;
|
||||
else if(v)
|
||||
return B_DPMS_STAND_BY;
|
||||
else if(h)
|
||||
return B_DPMS_SUSPEND;
|
||||
else
|
||||
return B_DPMS_OFF;
|
||||
}
|
||||
return si->dpms_flags;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* CTRC functionality */
|
||||
/* Author:
|
||||
Rudolf Cornelissen 4/2003-11/2004
|
||||
Rudolf Cornelissen 4/2003-1/2006
|
||||
*/
|
||||
|
||||
#define MODULE_BIT 0x00040000
|
||||
@ -386,9 +386,10 @@ status_t nm_crtc_depth(int mode)
|
||||
|
||||
status_t nm_crtc_dpms(bool display, bool h, bool v)
|
||||
{
|
||||
char msg[100];
|
||||
uint8 temp, size_outputs;
|
||||
|
||||
LOG(4,("CRTC: setting DPMS: "));
|
||||
sprintf(msg, "CRTC: setting DPMS: ");
|
||||
|
||||
/* start synchronous reset: required before turning screen off! */
|
||||
ISASEQW(RESET, 0x01);
|
||||
@ -404,36 +405,36 @@ status_t nm_crtc_dpms(bool display, bool h, bool v)
|
||||
|
||||
/* end synchronous reset if display should be enabled */
|
||||
ISASEQW(RESET, 0x03);
|
||||
|
||||
LOG(4,("display on, "));
|
||||
sprintf(msg, "%sdisplay on, ", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ISASEQW(CLKMODE, (temp | 0x20));
|
||||
|
||||
LOG(4,("display off, "));
|
||||
sprintf(msg, "%sdisplay off, ", msg);
|
||||
}
|
||||
|
||||
temp = 0x00;
|
||||
if (h)
|
||||
{
|
||||
LOG(4,("hsync enabled, "));
|
||||
sprintf(msg, "%shsync enabled, ", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp |= 0x10;
|
||||
LOG(4,("hsync disabled, "));
|
||||
sprintf(msg, "%shsync disabled, ", msg);
|
||||
}
|
||||
if (v)
|
||||
{
|
||||
LOG(4,("vsync enabled\n"));
|
||||
sprintf(msg, "%svsync enabled\n", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp |= 0x20;
|
||||
LOG(4,("vsync disabled\n"));
|
||||
sprintf(msg, "%svsync disabled\n", msg);
|
||||
}
|
||||
|
||||
LOG(4, (msg));
|
||||
|
||||
/* read panelsize and currently active outputs */
|
||||
size_outputs = nm_general_output_read();
|
||||
/* we need to wait a bit or the card will mess-up it's register values.. (NM2160) */
|
||||
@ -484,34 +485,6 @@ status_t nm_crtc_dpms(bool display, bool h, bool v)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t nm_crtc_dpms_fetch(bool * display, bool * h, bool * v)
|
||||
{
|
||||
*display = !(ISASEQR(CLKMODE) & 0x20);
|
||||
|
||||
if (si->ps.card_type < NM2200)
|
||||
{
|
||||
/* no full DPMS support */
|
||||
*h = *v = *display;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* full DPMS support for external monitors */
|
||||
//fixme: checkout if so...
|
||||
*h = !(ISAGRPHR(ENSETRESET) & 0x10);
|
||||
*v = !(ISAGRPHR(ENSETRESET) & 0x20);
|
||||
}
|
||||
|
||||
LOG(4,("CTRC: fetched DPMS state: "));
|
||||
if (*display) LOG(4,("display on, "));
|
||||
else LOG(4,("display off, "));
|
||||
if (*h) LOG(4,("hsync enabled, "));
|
||||
else LOG(4,("hsync disabled, "));
|
||||
if (*v) LOG(4,("vsync enabled\n"));
|
||||
else LOG(4,("vsync disabled\n"));
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t nm_crtc_set_display_pitch()
|
||||
{
|
||||
uint32 offset;
|
||||
|
@ -88,7 +88,7 @@ status_t nm_general_powerup()
|
||||
{
|
||||
status_t status;
|
||||
|
||||
LOG(1,("POWERUP: Haiku Neomagic Accelerant 0.12 running.\n"));
|
||||
LOG(1,("POWERUP: Haiku Neomagic Accelerant 0.14 running.\n"));
|
||||
|
||||
/* log VBLANK INT usability status */
|
||||
if (si->ps.int_assigned)
|
||||
|
@ -45,7 +45,6 @@ status_t nm_crtc_center(display_mode target, bool crt_only);
|
||||
status_t nm_crtc_prg_panel(void);
|
||||
|
||||
status_t nm_crtc_dpms(bool, bool, bool);
|
||||
status_t nm_crtc_dpms_fetch(bool*, bool*, bool*);
|
||||
status_t nm_crtc_mem_priority(uint8);
|
||||
|
||||
status_t nm_crtc_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user