summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
Diffstat (limited to 'driver')
-rw-r--r--driver/xf86-video-ati/src/radeon.h3
-rw-r--r--driver/xf86-video-ati/src/radeon_atombios.c2
-rw-r--r--driver/xf86-video-ati/src/radeon_dri.c33
-rw-r--r--driver/xf86-video-ati/src/radeon_driver.c14
-rw-r--r--driver/xf86-video-ati/src/radeon_output.c2
-rw-r--r--driver/xf86-video-ati/src/radeon_probe.h1
6 files changed, 16 insertions, 39 deletions
diff --git a/driver/xf86-video-ati/src/radeon.h b/driver/xf86-video-ati/src/radeon.h
index ce9508c33..c41e11157 100644
--- a/driver/xf86-video-ati/src/radeon.h
+++ b/driver/xf86-video-ati/src/radeon.h
@@ -515,9 +515,6 @@ struct radeon_dri {
drm_handle_t fbHandle;
- drmSize registerSize;
- drm_handle_t registerHandle;
-
drmSize pciSize;
drm_handle_t pciMemHandle;
unsigned char *PCI; /* Map */
diff --git a/driver/xf86-video-ati/src/radeon_atombios.c b/driver/xf86-video-ati/src/radeon_atombios.c
index 207783b01..6cc3daa8d 100644
--- a/driver/xf86-video-ati/src/radeon_atombios.c
+++ b/driver/xf86-video-ati/src/radeon_atombios.c
@@ -1805,6 +1805,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:
@@ -1830,6 +1831,7 @@ radeon_add_encoder(ScrnInfoPtr pScrn, uint32_t encoder_id, uint32_t device_suppo
info->encoders[device_index] = (radeon_encoder_ptr)calloc(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;
diff --git a/driver/xf86-video-ati/src/radeon_dri.c b/driver/xf86-video-ati/src/radeon_dri.c
index 81dc08b28..56b1969d7 100644
--- a/driver/xf86-video-ati/src/radeon_dri.c
+++ b/driver/xf86-video-ati/src/radeon_dri.c
@@ -1153,24 +1153,6 @@ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen)
return TRUE;
}
-/* Add a map for the MMIO registers that will be accessed by any
- * DRI-based clients.
- */
-static Bool RADEONDRIMapInit(RADEONInfoPtr info, ScreenPtr pScreen)
-{
- /* Map registers */
- info->dri->registerSize = info->MMIOSize;
- if (drmAddMap(info->dri->drmFD, info->MMIOAddr, info->dri->registerSize,
- DRM_REGISTERS, DRM_READ_ONLY, &info->dri->registerHandle) < 0) {
- return FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] register handle = 0x%08x\n",
- (unsigned int)info->dri->registerHandle);
-
- return TRUE;
-}
-
/* Initialize the kernel data structures */
static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen)
{
@@ -1206,7 +1188,7 @@ static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen)
drmInfo.depth_pitch = info->dri->depthPitch * drmInfo.depth_bpp / 8;
drmInfo.fb_offset = info->dri->fbHandle;
- drmInfo.mmio_offset = info->dri->registerHandle;
+ drmInfo.mmio_offset = -1;
drmInfo.ring_offset = info->dri->ringHandle;
drmInfo.ring_rptr_offset = info->dri->ringReadPtrHandle;
drmInfo.buffers_offset = info->dri->bufHandle;
@@ -1684,15 +1666,6 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen)
return FALSE;
}
- /* DRIScreenInit doesn't add all the
- * common mappings. Add additional
- * mappings here.
- */
- if (!RADEONDRIMapInit(info, pScreen)) {
- RADEONDRICloseScreen(pScreen);
- return FALSE;
- }
-
/* DRIScreenInit adds the frame buffer
map, but we need it as well */
{
@@ -1797,8 +1770,8 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen)
pRADEONDRI->textureSize = info->dri->textureSize;
pRADEONDRI->log2TexGran = info->dri->log2TexGran;
- pRADEONDRI->registerHandle = info->dri->registerHandle;
- pRADEONDRI->registerSize = info->dri->registerSize;
+ pRADEONDRI->registerHandle = -1;
+ pRADEONDRI->registerSize = -1;
pRADEONDRI->statusHandle = info->dri->ringReadPtrHandle;
pRADEONDRI->statusSize = info->dri->ringReadMapSize;
diff --git a/driver/xf86-video-ati/src/radeon_driver.c b/driver/xf86-video-ati/src/radeon_driver.c
index 2f22fe375..7f8df9c64 100644
--- a/driver/xf86-video-ati/src/radeon_driver.c
+++ b/driver/xf86-video-ati/src/radeon_driver.c
@@ -384,6 +384,9 @@ 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) {
free(info->encoders[i]->dev_priv);
info->encoders[i]->dev_priv = NULL;
@@ -3513,7 +3516,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;
}
@@ -3883,12 +3886,13 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
}
}
+ /* xf86SetDesiredModes() accesses pScrn->pScreen */
+ pScrn->pScreen = pScreen;
+
/* Clear the framebuffer */
memset(info->FB + pScrn->fbOffset, 0,
pScrn->virtualY * pScrn->displayWidth * info->CurrentLayout.pixel_bytes);
- pScrn->pScreen = pScreen;
-
/* set the modes with desired rotation, etc. */
if (!xf86SetDesiredModes (pScrn))
return FALSE;
@@ -3903,7 +3907,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
info->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = RADEONCreateScreenResources;
- if (!xf86CrtcScreenInit (pScreen))
+ if (!xf86CrtcScreenInit (pScreen))
return FALSE;
/* Colormap setup */
@@ -5885,7 +5889,7 @@ static void RADEONRestore(ScrnInfoPtr pScrn)
* corrupted. This hack solves the problem 99% of the time. A
* correct fix is being worked on.
*/
- usleep(1000000);
+ usleep(100000);
#endif
if (info->ChipFamily < CHIP_FAMILY_R600)
diff --git a/driver/xf86-video-ati/src/radeon_output.c b/driver/xf86-video-ati/src/radeon_output.c
index 5abd60e2d..7883bb110 100644
--- a/driver/xf86-video-ati/src/radeon_output.c
+++ b/driver/xf86-video-ati/src/radeon_output.c
@@ -2761,7 +2761,7 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual or single link */
}
- if (strcmp(model, "PowerBook5,7") ||
+ if (strcmp(model, "PowerBook5,7") == 0 ||
strcmp(model, "PowerBook5,8") == 0 ||
strcmp(model, "PowerBook5,9") == 0) {
ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual link */
diff --git a/driver/xf86-video-ati/src/radeon_probe.h b/driver/xf86-video-ati/src/radeon_probe.h
index 66905022f..4a7c0e7c1 100644
--- a/driver/xf86-video-ati/src/radeon_probe.h
+++ b/driver/xf86-video-ati/src/radeon_probe.h
@@ -242,6 +242,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;