/* * Copyright 2008 Stuart Bennett * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
*/
staticinline uint8_t NVReadVgaCrtc(struct drm_device *dev, int head, uint8_t index)
{ struct nvif_object *device = &nouveau_drm(dev)->client.device.object;
uint8_t val;
nvif_wr08(device, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index);
val = nvif_rd08(device, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE); return val;
}
/* CR57 and CR58 are a fun pair of regs. CR57 provides an index (0-0xf) for CR58 * I suspect they in fact do nothing, but are merely a way to carry useful * per-head variables around * * Known uses: * CR57 CR58 * 0x00 index to the appropriate dcb entry (or 7f for inactive) * 0x02 dcb entry's "or" value (or 00 for inactive) * 0x03 bit0 set for dual link (LVDS, possibly elsewhere too) * 0x08 or 0x09 pxclk in MHz * 0x0f laptop panel info - low nibble for PEXTDEV_BOOT_0 strap * high nibble for xlat strap value
*/
/* Only NV4x have two pvio ranges; other twoHeads cards MUST call
* NVSetOwner for the relevant head to be programmed */ if (head && drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
reg += NV_PRMVIO_SIZE;
/* Only NV4x have two pvio ranges; other twoHeads cards MUST call
* NVSetOwner for the relevant head to be programmed */ if (head && drm->client.device.info.family == NV_DEVICE_INFO_V0_CURIE)
reg += NV_PRMVIO_SIZE;
staticinlinevoid
nv_lock_vga_crtc_shadow(struct drm_device *dev, int head, int lock)
{ /* shadow lock: connects 0x60?3d? regs to "real" 0x3d? regs * bit7: unlocks HDT, HBS, HBE, HRS, HRE, HEB * bit6: seems to have some effect on CR09 (double scan, VBS_9) * bit5: unlocks HDE * bit4: unlocks VDE * bit3: unlocks VDT, OVL, VRS, ?VRE?, VBS, VBE, LSR, EBR * bit2: same as bit 1 of 0x60?804 * bit0: same as bit 0 of 0x60?804
*/
uint8_t cr21 = lock;
if (lock < 0) /* 0xfa is generic "unlock all" mask */
cr21 = NVReadVgaCrtc(dev, head, NV_CIO_CRE_21) | 0xfa;
NVWriteVgaCrtc(dev, head, NV_CIO_CRE_21, cr21);
}
/* renders the extended crtc regs (cr19+) on all crtcs impervious: * immutable and unreadable
*/ staticinlinebool
NVLockVgaCrtcs(struct drm_device *dev, bool lock)
{ struct nouveau_drm *drm = nouveau_drm(dev); bool waslocked = !NVReadVgaCrtc(dev, 0, NV_CIO_SR_LOCK_INDEX);
/* nv04 cursor max dimensions of 32x32 (A1R5G5B5) */ #define NV04_CURSOR_SIZE 32 /* limit nv10 cursors to 64x64 (ARGB8) (we could go to 64x255) */ #define NV10_CURSOR_SIZE 64
staticinlinevoid
nv_fix_nv40_hw_cursor(struct drm_device *dev, int head)
{ /* on some nv40 (such as the "true" (in the NV_PFB_BOOT_0 sense) nv40, * the gf6800gt) a hardware bug requires a write to PRAMDAC_CURSOR_POS * for changes to the CRTC CURCTL regs to take effect, whether changing * the pixmap location, or just showing/hiding the cursor
*/
uint32_t curpos = NVReadRAMDAC(dev, head, NV_PRAMDAC_CU_START_POS);
NVWriteRAMDAC(dev, head, NV_PRAMDAC_CU_START_POS, curpos);
}
if (drm->client.device.info.family == NV_DEVICE_INFO_V0_TNT) { /* * Hilarious, the 24th bit doesn't want to stick to * PCRTC_START...
*/ int cre_heb = NVReadVgaCrtc(dev, head, NV_CIO_CRE_HEB__INDEX);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.