[Intel-gfx] [PATCH] SDVO: use attached display flags for output setup

Eric Anholt eric at anholt.net
Wed Dec 10 06:57:15 CET 2008


On Wed, 2008-12-10 at 11:38 +0800, Zhenyu Wang wrote:
> SDVO encoder's capability flag can't be used to
> determine what current output type is, driver may
> initialize wrong output type for this, e.g chrontel
> 7021 claims both RGB and TV capability, but real
> output depends on board vendor.
> 
> This one trys to use GET_ATTACHED_DISPLAYS command
> to setup output according with current config. Tested
> on one 915G board with chrontel 7021 showed correct
> detect result.
> ---
>  src/i830_sdvo.c |   68 ++++++++++++++++++++++++++++++++++++++++++-------------
>  1 files changed, 52 insertions(+), 16 deletions(-)
> 
> diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
> index 256d16d..f15cb04 100644
> --- a/src/i830_sdvo.c
> +++ b/src/i830_sdvo.c
> @@ -66,6 +66,11 @@ struct i830_sdvo_priv {
>       */
>      struct i830_sdvo_caps caps;
>  
> +    /**
> +     * SDVO devices currently attached by i830_sdvo_get_attached_display()
> +     */
> +    uint16_t attached_output;
> +
>      /** Pixel clock limitations reported by the SDVO device, in kHz */
>      int pixel_clock_min, pixel_clock_max;
>  
> @@ -1450,6 +1455,18 @@ i830_sdvo_dump(ScrnInfoPtr pScrn)
>      }
>  }
>  
> +static Bool
> +i830_sdvo_get_attached_display (xf86OutputPtr output, uint16_t* response)
> +{
> +    uint8_t status;
> +
> +    i830_sdvo_write_cmd(output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0);
> +    status = i830_sdvo_read_response(output, response, 2);
> +    if (status != SDVO_CMD_STATUS_SUCCESS)
> +	return FALSE;
> +    return TRUE;
> +}
> +
>  /**
>   * Asks the SDVO device if any displays are currently connected.
>   *
> @@ -1462,16 +1479,12 @@ i830_sdvo_dump(ScrnInfoPtr pScrn)
>  static xf86OutputStatus
>  i830_sdvo_detect(xf86OutputPtr output)
>  {
> -    uint8_t response[2];
> -    uint8_t status;
> +    uint16_t response;
>  
> -    i830_sdvo_write_cmd(output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0);
> -    status = i830_sdvo_read_response(output, &response, 2);
> -
> -    if (status != SDVO_CMD_STATUS_SUCCESS)
> +    if (i830_sdvo_get_attached_display(output, &response) == FALSE)
>  	return XF86OutputStatusUnknown;
>  
> -    if (response[0] != 0 || response[1] != 0)
> +    if (response != 0)
>  	return XF86OutputStatusConnected;
>      else
>  	return XF86OutputStatusDisconnected;
> @@ -1753,6 +1766,7 @@ i830_sdvo_get_digital_encoding_mode(xf86OutputPtr output)
>  Bool
>  i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
>  {
> +    I830Ptr		    pI830 = I830PTR(pScrn);
>      xf86OutputPtr	    output;
>      I830OutputPrivatePtr    intel_output;
>      struct i830_sdvo_priv   *dev_priv;
> @@ -1866,11 +1880,32 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
>      intel_output->pDDCBus = ddcbus;
>      intel_output->dev_priv = dev_priv;
>  
> -    i830_sdvo_get_capabilities(output, &dev_priv->caps);
> +    if (i830_sdvo_get_capabilities(output, &dev_priv->caps) == FALSE ||
> +	    dev_priv->caps.output_flags == 0)
> +    {
> +	xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_WARNING,
> +		"SDVO%c can't get encoder capability\n",
> +		output_device == SDVOB ? 'B' : 'C');
> +	xf86OutputDestroy (output);
> +	return FALSE;
> +    }
> +
> +    if (i830_sdvo_get_attached_display (output, &dev_priv->attached_output)
> +	    == FALSE) {
> +	xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_WARNING,
> +		"SDVO%c can't get attached displays\n",
> +		output_device == SDVOB ? 'B' : 'C');
> +	xf86OutputDestroy (output);
> +	return FALSE;
> +    } else if (pI830->debug_modes)
> +	xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO,
> +		"SDVO%c attached display 0x%x\n",
> +		output_device == SDVOB ? 'B' : 'C',
> +		dev_priv->attached_output);

So if you start without something attached to your SDVO, it won't be available later on during the server's lifetime?  Seems totally wrong.

--
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081209/e633d06a/attachment.sig>


More information about the Intel-gfx mailing list