diff options
author | Keith Packard <keithp@koto.keithp.com> | 2007-08-28 12:17:15 -0700 |
---|---|---|
committer | Keith Packard <keithp@koto.keithp.com> | 2007-08-28 12:43:36 -0700 |
commit | c6e637cd683dc60567b3b4f69b7f2b4c338c89ea (patch) | |
tree | 53f1912ff4e5a9d00f04419ad75cee2565443175 | |
parent | ddd6053987b9ca9bd3722ddbdfd412a3d8d252cf (diff) |
Limit TV formats to those supported by current connection
-rw-r--r-- | src/i830_exa.c | 2 | ||||
-rw-r--r-- | src/i830_tv.c | 55 | ||||
-rw-r--r-- | src/xvmc/I810XvMC.h | 1 |
3 files changed, 48 insertions, 10 deletions
diff --git a/src/i830_exa.c b/src/i830_exa.c index fa50da0f..273c6260 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -124,7 +124,7 @@ i830_pixmap_tiled(PixmapPtr pPixmap) return FALSE; } -Bool +static Bool i830_exa_pixmap_is_offscreen(PixmapPtr pPixmap) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; diff --git a/src/i830_tv.c b/src/i830_tv.c index c90d41e5..d86e9844 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -1264,14 +1264,13 @@ static const DisplayModeRec reported_modes[] = { * \return TRUE if TV is connected. * \return FALSE if TV is disconnected. */ -static void +static int i830_tv_detect_type (xf86CrtcPtr crtc, xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); I830OutputPrivatePtr intel_output = output->driver_private; - struct i830_tv_priv *dev_priv = intel_output->dev_priv; CARD32 tv_ctl, save_tv_ctl; CARD32 tv_dac, save_tv_dac; int type = TV_TYPE_UNKNOWN; @@ -1337,9 +1336,14 @@ i830_tv_detect_type (xf86CrtcPtr crtc, type = TV_TYPE_NONE; } - dev_priv->type = type; + return type; } +#ifdef RANDR_12_INTERFACE +static int +i830_tv_format_configure_property (xf86OutputPtr output); +#endif + /** * Detect the TV connection. * @@ -1354,17 +1358,26 @@ i830_tv_detect(xf86OutputPtr output) I830OutputPrivatePtr intel_output = output->driver_private; struct i830_tv_priv *dev_priv = intel_output->dev_priv; int dpms_mode; + int type = dev_priv->type; mode = reported_modes[0]; xf86SetModeCrtc (&mode, INTERLACE_HALVE_V); crtc = i830GetLoadDetectPipe (output, &mode, &dpms_mode); if (crtc) { - i830_tv_detect_type (crtc, output); + type = i830_tv_detect_type (crtc, output); i830ReleaseLoadDetectPipe (output, dpms_mode); } - switch (dev_priv->type) { + if (type != dev_priv->type) + { + dev_priv->type = type; +#ifdef RANDR_12_INTERFACE + i830_tv_format_configure_property (output); +#endif + } + + switch (type) { case TV_TYPE_NONE: return XF86OutputStatusDisconnected; case TV_TYPE_UNKNOWN: @@ -1477,6 +1490,32 @@ i830_tv_format_set_property (xf86OutputPtr output) return err == Success; } + +/** + * Configure the TV_FORMAT property to list only supported formats + * + * Unless the connector is component, list only the formats supported by + * svideo and composite + */ + +static int +i830_tv_format_configure_property (xf86OutputPtr output) +{ + I830OutputPrivatePtr intel_output = output->driver_private; + struct i830_tv_priv *dev_priv = intel_output->dev_priv; + Atom current_atoms[NUM_TV_MODES]; + int num_atoms = 0; + int i; + + for (i = 0; i < NUM_TV_MODES; i++) + if (!tv_modes[i].component_only || dev_priv->type == TV_TYPE_COMPONENT) + current_atoms[num_atoms++] = tv_format_name_atoms[i]; + + return RRConfigureOutputProperty(output->randr_output, tv_format_atom, + TRUE, FALSE, FALSE, + num_atoms, (INT32 *) current_atoms); +} + #endif /* RANDR_12_INTERFACE */ static void @@ -1500,10 +1539,8 @@ i830_tv_create_resources(xf86OutputPtr output) strlen (tv_modes[i].name), TRUE); - err = RRConfigureOutputProperty(output->randr_output, tv_format_atom, - TRUE, FALSE, FALSE, - NUM_TV_MODES, (INT32 *) tv_format_name_atoms); - + err = i830_tv_format_configure_property (output); + if (err != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); diff --git a/src/xvmc/I810XvMC.h b/src/xvmc/I810XvMC.h index ba8c792d..dc2cab88 100644 --- a/src/xvmc/I810XvMC.h +++ b/src/xvmc/I810XvMC.h @@ -41,6 +41,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* #define XVMC_DEBUG(x) do {x; }while(0); */ #define XVMC_DEBUG(x) +#include <stdint.h> #include "xf86drm.h" #include "i810_common.h" #include <X11/Xlibint.h> |