[PATCH r128 3/5] Remove R128ConnectorType and R128BIOSConnector

Alex Deucher alexdeucher at gmail.com
Wed Jul 23 09:14:20 PDT 2014


On Tue, Jul 22, 2014 at 5:50 AM, Connor Behan <connor.behan at gmail.com> wrote:
> In the radeon UMS driver these make sense because there are many types
> of radeon cards and new ones keep coming out. With r128 on the other
> hand, there are only three types of cards (VGA only, DVI only and
> Mobility). The extra organization that these data structures allow is
> not necessary.

There are basically 3 encoders on r128 hardware:
- DAC
- TMDS
- LVDS

I'm not sure if there were any cards with DVI-I connectors (combined
DAC and TMDS) rather than just DVI-D or VGA, but if so, you may need
special handling for that.  E.g., determine from the edid whether to
use the DAC or TMDS encoder.

>
> Signed-off-by: Connor Behan <connor.behan at gmail.com>
> ---
>  src/r128.h        |   1 -
>  src/r128_output.c | 148 +++++++++++++++++++-----------------------------------
>  src/r128_probe.h  |  16 ------
>  3 files changed, 53 insertions(+), 112 deletions(-)
>
> diff --git a/src/r128.h b/src/r128.h
> index 6df1b51..d8748b7 100644
> --- a/src/r128.h
> +++ b/src/r128.h
> @@ -504,7 +504,6 @@ typedef struct {
>      Bool              DDC;
>
>      Bool              VGAAccess;
> -    R128BIOSConnector BiosConnector[R128_MAX_BIOS_CONNECTOR];
>
>      /****** Added for dualhead support *******************/
>      BOOL              IsSecondary;  /* second Screen */
> diff --git a/src/r128_output.c b/src/r128_output.c
> index 7bb2e2a..1d44971 100644
> --- a/src/r128_output.c
> +++ b/src/r128_output.c
> @@ -375,133 +375,91 @@ static Bool R128I2CInit(xf86OutputPtr output, I2CBusPtr *bus_ptr, char *name)
>      return TRUE;
>  }
>
> -void R128SetOutputType(ScrnInfoPtr pScrn, R128OutputPrivatePtr r128_output)
> -{
> -    R128OutputType output = OUTPUT_NONE;
> -
> -    switch (r128_output->ConnectorType) {
> -    case CONNECTOR_VGA:
> -        output = OUTPUT_VGA;
> -        break;
> -    case CONNECTOR_LVDS:
> -        output = OUTPUT_LVDS;
> -        break;
> -    case CONNECTOR_DVI_D:
> -    case CONNECTOR_DVI_I:
> -    case CONNECTOR_DVI_A:
> -        output = OUTPUT_DVI;
> -        break;
> -    default:
> -        output = OUTPUT_NONE;
> -    }
> -
> -    r128_output->type = output;
> -}
> -
> -void R128SetupGenericConnectors(ScrnInfoPtr pScrn)
> +void R128SetupGenericConnectors(ScrnInfoPtr pScrn, R128OutputType *otypes)
>  {
>      R128InfoPtr info    = R128PTR(pScrn);
>      R128EntPtr pR128Ent = R128EntPriv(pScrn);
>
>      if (!pR128Ent->HasCRTC2 && !info->isDFP) {
> -        info->BiosConnector[0].ConnectorType = CONNECTOR_VGA;
> -        info->BiosConnector[0].valid = TRUE;
> +        otypes[0] = OUTPUT_VGA;
>          return;
>      } else if (!pR128Ent->HasCRTC2) {
> -        info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_D;
> -       info->BiosConnector[0].valid = TRUE;
> +        otypes[0] = OUTPUT_DVI;
>         return;
>      }
>
> -    info->BiosConnector[0].ConnectorType = CONNECTOR_LVDS;
> -    info->BiosConnector[0].valid = TRUE;
> -
> -    info->BiosConnector[1].ConnectorType = CONNECTOR_VGA;
> -    info->BiosConnector[1].valid = TRUE;
> +    otypes[0] = OUTPUT_LVDS;
> +    otypes[1] = OUTPUT_VGA;
>  }
>
>  Bool R128SetupConnectors(ScrnInfoPtr pScrn)
>  {
>      R128InfoPtr info    = R128PTR(pScrn);
>      R128EntPtr pR128Ent = R128EntPriv(pScrn);
> -    xf86OutputPtr output;
> +
> +    R128OutputType otypes[R128_MAX_BIOS_CONNECTOR];
> +    xf86OutputPtr  output;
>      int num_vga = 0;
>      int num_dvi = 0;
>      int i;
>
> -    for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
> -        info->BiosConnector[i].valid = FALSE;
> -        info->BiosConnector[i].ConnectorType = CONNECTOR_NONE;
> -    }
> -
>      /* XXX: Can we make R128GetConnectorInfoFromBIOS()? */
> -    R128SetupGenericConnectors(pScrn);
> +    R128SetupGenericConnectors(pScrn, otypes);
>
>      for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
> -        if (info->BiosConnector[i].valid) {
> -            if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D) ||
> -                (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I) ||
> -                (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_A)) {
> -                num_dvi++;
> -            } else if (info->BiosConnector[i].ConnectorType == CONNECTOR_VGA) {
> -                num_vga++;
> -            }
> -        }
> +        if (otypes[i] == OUTPUT_VGA)
> +            num_vga++;
> +        else if (otypes[i] == OUTPUT_DVI)
> +            num_dvi++;
>      }
>
>      for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
> -        if (info->BiosConnector[i].valid) {
> -           R128I2CBusRec i2c;
> -            R128OutputPrivatePtr r128_output;
> -            R128ConnectorType conntype = info->BiosConnector[i].ConnectorType;
> +        if (otypes[i] == OUTPUT_NONE) continue;
>
> -            if (conntype == CONNECTOR_NONE)
> -                continue;
> +       R128I2CBusRec i2c;
> +        R128OutputPrivatePtr r128_output;
>
> -            r128_output = xnfcalloc(sizeof(R128OutputPrivateRec), 1);
> -            if (!r128_output) return FALSE;
> +        r128_output = xnfcalloc(sizeof(R128OutputPrivateRec), 1);
> +        if (!r128_output) return FALSE;
>
> -            r128_output->MonType = MT_UNKNOWN;
> -            r128_output->ConnectorType = conntype;
> -            r128_output->num = i;
> +        r128_output->MonType = MT_UNKNOWN;
> +        r128_output->type = otypes[i];
> +        r128_output->num = i;
>
> -            if (conntype == CONNECTOR_LVDS) {
> -                output = R128OutputCreate(pScrn, "LVDS", 0);
> -            } else if (conntype == CONNECTOR_VGA) {
> -                output = R128OutputCreate(pScrn, "VGA-%d", --num_vga);
> -            } else {
> -                output = R128OutputCreate(pScrn, "DVI-%d", --num_dvi);
> -            }
> +        if (otypes[i] == OUTPUT_LVDS) {
> +            output = R128OutputCreate(pScrn, "LVDS", 0);
> +        } else if (otypes[i] == OUTPUT_VGA) {
> +            output = R128OutputCreate(pScrn, "VGA-%d", --num_vga);
> +        } else {
> +            output = R128OutputCreate(pScrn, "DVI-%d", --num_dvi);
> +        }
>
> -            if (!output) return FALSE;
> -            output->interlaceAllowed = TRUE;
> -            output->doubleScanAllowed = TRUE;
> -            output->driver_private = r128_output;
> -           output->possible_clones = 0;
> -           if (conntype == CONNECTOR_LVDS || !pR128Ent->HasCRTC2)
> -               output->possible_crtcs = 1;
> -           else
> -               output->possible_crtcs = 2;
> -
> -            if (conntype != CONNECTOR_LVDS && info->DDC) {
> -               i2c.ddc_reg      = R128_GPIO_MONID;
> -               i2c.put_clk_mask = R128_GPIO_MONID_EN_3;
> -               i2c.get_clk_mask = R128_GPIO_MONID_Y_3;
> -               if (conntype == CONNECTOR_VGA) {
> -                   i2c.put_data_mask = R128_GPIO_MONID_EN_1;
> -                   i2c.get_data_mask = R128_GPIO_MONID_Y_1;
> -               } else {
> -                   i2c.put_data_mask = R128_GPIO_MONID_EN_0;
> -                   i2c.get_data_mask = R128_GPIO_MONID_Y_0;
> -               }
> -               r128_output->ddc_i2c = i2c;
> -               R128I2CInit(output, &r128_output->pI2CBus, output->name);
> -           } else if (conntype == CONNECTOR_LVDS) {
> -                r128_output->PanelXRes = info->PanelXRes;
> -                r128_output->PanelYRes = info->PanelYRes;
> +        if (!output) return FALSE;
> +        output->interlaceAllowed = TRUE;
> +        output->doubleScanAllowed = TRUE;
> +        output->driver_private = r128_output;
> +       output->possible_clones = 0;
> +       if (otypes[i] == OUTPUT_LVDS || !pR128Ent->HasCRTC2)
> +           output->possible_crtcs = 1;
> +       else
> +           output->possible_crtcs = 2;

possible_crtcs is a mask as I recall.  Shouldn't you be setting it to
3 (crtc1 or 2) or did you want to specifically limit it to crtc2?


> +
> +        if (otypes[i] != OUTPUT_LVDS && info->DDC) {
> +            i2c.ddc_reg      = R128_GPIO_MONID;
> +            i2c.put_clk_mask = R128_GPIO_MONID_EN_3;
> +            i2c.get_clk_mask = R128_GPIO_MONID_Y_3;
> +            if (otypes[i] == OUTPUT_VGA) {
> +                i2c.put_data_mask = R128_GPIO_MONID_EN_1;
> +                i2c.get_data_mask = R128_GPIO_MONID_Y_1;
> +            } else {
> +                i2c.put_data_mask = R128_GPIO_MONID_EN_0;
> +                i2c.get_data_mask = R128_GPIO_MONID_Y_0;
>              }
> -
> -            R128SetOutputType(pScrn, r128_output);
> +            r128_output->ddc_i2c = i2c;
> +            R128I2CInit(output, &r128_output->pI2CBus, output->name);
> +        } else if (otypes[i] == OUTPUT_LVDS) {
> +            r128_output->PanelXRes = info->PanelXRes;
> +            r128_output->PanelYRes = info->PanelYRes;
>          }
>      }
>
> diff --git a/src/r128_probe.h b/src/r128_probe.h
> index 433463b..fef210d 100644
> --- a/src/r128_probe.h
> +++ b/src/r128_probe.h
> @@ -112,16 +112,6 @@ typedef enum
>
>  typedef enum
>  {
> -    CONNECTOR_NONE,
> -    CONNECTOR_VGA,
> -    CONNECTOR_DVI_I,
> -    CONNECTOR_DVI_D,
> -    CONNECTOR_DVI_A,
> -    CONNECTOR_LVDS
> -} R128ConnectorType;
> -
> -typedef enum
> -{
>      OUTPUT_NONE,
>      OUTPUT_VGA,
>      OUTPUT_DVI,
> @@ -144,15 +134,9 @@ typedef struct _R128CrtcPrivateRec {
>      uint8_t lut_r[256], lut_g[256], lut_b[256];
>  } R128CrtcPrivateRec, *R128CrtcPrivatePtr;
>
> -typedef struct {
> -    R128ConnectorType ConnectorType;
> -    Bool valid;
> -} R128BIOSConnector;
> -
>  typedef struct _R128OutputPrivateRec {
>      int num;
>      R128OutputType type;
> -    R128ConnectorType ConnectorType;
>      R128MonitorType MonType;
>      I2CBusPtr pI2CBus;
>      R128I2CBusRec ddc_i2c;
> --
> 2.0.0
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati


More information about the xorg-driver-ati mailing list