Fix a crash in zaphod mode if one screen is not present.
tested by jasper@, shadchin@. ok shadchin@.
This commit is contained in:
parent
fe4a39444e
commit
eccb1b24fc
@ -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++) {
|
for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
|
||||||
if ((info->encoders[i] != NULL) && (info->encoders[i]->encoder_id == encoder_id)) {
|
if ((info->encoders[i] != NULL) && (info->encoders[i]->encoder_id == encoder_id)) {
|
||||||
info->encoders[device_index] = info->encoders[i];
|
info->encoders[device_index] = info->encoders[i];
|
||||||
|
info->encoders[device_index]->ref_count++;
|
||||||
switch (encoder_id) {
|
switch (encoder_id) {
|
||||||
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
|
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
|
||||||
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
|
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));
|
info->encoders[device_index] = (radeon_encoder_ptr)xcalloc(1,sizeof(radeon_encoder_rec));
|
||||||
if (info->encoders[device_index] != NULL) {
|
if (info->encoders[device_index] != NULL) {
|
||||||
|
info->encoders[device_index]->ref_count++;
|
||||||
info->encoders[device_index]->encoder_id = encoder_id;
|
info->encoders[device_index]->encoder_id = encoder_id;
|
||||||
info->encoders[device_index]->devices = 0;
|
info->encoders[device_index]->devices = 0;
|
||||||
info->encoders[device_index]->dev_priv = NULL;
|
info->encoders[device_index]->dev_priv = NULL;
|
||||||
|
@ -383,6 +383,9 @@ static void RADEONFreeRec(ScrnInfoPtr pScrn)
|
|||||||
|
|
||||||
for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
|
for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
|
||||||
if (info->encoders[i]) {
|
if (info->encoders[i]) {
|
||||||
|
info->encoders[i]->ref_count--;
|
||||||
|
if (info->encoders[i]->ref_count != 0)
|
||||||
|
continue;
|
||||||
if (info->encoders[i]->dev_priv) {
|
if (info->encoders[i]->dev_priv) {
|
||||||
xfree(info->encoders[i]->dev_priv);
|
xfree(info->encoders[i]->dev_priv);
|
||||||
info->encoders[i]->dev_priv = NULL;
|
info->encoders[i]->dev_priv = NULL;
|
||||||
@ -3403,7 +3406,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
|
|||||||
info->MaxSurfaceWidth);
|
info->MaxSurfaceWidth);
|
||||||
info->allowColorTiling = FALSE;
|
info->allowColorTiling = FALSE;
|
||||||
}
|
}
|
||||||
if (info->allowColorTiling) {
|
if (info->allowColorTiling && pScrn->currentMode != NULL) {
|
||||||
info->tilingEnabled = (pScrn->currentMode->Flags & (V_DBLSCAN | V_INTERLACE)) ? FALSE : TRUE;
|
info->tilingEnabled = (pScrn->currentMode->Flags & (V_DBLSCAN | V_INTERLACE)) ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ typedef struct _RADEONCrtcPrivateRec {
|
|||||||
typedef struct _radeon_encoder {
|
typedef struct _radeon_encoder {
|
||||||
uint16_t encoder_id;
|
uint16_t encoder_id;
|
||||||
int devices;
|
int devices;
|
||||||
|
int ref_count;
|
||||||
void *dev_priv;
|
void *dev_priv;
|
||||||
} radeon_encoder_rec, *radeon_encoder_ptr;
|
} radeon_encoder_rec, *radeon_encoder_ptr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user