[Intel-gfx] [PATCH 2/2] set broadcast RGB mode for HDMI from integrated HDMI output.

Zhenyu Wang zhenyu.z.wang at intel.com
Fri Apr 3 02:53:47 CEST 2009


On 2009.03.25 15:06:37 +0800, Ma Ling wrote:
> construct "creat" and "set" function for broadcast rgb property for integrated hdmi output.
> 
> Signed-off-by: Ma Ling <ling.ma at intel.com>
> ---
>  src/i830_hdmi.c |   80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 80 insertions(+), 0 deletions(-)
> 
> diff --git a/src/i830_hdmi.c b/src/i830_hdmi.c
> index 05aa9ac..ae40eb0 100644
> --- a/src/i830_hdmi.c
> +++ b/src/i830_hdmi.c
> @@ -33,6 +33,7 @@
>  #include "i830.h"
>  #include "xf86Modes.h"
>  #include "i830_display.h"
> +#include "X11/Xatom.h"
>  
>  struct i830_hdmi_priv {
>      uint32_t output_reg;
> @@ -42,6 +43,8 @@ struct i830_hdmi_priv {
>      Bool has_hdmi_sink;
>  };
>  
> +static Atom broadcast_atom;
> +
>  static int
>  i830_hdmi_mode_valid(xf86OutputPtr output, DisplayModePtr mode)
>  {
> @@ -214,7 +217,83 @@ i830_hdmi_destroy (xf86OutputPtr output)
>      }
>  }
>  
> +static void
> +i830_hdmi_create_resources(xf86OutputPtr output)
> +{
> +    ScrnInfoPtr                 pScrn = output->scrn;
> +    I830Ptr                     pI830 = I830PTR(pScrn);
> +    int32_t                     broadcast_range[2];
> +    uint32_t                    data;
> +    int                         err;
> +
> +    /* only R G B are 8bit color mode */
> +    if (pScrn->depth != 24 ||
> +        /* only 965G and G4X platform */
> +        !(IS_I965G(pI830) || IS_G4X(pI830)) ||
> +        /* only TMDS encoding */
> +        !strstr(output->name, "HDMI"))

Looks this's not needed.

> +        return;
> +
> +    broadcast_atom =
> +        MakeAtom("BROADCAST_RGB", sizeof("BROADCAST_RGB") - 1, TRUE);
> +
> +    broadcast_range[0] = 0;
> +    broadcast_range[1] = 1;
> +    err = RRConfigureOutputProperty(output->randr_output,
> +                                    broadcast_atom,
> +                                    FALSE, TRUE, FALSE, 2, broadcast_range);
> +    if (err != 0) {
> +        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> +                   "RRConfigureOutputProperty error, %d\n", err);

	return;

> +    }
> +    /* Set the current value of the broadcast property */
> +    data = 0;
> +    err = RRChangeOutputProperty(output->randr_output,
> +                                 broadcast_atom,
> +                                 XA_INTEGER, 32, PropModeReplace, 1, &data,
> +                                 FALSE, TRUE);
> +    if (err != 0) {
> +        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> +                   "RRChangeOutputProperty error, %d\n", err);

	return;

> +    }
> +}
> +
> +static Bool
> +i830_hdmi_set_property(xf86OutputPtr output, Atom property,
> +                       RRPropertyValuePtr value)
> +{
> +    ScrnInfoPtr             pScrn = output->scrn;
> +    I830Ptr                 pI830 = I830PTR(pScrn);
> +    I830OutputPrivatePtr    intel_output = output->driver_private;
> +    struct i830_hdmi_priv   *dev_priv = intel_output->dev_priv;
> +
> +    if (property == 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;
> +        }
> +
> +        if (val == 1)
> +            OUTREG(dev_priv->output_reg,
> +                   INREG(dev_priv->output_reg) | SDVO_COLOR_NOT_FULL_RANGE);
> +        else if (val == 0)
> +            OUTREG(dev_priv->output_reg,
> +                   INREG(dev_priv->output_reg) & ~SDVO_COLOR_NOT_FULL_RANGE);
> +    }
> +    return TRUE;
> +}
> +
>  static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
> +    .create_resources = i830_hdmi_create_resources,
>      .dpms = i830_hdmi_dpms,
>      .save = i830_hdmi_save,
>      .restore = i830_hdmi_restore,
> @@ -225,6 +304,7 @@ static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
>      .commit = i830_output_commit,
>      .detect = i830_hdmi_detect,
>      .get_modes = i830_ddc_get_modes,
> +    .set_property = i830_hdmi_set_property,
>      .destroy = i830_hdmi_destroy
>  };
>  
> -- 
> 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/20090403/4cd8eaf0/attachment.sig>


More information about the Intel-gfx mailing list