From bdb0f0670507d2336964b05bd8a88925a70fbfc7 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Tue, 7 Feb 2006 16:20:06 +0000 Subject: [PATCH] updated new INT handling code to not try to determine INT coming from secondary head on singlehead cards. This could potentially lead to int sharing trouble.. Note, still a bit hackish. Better fix would probably be moving a large part from detailed card type recognition code from accelerant to kerneldriver. As I think it's safe enough this way, I'll leave it as it is for now. (trouble that could arise is a nvidia gfx card not working now, though chances are very slim that would happen. Best moment for fix is probably rewriting the driver for seperate instances on a 'per head' basis, when haiku supports multiple heads ) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16284 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/graphics/nvidia/driver.c | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c index b022231c7e..d24829e5a6 100644 --- a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c +++ b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c @@ -450,6 +450,12 @@ static void disable_vbi_crtc2(vuint32 * regs) NV_REG32(NV32_CRTC2_INTS) = 0x00000001; } +//fixme: +//dangerous code, on singlehead cards better not try accessing secondary head +//registers (card might react in unpredictable ways, though there's only a small +//chance we actually run into this). +//fix requires (some) card recognition code to be moved from accelerant to +//kerneldriver... static void disable_vbi_all(vuint32 * regs) { /* disable nVidia interrupt source vblank */ @@ -917,21 +923,35 @@ nv_interrupt(void *data) vuint32 *regs; /* is someone already handling an interrupt for this device? */ - if (atomic_or(flags, SKD_HANDLER_INSTALLED) & SKD_HANDLER_INSTALLED) { - goto exit0; - } + if (atomic_or(flags, SKD_HANDLER_INSTALLED) & SKD_HANDLER_INSTALLED) goto exit0; + /* get regs */ regs = di->regs; /* was it a VBI? */ - //fixme: - //rewrite once we use one driver instance 'per head' (instead of 'per card') - if (caused_vbi_crtc1(regs) || caused_vbi_crtc2(regs)) { - /* clear the interrupt(s) */ - clear_vbi_crtc1(regs); - clear_vbi_crtc2(regs); - /* release the semaphore */ - handled = thread_interrupt_work(flags, regs, si); + /* note: si->ps.secondary_head was cleared by kerneldriver earlier! (at least) */ + if (si->ps.secondary_head) + { + //fixme: + //rewrite once we use one driver instance 'per head' (instead of 'per card') + if (caused_vbi_crtc1(regs) || caused_vbi_crtc2(regs)) + { + /* clear the interrupt(s) */ + clear_vbi_crtc1(regs); + clear_vbi_crtc2(regs); + /* release the semaphore */ + handled = thread_interrupt_work(flags, regs, si); + } + } + else + { + if (caused_vbi_crtc1(regs)) + { + /* clear the interrupt */ + clear_vbi_crtc1(regs); + /* release the semaphore */ + handled = thread_interrupt_work(flags, regs, si); + } } /* note that we're not in the handler any more */ @@ -1041,6 +1061,9 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) { /* ensure that the accelerant's INIT_ACCELERANT function can be executed */ si->accelerant_in_use = false; + /* preset singlehead card to prevent early INT routine calls (once installed) to + * wrongly identify the INT request coming from us! */ + si->ps.secondary_head = false; /* note the amount of system RAM the system BIOS assigned to the card if applicable: * unified memory architecture (UMA) */