[Intel-gfx] [PATCH 1/2] set hdtv broadcast mode for HDMI and TMDS output
Zhenyu Wang
zhenyu.z.wang at intel.com
Mon Mar 23 03:42:32 CET 2009
On 2009.03.16 10:34:14 +0800, Ma Ling wrote:
> enabling hdtv broadcast color mode by creating sdvo-hdmi/tmds output property.
>
> Signed-off-by: Ma Ling <ling.ma at intel.com>
> ---
> src/i810_reg.h | 1 +
> src/i830_sdvo.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 110 insertions(+), 0 deletions(-)
>
> diff --git a/src/i810_reg.h b/src/i810_reg.h
> index bc462fa..6ff1858 100644
> --- a/src/i810_reg.h
> +++ b/src/i810_reg.h
> @@ -1300,6 +1300,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> #define SDVO_ENCODING_HDMI (0x2 << 10)
> /** Requird for HDMI operation */
> #define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
> +#define SDVO_COLOR_RANGE (1 << 8)
SDVO_COLOR_RANGE is vague, how about SDVO_COLOR_FULL_RANGE?
> #define SDVO_BORDER_ENABLE (1 << 7)
> #define SDVO_AUDIO_ENABLE (1 << 6)
> /** New with 965, default is to be set */
> diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
> index 254b866..bf1b085 100644
> --- a/src/i830_sdvo.c
> +++ b/src/i830_sdvo.c
> @@ -49,6 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
> #include "i830_display.h"
> #include "i810_reg.h"
> #include "i830_sdvo_regs.h"
> +#include "X11/Xatom.h"
>
> /** SDVO driver private structure. */
> struct i830_sdvo_priv {
> @@ -118,6 +119,7 @@ struct i830_sdvo_priv {
> struct i830_sdvo_dtd save_input_dtd_1, save_input_dtd_2;
> struct i830_sdvo_dtd save_output_dtd[16];
> uint32_t save_SDVOX;
> + Atom broadcast_atom;
> /** @} */
> };
No private for current color range value?
Atom can be static like for other outputs.
>
> @@ -1919,7 +1921,112 @@ i830_sdvo_get_crtc(xf86OutputPtr output)
> }
> #endif
>
> +static void
> +i830_sdvo_create_resources(xf86OutputPtr output)
> +{
> + ScrnInfoPtr pScrn = output->scrn;
> + I830OutputPrivatePtr intel_output = output->driver_private;
> + struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
> + int32_t broadcast_range[2];
> + uint32_t data;
> + int err;
> +
> + dev_priv->broadcast_atom =
> + MakeAtom("BROADCAST_RGB", sizeof("BROADCAST_RGB")-1, TRUE);
> +
> + broadcast_range[0] = 0;
> + broadcast_range[1] = 1;
> + err = RRConfigureOutputProperty(output->randr_output,
> + dev_priv->broadcast_atom,
> + FALSE, TRUE, FALSE, 2, broadcast_range);
> + if (err != 0) {
> + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> + "RRConfigureOutputProperty error, %d\n", err);
> + }
> + /* Set the current value of the broadcast property */
> + data = 0;
> + err = RRChangeOutputProperty(output->randr_output,
> + dev_priv->broadcast_atom,
> + XA_INTEGER, 32, PropModeReplace, 1, &data,
> + FALSE, TRUE);
> + if (err != 0) {
> + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> + "RRChangeOutputProperty error, %d\n", err);
> + }
> +}
> +
> +static Bool
> +i830_sdvo_get_property(xf86OutputPtr output, Atom property)
> +{
> + ScrnInfoPtr pScrn = output->scrn;
> + I830Ptr pI830 = I830PTR(pScrn);
> + I830OutputPrivatePtr intel_output = output->driver_private;
> + struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
> + int ret;
> +
> + if (property == dev_priv->broadcast_atom) {
> + uint32_t val = 0;
> +
> + if ((INREG(dev_priv->output_device) & SDVO_COLOR_RANGE))
> + val = 1;
> +
> + ret = RRChangeOutputProperty(output->randr_output,
> + dev_priv->broadcast_atom,
> + XA_INTEGER, 32, PropModeReplace, 1, &val,
> + FALSE, TRUE);
> + if (ret != Success)
> + return FALSE;
> + }
> + return TRUE;
> +}
Will the color range change without driver knowledge? I don't think so.
I think we can simply use a private value, which has the current setting and
don't need get_property.
> +
> +static Bool
> +i830_sdvo_set_property(xf86OutputPtr output, Atom property,
> + RRPropertyValuePtr value)
> +{
> + ScrnInfoPtr pScrn = output->scrn;
> + I830Ptr pI830 = I830PTR(pScrn);
> + I830OutputPrivatePtr intel_output = output->driver_private;
> + struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
> +
> + if (property == dev_priv->broadcast_atom) {
> + uint32_t val;
> +
> + if (value->type != XA_INTEGER || value->format != 32 ||
> + value->size != 1)
> + {
> + return FALSE;
> + }
> +
> + val = *(INT32 *)value->data;
> + if (val < 0 || val > 1)
> + {
> + return FALSE;
> + }
> +
> + /* only R G B are 8bit color mode */
> + if (pScrn->depth != 24 ||
> + /* only DevCL and DevCTG */
> + !(IS_I965G(pI830) || IS_G4X(pI830)) ||
> + /* only TMDS encoding */
> + !strstr(output->name, "TMDS") && !strstr(output->name, "HDMI")) {
> + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> + "Failed to Set Broadcast Color \n");
> + return FALSE;
> + }
Should this be made ahead to check if we want to create color range property or not?
> +
> + if (val == 1)
> + OUTREG(dev_priv->output_device,
> + INREG(dev_priv->output_device) | SDVO_COLOR_RANGE);
> + else if (val == 0)
> + OUTREG(dev_priv->output_device,
> + INREG(dev_priv->output_device) & ~SDVO_COLOR_RANGE);
> + }
> + return TRUE;
> +}
> +
> static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
> + .create_resources = i830_sdvo_create_resources,
> .dpms = i830_sdvo_dpms,
> .save = i830_sdvo_save,
> .restore = i830_sdvo_restore,
> @@ -1930,6 +2037,8 @@ static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
> .commit = i830_output_commit,
> .detect = i830_sdvo_detect,
> .get_modes = i830_sdvo_get_modes,
> + .set_property = i830_sdvo_set_property,
> + .get_property = i830_sdvo_get_property,
> .destroy = i830_sdvo_destroy,
> #ifdef RANDR_GET_CRTC_INTERFACE
> .get_crtc = i830_sdvo_get_crtc,
> --
> 1.5.4.4
>
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090323/ae8ccef5/attachment.sig>
More information about the Intel-gfx
mailing list