unbork fallout from newlock2 merge:

- reinitializing video after X exits works again
- backlight levels should be right again
This commit is contained in:
macallan 2007-08-03 05:40:47 +00:00
parent bb96a008ca
commit 8907dfdbdf
2 changed files with 33 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: radeonfb.c,v 1.16 2007/08/03 05:02:23 macallan Exp $ */
/* $NetBSD: radeonfb.c,v 1.17 2007/08/03 05:40:47 macallan Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.16 2007/08/03 05:02:23 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.17 2007/08/03 05:40:47 macallan Exp $");
#define RADEONFB_DEFAULT_DEPTH 32
@ -194,7 +194,6 @@ int radeon_debug = 1;
#ifndef RADEON_DEFAULT_MODE
/* any reasonably modern display should handle this */
#define RADEON_DEFAULT_MODE "1024x768x60"
//#define RADEON_DEFAULT_MODE "1280x1024x60"
#endif
const char *radeonfb_default_mode = RADEON_DEFAULT_MODE;
@ -445,6 +444,8 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux)
aprint_naive("\n");
aprint_normal(": %s\n", sc->sc_devinfo);
DPRINTF((prop_dictionary_externalize(device_properties(dev))));
KASSERT(radeonfb_devices[i].devid != 0);
sc->sc_pt = pa->pa_tag;
sc->sc_iot = pa->pa_iot;
@ -493,6 +494,22 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux)
break;
}
if ((sc->sc_family == RADEON_RV200) ||
(sc->sc_family == RADEON_RV250) ||
(sc->sc_family == RADEON_RV280) ||
(sc->sc_family == RADEON_RV350)) {
int inverted = 0;
/* backlight level is linear */
DPRINTF(("found RV* chip, backlight is supposedly linear\n"));
prop_dictionary_get_bool(device_properties(&sc->sc_dev),
"backlight_level_reverted", &inverted);
if (inverted) {
DPRINTF(("nope, it's inverted\n"));
sc->sc_flags |= RFB_INV_BLIGHT;
}
} else
sc->sc_flags |= RFB_INV_BLIGHT;
/*
* XXX: to support true multihead, this must change.
*/
@ -962,6 +979,8 @@ radeonfb_ioctl(void *v, void *vs,
dp->rd_wsmode = *(int *)d;
if ((dp->rd_wsmode == WSDISPLAYIO_MODE_EMUL) &&
(dp->rd_vd.active)) {
radeonfb_engine_init(dp);
radeonfb_modeswitch(dp);
vcons_redraw_screen(dp->rd_vd.active);
}
}
@ -3355,6 +3374,12 @@ radeonfb_pickres(struct radeonfb_display *dp, uint16_t *x, uint16_t *y,
}
}
/*
* backlight levels are linear on:
* - RV200, RV250, RV280, RV350
* - but NOT on PowerBook4,3 6,3 6,5
* according to Linux' radeonfb
*/
/* Get the current backlight level for the display. */
@ -3374,9 +3399,8 @@ radeonfb_get_backlight(struct radeonfb_display *dp)
* On some chips, we should negate the backlight level.
* XXX Find out on which chips.
*/
#ifdef RADEONFB_BACKLIGHT_NEGATED
if (dp->rd_softc->sc_flags & RFB_INV_BLIGHT)
level = RADEONFB_BACKLIGHT_MAX - level;
#endif /* RADEONFB_BACKLIGHT_NEGATED */
splx(s);
@ -3402,11 +3426,10 @@ radeonfb_set_backlight(struct radeonfb_display *dp, int level)
sc = dp->rd_softc;
/* On some chips, we should negate the backlight level. */
#ifdef RADEONFB_BACKLIGHT_NEGATED
if (dp->rd_softc->sc_flags & RFB_INV_BLIGHT) {
rlevel = RADEONFB_BACKLIGHT_MAX - level;
#else
} else
rlevel = level;
#endif /* RADEONFB_BACKLIGHT_NEGATED */
callout_stop(&dp->rd_bl_lvds_co);
radeonfb_engine_idle(sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: radeonfbvar.h,v 1.5 2007/02/09 21:55:27 ad Exp $ */
/* $NetBSD: radeonfbvar.h,v 1.6 2007/08/03 05:40:47 macallan Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -303,6 +303,7 @@ struct radeonfb_softc {
#define RFB_R300 (1 << 5) /* R300 variants -- newer parts */
#define RFB_RV100 (1 << 6) /* RV100 variants -- previous gen */
#define RFB_ATOM (1 << 7) /* ATOM bios */
#define RFB_INV_BLIGHT (1 << 8) /* backlight level inverted */
#define IS_MOBILITY(sc) ((sc)->sc_flags & RFB_MOB)
#define HAS_CRTC2(sc) (((sc)->sc_flags & RFB_NCRTC2) == 0)