Fix a crash in zaphod mode if one screen is not present.

tested by jasper@, shadchin@. ok shadchin@.
This commit is contained in:
matthieu 2011-02-08 20:50:35 +00:00
parent fe4a39444e
commit eccb1b24fc
3 changed files with 7 additions and 1 deletions

View File

@ -1628,6 +1628,7 @@ radeon_add_encoder(ScrnInfoPtr pScrn, uint32_t encoder_id, uint32_t device_suppo
for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
if ((info->encoders[i] != NULL) && (info->encoders[i]->encoder_id == encoder_id)) {
info->encoders[device_index] = info->encoders[i];
info->encoders[device_index]->ref_count++;
switch (encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
@ -1653,6 +1654,7 @@ radeon_add_encoder(ScrnInfoPtr pScrn, uint32_t encoder_id, uint32_t device_suppo
info->encoders[device_index] = (radeon_encoder_ptr)xcalloc(1,sizeof(radeon_encoder_rec));
if (info->encoders[device_index] != NULL) {
info->encoders[device_index]->ref_count++;
info->encoders[device_index]->encoder_id = encoder_id;
info->encoders[device_index]->devices = 0;
info->encoders[device_index]->dev_priv = NULL;

View File

@ -383,6 +383,9 @@ static void RADEONFreeRec(ScrnInfoPtr pScrn)
for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
if (info->encoders[i]) {
info->encoders[i]->ref_count--;
if (info->encoders[i]->ref_count != 0)
continue;
if (info->encoders[i]->dev_priv) {
xfree(info->encoders[i]->dev_priv);
info->encoders[i]->dev_priv = NULL;
@ -3403,7 +3406,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
info->MaxSurfaceWidth);
info->allowColorTiling = FALSE;
}
if (info->allowColorTiling) {
if (info->allowColorTiling && pScrn->currentMode != NULL) {
info->tilingEnabled = (pScrn->currentMode->Flags & (V_DBLSCAN | V_INTERLACE)) ? FALSE : TRUE;
}

View File

@ -164,6 +164,7 @@ typedef struct _RADEONCrtcPrivateRec {
typedef struct _radeon_encoder {
uint16_t encoder_id;
int devices;
int ref_count;
void *dev_priv;
} radeon_encoder_rec, *radeon_encoder_ptr;