diff options
author | Alex Deucher <alex@botch2.com> | 2007-08-05 15:37:04 -0400 |
---|---|---|
committer | Alex Deucher <alex@botch2.com> | 2007-08-05 15:37:04 -0400 |
commit | b4ec3e436afb5bc99ec755cbd96eee9a1ec492a5 (patch) | |
tree | 7c152e750208af3a1ff406b536426868db7f6b6e /src | |
parent | 1fc2a1120e7c05938e2bd72d3c7837ecff8bc9da (diff) |
RADEON: add tv out properties
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon.h | 1 | ||||
-rw-r--r-- | src/radeon_bios.c | 15 | ||||
-rw-r--r-- | src/radeon_output.c | 188 | ||||
-rw-r--r-- | src/radeon_probe.h | 1 | ||||
-rw-r--r-- | src/radeon_tv.c | 2 |
5 files changed, 197 insertions, 10 deletions
diff --git a/src/radeon.h b/src/radeon.h index 432ee89..a8f72fc 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -926,6 +926,7 @@ extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName, RADEONMonitorType DisplayType, int crtc2); extern int RADEONValidateFPModes(xf86OutputPtr output, char **ppModeName, DisplayModePtr *modeList); extern void RADEONSetPitch (ScrnInfoPtr pScrn); +extern void RADEONUpdateHVPosition(xf86OutputPtr output, DisplayModePtr mode); DisplayModePtr RADEONProbeOutputModes(xf86OutputPtr output); diff --git a/src/radeon_bios.c b/src/radeon_bios.c index 4556552..696fee4 100644 --- a/src/radeon_bios.c +++ b/src/radeon_bios.c @@ -550,34 +550,35 @@ Bool RADEONGetTVInfoFromBIOS (xf86OutputPtr output) { if (RADEON_BIOS8(offset + 6) == 'T') { switch (RADEON_BIOS8(offset + 7) & 0xf) { case 1: - radeon_output->tvStd = TV_STD_NTSC; + radeon_output->default_tvStd = TV_STD_NTSC; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Default TV standard: NTSC\n"); break; case 2: - radeon_output->tvStd = TV_STD_PAL; + radeon_output->default_tvStd = TV_STD_PAL; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Default TV standard: PAL\n"); break; case 3: - radeon_output->tvStd = TV_STD_PAL_M; + radeon_output->default_tvStd = TV_STD_PAL_M; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Default TV standard: PAL-M\n"); break; case 4: - radeon_output->tvStd = TV_STD_PAL_60; + radeon_output->default_tvStd = TV_STD_PAL_60; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Default TV standard: PAL-60\n"); break; case 5: - radeon_output->tvStd = TV_STD_NTSC_J; + radeon_output->default_tvStd = TV_STD_NTSC_J; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Default TV standard: NTSC-J\n"); break; case 6: - radeon_output->tvStd = TV_STD_SCART_PAL; + radeon_output->default_tvStd = TV_STD_SCART_PAL; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Default TV standard: SCART-PAL\n"); break; default: - radeon_output->tvStd = TV_STD_NTSC; + radeon_output->default_tvStd = TV_STD_NTSC; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unknown TV standard; defaulting to NTSC\n"); break; } + radeon_output->tvStd = radeon_output->default_tvStd; refclk = (RADEON_BIOS8(offset + 9) >> 2) & 0x3; if (refclk == 0) diff --git a/src/radeon_output.c b/src/radeon_output.c index 8a35556..1bbc73e 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -1125,6 +1125,10 @@ radeon_set_backlight_level(xf86OutputPtr output, int level) static Atom backlight_atom; static Atom rmx_atom; static Atom monitor_type_atom; +static Atom tv_hsize_atom; +static Atom tv_hpos_atom; +static Atom tv_vpos_atom; +static Atom tv_std_atom; #define RADEON_MAX_BACKLIGHT_LEVEL 255 static void @@ -1188,7 +1192,7 @@ radeon_create_resources(xf86OutputPtr output) if (radeon_output->type == OUTPUT_DVI) { if ((info->IsAtomBios && radeon_output->ConnectorType == CONNECTOR_DVI_I_ATOM) || (!info->IsAtomBios && radeon_output->ConnectorType == CONNECTOR_DVI_I)) { - monitor_type_atom = MAKE_ATOM("monitor_type"); + monitor_type_atom = MAKE_ATOM("dvi_monitor_type"); err = RRConfigureOutputProperty(output->randr_output, monitor_type_atom, FALSE, FALSE, FALSE, 0, NULL); @@ -1197,7 +1201,6 @@ radeon_create_resources(xf86OutputPtr output) "RRConfigureOutputProperty error, %d\n", err); } /* Set the current value of the backlight property */ - radeon_output->DVIType = DVI_AUTO; s = "auto"; err = RRChangeOutputProperty(output->randr_output, monitor_type_atom, XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s, @@ -1209,6 +1212,92 @@ radeon_create_resources(xf86OutputPtr output) } } + if (radeon_output->type == OUTPUT_STV || + radeon_output->type == OUTPUT_CTV) { + tv_hsize_atom = MAKE_ATOM("tv_horizontal_size"); + + range[0] = -MAX_H_SIZE; + range[1] = MAX_H_SIZE; + err = RRConfigureOutputProperty(output->randr_output, tv_hsize_atom, + FALSE, TRUE, FALSE, 2, range); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRConfigureOutputProperty error, %d\n", err); + } + data = 0; + err = RRChangeOutputProperty(output->randr_output, tv_hsize_atom, + XA_INTEGER, 32, PropModeReplace, 1, &data, + FALSE, TRUE); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRChangeOutputProperty error, %d\n", err); + } + } + + if (radeon_output->type == OUTPUT_STV || + radeon_output->type == OUTPUT_CTV) { + tv_hpos_atom = MAKE_ATOM("tv_horizontal_position"); + + range[0] = -MAX_H_POSITION; + range[1] = MAX_H_POSITION; + err = RRConfigureOutputProperty(output->randr_output, tv_hpos_atom, + FALSE, TRUE, FALSE, 2, range); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRConfigureOutputProperty error, %d\n", err); + } + data = 0; + err = RRChangeOutputProperty(output->randr_output, tv_hpos_atom, + XA_INTEGER, 32, PropModeReplace, 1, &data, + FALSE, TRUE); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRChangeOutputProperty error, %d\n", err); + } + } + + if (radeon_output->type == OUTPUT_STV || + radeon_output->type == OUTPUT_CTV) { + tv_vpos_atom = MAKE_ATOM("tv_vertical_position"); + + range[0] = -MAX_V_POSITION; + range[1] = MAX_V_POSITION; + err = RRConfigureOutputProperty(output->randr_output, tv_vpos_atom, + FALSE, TRUE, FALSE, 2, range); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRConfigureOutputProperty error, %d\n", err); + } + data = 0; + err = RRChangeOutputProperty(output->randr_output, tv_vpos_atom, + XA_INTEGER, 32, PropModeReplace, 1, &data, + FALSE, TRUE); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRChangeOutputProperty error, %d\n", err); + } + } + + if (radeon_output->type == OUTPUT_STV || + radeon_output->type == OUTPUT_CTV) { + tv_std_atom = MAKE_ATOM("tv_standard"); + + err = RRConfigureOutputProperty(output->randr_output, tv_std_atom, + FALSE, FALSE, FALSE, 0, NULL); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRConfigureOutputProperty error, %d\n", err); + } + /* Set the current value of the backlight property */ + s = "default"; + err = RRChangeOutputProperty(output->randr_output, tv_std_atom, + XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s, + FALSE, FALSE); + if (err != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "RRChangeOutputProperty error, %d\n", err); + } + } } static Bool @@ -1271,6 +1360,100 @@ radeon_set_property(xf86OutputPtr output, Atom property, return TRUE; } return FALSE; + } else if (property == tv_hsize_atom) { + if (value->type != XA_INTEGER || + value->format != 32 || + value->size != 1) { + return FALSE; + } + + val = *(INT32 *)value->data; + if (val < -MAX_H_SIZE || val > MAX_H_SIZE) + return FALSE; + + radeon_output->hSize = val; + /*RADEONUpdateHVPosition(output, NULL);*/ + return TRUE; + } else if (property == tv_hpos_atom) { + if (value->type != XA_INTEGER || + value->format != 32 || + value->size != 1) { + return FALSE; + } + + val = *(INT32 *)value->data; + if (val < -MAX_H_POSITION || val > MAX_H_POSITION) + return FALSE; + + radeon_output->hPos = val; + /*RADEONUpdateHVPosition(output, NULL);*/ + return TRUE; + } else if (property == tv_vpos_atom) { + if (value->type != XA_INTEGER || + value->format != 32 || + value->size != 1) { + return FALSE; + } + + val = *(INT32 *)value->data; + if (val < -MAX_H_POSITION || val > MAX_H_POSITION) + return FALSE; + + radeon_output->vPos = val; + /*RADEONUpdateHVPosition(output, NULL);*/ + return TRUE; + } else if (property == tv_std_atom) { + const char *s; + if (value->type != XA_STRING || value->format != 8) + return FALSE; + s = (char*)value->data; + if (value->size == strlen("default") && !strncmp("default", s, strlen("default"))) { + radeon_output->tvStd = radeon_output->default_tvStd; + return TRUE; + } else if (value->size == strlen("ntsc") && !strncmp("ntsc", s, strlen("ntsc"))) { + if (radeon_output->SupportedTVStds & TV_STD_NTSC) { + radeon_output->tvStd = TV_STD_NTSC; + return TRUE; + } else { + return FALSE; + } + } else if (value->size == strlen("pal") && !strncmp("pal", s, strlen("pal"))) { + if (radeon_output->SupportedTVStds & TV_STD_PAL) { + radeon_output->tvStd = TV_STD_PAL; + return TRUE; + } else { + return FALSE; + } + } else if (value->size == strlen("pal-m") && !strncmp("pal-m", s, strlen("pal-m"))) { + if (radeon_output->SupportedTVStds & TV_STD_PAL_M) { + radeon_output->tvStd = TV_STD_PAL_M; + return TRUE; + } else { + return FALSE; + } + } else if (value->size == strlen("pal-60") && !strncmp("pal-60", s, strlen("pal-60"))) { + if (radeon_output->SupportedTVStds & TV_STD_PAL_60) { + radeon_output->tvStd = TV_STD_PAL_60; + return TRUE; + } else { + return FALSE; + } + } else if (value->size == strlen("ntsc-j") && !strncmp("ntsc-j", s, strlen("ntsc-j"))) { + if (radeon_output->SupportedTVStds & TV_STD_NTSC_J) { + radeon_output->tvStd = TV_STD_NTSC_J; + return TRUE; + } else { + return FALSE; + } + } else if (value->size == strlen("scart-pal") && !strncmp("scart-pal", s, strlen("scart-pal"))) { + if (radeon_output->SupportedTVStds & TV_STD_SCART_PAL) { + radeon_output->tvStd = TV_STD_SCART_PAL; + return TRUE; + } else { + return FALSE; + } + } + return FALSE; } return TRUE; @@ -1667,6 +1850,7 @@ RADEONGetTVInfo(xf86OutputPtr output) if (RADEONGetTVInfoFromBIOS(output)) return; /* set some reasonable defaults */ + radeon_output->default_tvStd = TV_STD_NTSC; radeon_output->tvStd = TV_STD_NTSC; radeon_output->TVRefClk = 27.000000000; radeon_output->SupportedTVStds = TV_STD_NTSC | TV_STD_PAL; diff --git a/src/radeon_probe.h b/src/radeon_probe.h index 27b78cc..d79e7ad 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -197,6 +197,7 @@ typedef struct _RADEONOutputPrivateRec { int DotClock; RADEONTMDSPll tmds_pll[4]; /* TV out */ + TVStd default_tvStd; TVStd tvStd; int hPos; int vPos; diff --git a/src/radeon_tv.c b/src/radeon_tv.c index 3c12dfd..db5288a 100644 --- a/src/radeon_tv.c +++ b/src/radeon_tv.c @@ -556,7 +556,7 @@ void RADEONInitTVRegisters(xf86OutputPtr output, RADEONSavePtr save, /* Set hw registers for a new h/v position & h size */ -static void RADEONUpdateHVPosition(xf86OutputPtr output, DisplayModePtr mode) +void RADEONUpdateHVPosition(xf86OutputPtr output, DisplayModePtr mode) { ScrnInfoPtr pScrn = output->scrn; RADEONInfoPtr info = RADEONPTR(pScrn); |