summaryrefslogtreecommitdiff
path: root/src/nv_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nv_driver.c')
-rw-r--r--src/nv_driver.c539
1 files changed, 37 insertions, 502 deletions
diff --git a/src/nv_driver.c b/src/nv_driver.c
index a0656af..4f39eb5 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -27,9 +27,7 @@
#include "xorg-server.h"
#include "xf86int10.h"
#include "xf86drm.h"
-#ifdef XF86DRM_MODE
#include "xf86drmMode.h"
-#endif
/*
* Forward definitions for the functions that make up the driver.
@@ -55,8 +53,6 @@ static void NVFreeScreen(int scrnIndex, int flags);
static Bool NVMapMem(ScrnInfoPtr pScrn);
static Bool NVUnmapMem(ScrnInfoPtr pScrn);
-static void NVSave(ScrnInfoPtr pScrn);
-static void NVRestore(ScrnInfoPtr pScrn);
#define NOUVEAU_PCI_DEVICE(_vendor_id, _device_id) \
{ (_vendor_id), (_device_id), PCI_MATCH_ANY, PCI_MATCH_ANY, \
@@ -323,50 +319,8 @@ void
NVAdjustFrame(int scrnIndex, int x, int y, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- NVPtr pNv = NVPTR(pScrn);
-
- if (pNv->kms_enable) {
- drmmode_adjust_frame(pScrn, x, y, flags);
- } else {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc = config->output[config->compat_output]->crtc;
-
- if (crtc && crtc->enabled)
- NVCrtcSetBase(crtc, x, y);
- }
-}
-static Bool
-NV50AcquireDisplay(ScrnInfoPtr pScrn)
-{
- if (!NV50DispInit(pScrn))
- return FALSE;
- if (!NV50CursorAcquire(pScrn))
- return FALSE;
-
- return TRUE;
-}
-
-static Bool
-NV50ReleaseDisplay(ScrnInfoPtr pScrn)
-{
- NVPtr pNv = NVPTR(pScrn);
-
- NV50CursorRelease(pScrn);
- NV50DispShutdown(pScrn);
-
- if (pNv->pInt10 && pNv->Int10Mode) {
- xf86Int10InfoPtr pInt10 = pNv->pInt10;
-
- pInt10->num = 0x10;
- pInt10->ax = 0x4f02;
- pInt10->bx = pNv->Int10Mode | 0x8000;
- pInt10->cx =
- pInt10->dx = 0;
- xf86ExecX86int10(pInt10);
- }
-
- return TRUE;
+ drmmode_adjust_frame(pScrn, x, y, flags);
}
/*
@@ -393,23 +347,6 @@ NVEnterVT(int scrnIndex, int flags)
if (!pNv->NoAccel)
NVAccelCommonInit(pScrn);
- if (!pNv->kms_enable) {
- /* Save current state, VGA fonts etc */
- NVSave(pScrn);
-
- /* Clear the framebuffer, we don't want to see garbage
- * on-screen up until X decides to draw something
- */
- nouveau_bo_map(pNv->scanout, NOUVEAU_BO_WR);
- memset(pNv->scanout->map, 0, pNv->scanout->size);
- nouveau_bo_unmap(pNv->scanout);
-
- if (pNv->Architecture == NV_ARCH_50) {
- if (!NV50AcquireDisplay(pScrn))
- return FALSE;
- }
- }
-
pNv->allow_dpms = FALSE;
if (!xf86SetDesiredModes(pScrn))
return FALSE;
@@ -443,13 +380,6 @@ NVLeaveVT(int scrnIndex, int flags)
ret = drmDropMaster(nouveau_device(pNv->dev)->fd);
if (ret)
ErrorF("Error dropping master: %d\n", ret);
-
- if (!pNv->kms_enable) {
- if (pNv->Architecture < NV_ARCH_50)
- NVRestore(pScrn);
- else
- NV50ReleaseDisplay(pScrn);
- }
}
static void
@@ -577,97 +507,10 @@ NVFreeScreen(int scrnIndex, int flags)
NVCloseDRM(pScrn);
- if (pNv->Architecture == NV_ARCH_50 && !pNv->kms_enable) {
- NV50ConnectorDestroy(pScrn);
- NV50OutputDestroy(pScrn);
- NV50CrtcDestroy(pScrn);
- }
-
- /* Free this here and not in CloseScreen, as it's needed after the first server generation. */
- if (pNv->pInt10)
- xf86FreeInt10(pNv->pInt10);
-
xfree(pScrn->driverPrivate);
pScrn->driverPrivate = NULL;
}
-static Bool
-nouveau_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- ScreenPtr screen = screenInfo.screens[scrn->scrnIndex];
- NVPtr pNv = NVPTR(scrn);
- uint32_t pitch, old_width, old_height, old_pitch;
- struct nouveau_bo *old_bo = NULL;
- uint32_t tile_mode = 0, tile_flags = 0, ah = height;
- PixmapPtr ppix = screen->GetScreenPixmap(screen);
- int ret, i;
-
- ErrorF("resize called %d %d\n", width, height);
-
- if (scrn->virtualX == width && scrn->virtualY == height)
- return TRUE;
-
- pitch = nv_pitch_align(pNv, width, scrn->depth);
- pitch *= (scrn->bitsPerPixel >> 3);
-
- old_width = scrn->virtualX;
- old_height = scrn->virtualY;
- old_pitch = scrn->displayWidth;
- nouveau_bo_ref(pNv->scanout, &old_bo);
- nouveau_bo_ref(NULL, &pNv->scanout);
-
- scrn->virtualX = width;
- scrn->virtualY = height;
- scrn->displayWidth = pitch / (scrn->bitsPerPixel >> 3);
-
- ret = nouveau_bo_new_tile(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP,
- 0, pitch * ah, tile_mode, tile_flags,
- &pNv->scanout);
- if (ret)
- goto fail;
-
- if (pNv->ShadowPtr) {
- xfree(pNv->ShadowPtr);
- pNv->ShadowPitch = pitch;
- pNv->ShadowPtr = xalloc(pNv->ShadowPitch * height);
- }
-
- nouveau_bo_map(pNv->scanout, NOUVEAU_BO_RDWR);
- screen->ModifyPixmapHeader(ppix, width, height, -1, -1, pitch,
- (!pNv->NoAccel || pNv->ShadowFB) ?
- pNv->ShadowPtr : pNv->scanout->map);
- scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
- nouveau_bo_unmap(pNv->scanout);
-
- for (i = 0; i < xf86_config->num_crtc; i++) {
- xf86CrtcPtr crtc = xf86_config->crtc[i];
-
- if (!crtc->enabled)
- continue;
-
- xf86CrtcSetMode(crtc, &crtc->mode, crtc->rotation,
- crtc->x, crtc->y);
- }
-
- nouveau_bo_ref(NULL, &old_bo);
-
- NVDRIFinishScreenInit(scrn, true);
- return TRUE;
-
- fail:
- nouveau_bo_ref(old_bo, &pNv->scanout);
- scrn->virtualX = old_width;
- scrn->virtualY = old_height;
- scrn->displayWidth = old_pitch;
-
- return FALSE;
-}
-
-static const xf86CrtcConfigFuncsRec nv_xf86crtc_config_funcs = {
- nouveau_xf86crtc_resize
-};
-
#define NVPreInitFail(fmt, args...) do { \
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%d: "fmt, __LINE__, ##args); \
NVFreeScreen(pScrn->scrnIndex, 0); \
@@ -736,14 +579,14 @@ NVPreInitDRM(ScrnInfoPtr pScrn)
/* Check if KMS is enabled before we do anything, we don't want to
* go stomping on registers behind its back
*/
-#ifdef XF86DRM_MODE
- pNv->kms_enable = !drmCheckModesettingSupported(bus_id);
-#endif
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "[drm] kernel modesetting %s\n", pNv->kms_enable ?
- "in use" : "not available");
-
+ if (drmCheckModesettingSupported(bus_id)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "[drm] kernel modesetting not available\n");
+ xfree(bus_id);
+ return FALSE;
+ }
xfree(bus_id);
+
return TRUE;
}
@@ -852,35 +695,10 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* Initialize the card through int10 interface if needed */
- if (xf86LoadSubModule(pScrn, "int10")) {
-#if !defined(__alpha__) && !defined(__powerpc__)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n");
- pNv->pInt10 = xf86InitInt10(pNv->pEnt->index);
-#endif
- }
-
/* Initialise the kernel module */
if (!NVPreInitDRM(pScrn))
NVPreInitFail("\n");
- /* Save current console video mode */
- if (pNv->Architecture >= NV_ARCH_50 && pNv->pInt10 && !pNv->kms_enable) {
- const xf86Int10InfoPtr pInt10 = pNv->pInt10;
-
- pInt10->num = 0x10;
- pInt10->ax = 0x4f03;
- pInt10->bx =
- pInt10->cx =
- pInt10->dx = 0;
- xf86ExecX86int10(pInt10);
- pNv->Int10Mode = pInt10->bx & 0x3fff;
-
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VESA-HACK: Console VGA mode is 0x%x\n",
- pNv->Int10Mode);
- }
-
/* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
@@ -899,8 +717,8 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
break;
case 30:
/* OK on NV50 KMS */
- if (!pNv->kms_enable || pNv->Architecture != NV_ARCH_50)
- NVPreInitFail("Depth 30 supported on G80+KMS only\n");
+ if (pNv->Architecture != NV_ARCH_50)
+ NVPreInitFail("Depth 30 supported on G80 only\n");
break;
case 15: /* 15 may get done one day, so leave any code for it in place */
default:
@@ -978,13 +796,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
pNv->HWCursor ? "HW" : "SW");
- pNv->FpScale = TRUE;
-
- if (xf86GetOptValBool(pNv->Options, OPTION_FP_SCALE, &pNv->FpScale)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Flat panel scaling %s\n",
- pNv->FpScale ? "on" : "off");
- }
-
if (xf86ReturnOptValBool(pNv->Options, OPTION_NOACCEL, FALSE)) {
pNv->NoAccel = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
@@ -1000,16 +811,10 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 5) || EXA_VERSION_MAJOR > 2
if (!pNv->NoAccel &&
xf86ReturnOptValBool(pNv->Options, OPTION_EXA_PIXMAPS, TRUE)) {
- if (pNv->kms_enable) {
- pNv->exa_driver_pixmaps = TRUE;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "EXAPixmaps support requires KMS\n");
- }
+ pNv->exa_driver_pixmaps = TRUE;
}
- if (!pNv->NoAccel && pNv->kms_enable &&
- pNv->Architecture >= NV_ARCH_50) {
+ if (!pNv->NoAccel && pNv->Architecture >= NV_ARCH_50) {
pNv->wfb_enabled = TRUE;
pNv->tiled_scanout = TRUE;
}
@@ -1024,113 +829,10 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
(((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
}
- pNv->FPDither = FALSE;
- if (xf86GetOptValBool(pNv->Options, OPTION_FP_DITHER, &(pNv->FPDither)))
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "enabling flat panel dither\n");
-
- if (pNv->pEnt->device->MemBase != 0) {
- /* Require that the config file value matches one of the PCI values. */
- if (!xf86CheckPciMemBase(pNv->PciInfo, pNv->pEnt->device->MemBase)) {
- NVPreInitFail(
- "MemBase 0x%08lX doesn't match any PCI base register.\n",
- pNv->pEnt->device->MemBase);
- }
- pNv->VRAMPhysical = pNv->pEnt->device->MemBase;
- from = X_CONFIG;
- } else {
- if (pNv->PciInfo->regions[1].base_addr != 0) {
- pNv->VRAMPhysical = pNv->PciInfo->regions[1].base_addr & 0xff800000;
- from = X_PROBED;
- } else {
- NVPreInitFail("No valid FB address in PCI config space\n");
- return FALSE;
- }
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n",
- (unsigned long)pNv->VRAMPhysical);
-
- if (pNv->pEnt->device->IOBase != 0) {
- /* Require that the config file value matches one of the PCI values. */
- if (!xf86CheckPciMemBase(pNv->PciInfo, pNv->pEnt->device->IOBase)) {
- NVPreInitFail("IOBase 0x%08lX doesn't match any PCI base register.\n",
- pNv->pEnt->device->IOBase);
- }
- pNv->IOAddress = pNv->pEnt->device->IOBase;
- from = X_CONFIG;
- } else {
- if (pNv->PciInfo->regions[0].base_addr != 0) {
- pNv->IOAddress = pNv->PciInfo->regions[0].base_addr & 0xffffc000;
- from = X_PROBED;
- } else {
- NVPreInitFail("No valid MMIO address in PCI config space\n");
- }
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
- (unsigned long)pNv->IOAddress);
-
-#ifdef XF86DRM_MODE
- if (pNv->kms_enable){
- ret = drmmode_pre_init(pScrn, nouveau_device(pNv->dev)->fd,
- pScrn->bitsPerPixel >> 3);
- if (ret == FALSE)
- NVPreInitFail("Kernel modesetting failed to initialize\n");
- } else
-#endif
- {
- int max_width, max_height;
-
- if (pNv->Architecture < NV_ARCH_10) {
- max_width = (pScrn->bitsPerPixel > 16) ? 2032 : 2048;
- max_height = 2048;
- } else if (pNv->Architecture < NV_ARCH_50) {
- max_width = (pScrn->bitsPerPixel > 16) ? 4080 : 4096;
- max_height = 4096;
- } else {
- max_width = (pScrn->bitsPerPixel > 16) ? 8176 : 8192;
- max_height = 8192;
- }
-
- /* Allocate an xf86CrtcConfig */
- xf86CrtcConfigInit(pScrn, &nv_xf86crtc_config_funcs);
- xf86CrtcSetSizeRange(pScrn, 320, 200, max_width, max_height);
- }
-
- NVCommonSetup(pScrn);
-
- if (!pNv->kms_enable) {
- if (pNv->Architecture == NV_ARCH_50)
- if (!NV50DispPreInit(pScrn))
- NVPreInitFail("\n");
-
- /* This is the internal system, not the randr-1.2 ones. */
- if (pNv->Architecture == NV_ARCH_50) {
- NV50CrtcInit(pScrn);
- NV50ConnectorInit(pScrn);
- NV50OutputSetup(pScrn);
- }
-
- for (i = 0; i <= pNv->twoHeads; i++) {
- if (pNv->Architecture == NV_ARCH_50)
- nv50_crtc_init(pScrn, i);
- else
- nv_crtc_init(pScrn, i);
- }
-
- if (pNv->Architecture < NV_ARCH_50) {
- NVLockVgaCrtcs(pNv, false);
- NvSetupOutputs(pScrn);
- } else
- nv50_output_create(pScrn); /* create randr-1.2 "outputs". */
-
- if (!xf86InitialConfiguration(pScrn, TRUE))
- NVPreInitFail("No valid modes.\n");
- }
-
- pScrn->videoRam = pNv->RamAmountKBytes;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kBytes\n",
- pScrn->videoRam);
-
- pNv->VRAMPhysicalSize = pScrn->videoRam * 1024;
+ ret = drmmode_pre_init(pScrn, nouveau_device(pNv->dev)->fd,
+ pScrn->bitsPerPixel >> 3);
+ if (ret == FALSE)
+ NVPreInitFail("Kernel modesetting failed to initialize\n");
/*
* If the driver can do gamma correction, it should call xf86SetGamma()
@@ -1187,16 +889,13 @@ static Bool
NVMapMem(ScrnInfoPtr pScrn)
{
NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_device *dev = pNv->dev;
uint64_t res;
uint32_t tile_mode = 0, tile_flags = 0;
int ret, size;
- nouveau_device_get_param(pNv->dev, NOUVEAU_GETPARAM_FB_SIZE, &res);
- pNv->VRAMSize=res;
- nouveau_device_get_param(pNv->dev, NOUVEAU_GETPARAM_FB_PHYSICAL, &res);
+ nouveau_device_get_param(dev, NOUVEAU_GETPARAM_FB_PHYSICAL, &res);
pNv->VRAMPhysical=res;
- nouveau_device_get_param(pNv->dev, NOUVEAU_GETPARAM_AGP_SIZE, &res);
- pNv->AGPSize=res;
size = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3);
if (pNv->Architecture >= NV_ARCH_50 && pNv->tiled_scanout) {
@@ -1207,7 +906,7 @@ NVMapMem(ScrnInfoPtr pScrn)
size *= pScrn->virtualY;
}
- ret = nouveau_bo_new_tile(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP,
+ ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP,
0, size, tile_mode, tile_flags,
&pNv->scanout);
if (ret) {
@@ -1220,17 +919,17 @@ NVMapMem(ScrnInfoPtr pScrn)
nouveau_bo_unmap(pNv->scanout);
if (pNv->NoAccel)
- goto skip_offscreen_gart;
+ return TRUE;
if (!pNv->exa_driver_pixmaps) {
- size = (pNv->VRAMPhysicalSize / 2) - size;
+ size = (dev->vm_vram_size / 2) - size;
if (pNv->Architecture >= NV_ARCH_50) {
tile_mode = 0;
tile_flags = 0x7000;
}
- ret = nouveau_bo_new_tile(pNv->dev, NOUVEAU_BO_VRAM |
+ ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM |
NOUVEAU_BO_MAP, 0, size, tile_mode,
tile_flags, &pNv->offscreen);
if (ret) {
@@ -1248,22 +947,16 @@ NVMapMem(ScrnInfoPtr pScrn)
nouveau_bo_unmap(pNv->offscreen);
}
- if (pNv->AGPSize) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "AGPGART: %dMiB available\n",
- (unsigned int)(pNv->AGPSize >> 20));
- if (pNv->AGPSize > (16*1024*1024))
- size = 16*1024*1024;
- else
- /* always leave 512kb for other things like the fifos */
- size = pNv->AGPSize - 512*1024;
- } else {
- size = (4 << 20) - (1 << 18) ;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "GART: PCI DMA - using %dKiB\n", size >> 10);
- }
- if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: %dMiB available\n",
+ (unsigned int)(dev->vm_gart_size >> 20));
+ if (dev->vm_gart_size > (16 * 1024 * 1024))
+ size = 16 * 1024 * 1024;
+ else
+ /* always leave 512kb for other things like the fifos */
+ size = dev->vm_gart_size - 512*1024;
+
+ if (nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
0, size, &pNv->GART)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Unable to allocate GART memory\n");
@@ -1274,56 +967,6 @@ NVMapMem(ScrnInfoPtr pScrn)
(unsigned int)(pNv->GART->size >> 20));
}
-skip_offscreen_gart:
- /* We don't need to allocate cursors / lut here if we're using
- * kernel modesetting
- **/
- if (pNv->kms_enable)
- return TRUE;
-
- if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_PIN |
- NOUVEAU_BO_MAP, 0, 64 * 64 * 4, &pNv->Cursor)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate memory for hardware cursor\n");
- return FALSE;
- }
-
- if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_PIN |
- NOUVEAU_BO_MAP, 0, 64 * 64 * 4, &pNv->Cursor2)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate memory for hardware cursor\n");
- return FALSE;
- }
-
- /* This is not the ideal solution, but significant changes are needed
- * otherwise. Ideally you do this once upon preinit, but drm is
- * closed between screen inits.
- */
- if (pNv->Architecture == NV_ARCH_50) {
- int i;
-
- for(i = 0; i < 2; i++) {
- nouveauCrtcPtr crtc = pNv->crtc[i];
-
- if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_PIN |
- NOUVEAU_BO_MAP, 0, 0x1000,
- &crtc->lut)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate memory for lut %d\n", i);
- return FALSE;
- }
-
- /* Copy the last known values. */
- if (crtc->lut_values_valid) {
- nouveau_bo_map(crtc->lut, NOUVEAU_BO_WR);
- memcpy(crtc->lut->map, crtc->lut_values,
- 4 * 256 * sizeof(uint16_t));
- nouveau_bo_unmap(crtc->lut);
- }
- }
- }
-
return TRUE;
}
@@ -1336,67 +979,14 @@ NVUnmapMem(ScrnInfoPtr pScrn)
{
NVPtr pNv = NVPTR(pScrn);
- if (!pNv->dev) {
- pci_device_unmap_range(pNv->PciInfo, pNv->VRAMMap,
- pNv->PciInfo->regions[1].size);
- }
+ drmmode_remove_fb(pScrn);
-#ifdef XF86DRM_MODE
- if (pNv->kms_enable)
- drmmode_remove_fb(pScrn);
-#endif
nouveau_bo_ref(NULL, &pNv->scanout);
nouveau_bo_ref(NULL, &pNv->offscreen);
nouveau_bo_ref(NULL, &pNv->GART);
- nouveau_bo_ref(NULL, &pNv->Cursor);
- nouveau_bo_ref(NULL, &pNv->Cursor2);
-
- /* Again not the most ideal way. */
- if (pNv->Architecture == NV_ARCH_50 && !pNv->kms_enable) {
- int i;
-
- for(i = 0; i < 2; i++) {
- nouveauCrtcPtr crtc = pNv->crtc[i];
-
- nouveau_bo_ref(NULL, &crtc->lut);
- }
- }
-
return TRUE;
}
-
-/*
- * Restore the initial (text) mode.
- */
-static void
-NVRestore(ScrnInfoPtr pScrn)
-{
- NVPtr pNv = NVPTR(pScrn);
-
- NVLockVgaCrtcs(pNv, false);
-
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int i;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Restoring encoders\n");
- for (i = 0; i < pNv->vbios->dcb->entries; i++)
- nv_encoder_restore(pScrn, &pNv->encoders[i]);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Restoring crtcs\n");
- for (i = 0; i < xf86_config->num_crtc; i++)
- xf86_config->crtc[i]->funcs->restore(xf86_config->crtc[i]);
-
- nouveau_hw_save_vga_fonts(pScrn, 0);
-
- if (pNv->twoHeads) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Restoring CRTC_OWNER to %d.\n", pNv->vtOWNER);
- NVSetOwner(pNv, pNv->vtOWNER);
- }
-
- NVLockVgaCrtcs(pNv, true);
-}
-
static void
NVLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
LOCO * colors, VisualPtr pVisual)
@@ -1504,9 +1094,6 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
for (i = 0; i < xf86_config->num_output; i++)
xf86_config->output[i]->scrn = pScrn;
- if (!pNv->kms_enable)
- NVSave(pScrn);
-
/*
* The next step is to setup the screen's visuals, and initialise the
* framebuffer code. In cases where the framebuffer's default
@@ -1601,14 +1188,8 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
- if (!pNv->NoAccel) {
- if (!nouveau_exa_init(pScreen))
- return FALSE;
- } else if (pNv->VRAMPhysicalSize / 2 < NOUVEAU_ALIGN(pScrn->virtualX, 64) * NOUVEAU_ALIGN(pScrn->virtualY, 64) * (pScrn->bitsPerPixel >> 3)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "The virtual screen size's resolution is too big for the video RAM framebuffer at this colour depth.\n");
+ if (!pNv->NoAccel && !nouveau_exa_init(pScreen))
return FALSE;
- }
-
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
@@ -1632,17 +1213,10 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* Must follow software cursor initialization.
*/
if (pNv->HWCursor) {
- if (pNv->kms_enable)
- ret = drmmode_cursor_init(pScreen);
- else
- if (pNv->Architecture < NV_ARCH_50)
- ret = NVCursorInitRandr12(pScreen);
- else
- ret = NV50CursorInit(pScreen);
-
+ ret = drmmode_cursor_init(pScreen);
if (ret != TRUE) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Hardware cursor initialization failed\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Hardware cursor initialization failed\n");
pNv->HWCursor = FALSE;
}
}
@@ -1665,8 +1239,7 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->vtSema = TRUE;
pScrn->pScreen = pScreen;
- if (pNv->kms_enable)
- drmmode_fbcon_copy(pScrn);
+ drmmode_fbcon_copy(pScrn);
if (!NVEnterVT(pScrn->scrnIndex, 0))
return FALSE;
@@ -1705,44 +1278,6 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
static Bool
NVSaveScreen(ScreenPtr pScreen, int mode)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- NVPtr pNv = NVPTR(pScrn);
- bool on = xf86IsUnblank(mode);
- int i;
-
- if (pScrn->vtSema && pNv->Architecture < NV_ARCH_50) {
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-
- for (i = 0; i < xf86_config->num_crtc; i++) {
- struct nouveau_crtc *nv_crtc = to_nouveau_crtc(xf86_config->crtc[i]);
-
- if (xf86_config->crtc[i]->enabled)
- NVBlankScreen(pNv, nv_crtc->head, !on);
- }
- }
-
return TRUE;
}
-static void
-NVSave(ScrnInfoPtr pScrn)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- NVPtr pNv = NVPTR(pScrn);
- int i;
-
- if (pNv->Architecture == NV_ARCH_50)
- return;
-
- NVLockVgaCrtcs(pNv, false);
-
- nouveau_hw_save_vga_fonts(pScrn, 1);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Saving crtcs\n");
- for (i = 0; i < xf86_config->num_crtc; i++)
- xf86_config->crtc[i]->funcs->save(xf86_config->crtc[i]);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Saving encoders\n");
- for (i = 0; i < pNv->vbios->dcb->entries; i++)
- nv_encoder_save(pScrn, &pNv->encoders[i]);
-}