Re: 8 to 18 look up by 80
80
Tue Dec 26 10:52:14 CST 2006
Im getting 2 mouse pointers, mouse clicks totally bizarre, pointers can
travers only half screen along yaxis; Im pasting here my cursoron and
cursor off code. Advice me guys
SA2Video::CursorOn()
{
//USHORT * ptrScreen = (USHORT *)m_pPrimarySurface->Buffer();
//USHORT * ptrLine;
//USHORT * cbsLine;
UCHAR * ptrScreen = (UCHAR *)m_pPrimarySurface->Buffer();
UCHAR * ptrLine;
UCHAR * cbsLine;
if (!m_CursorForcedOff && !m_CursorDisabled && !m_CursorVisible)
{
RECTL cursorRectSave = m_CursorRect;
int iRotate;
RotateRectl(&m_CursorRect);
for (int y = m_CursorRect.top; y < m_CursorRect.bottom; y++)
{
if (y < 0)
{
continue;
}
if (y >= m_nScreenHeightSave)
{
break;
}
ptrLine = &ptrScreen[y * m_pPrimarySurface->Stride() / 2];
cbsLine = (UCHAR *)(&m_CursorBackingStore[(y -
m_CursorRect.top) * m_CursorSize.x]);
for (int x = m_CursorRect.left; x < m_CursorRect.right;
x++)
{
if (x < 0)
{
continue;
}
if (x >= m_nScreenWidthSave)
{
break;
}
// x' = x - m_CursorRect.left; y' = y -
m_CursorRect.top;
// Width = m_CursorSize.x; Height = m_CursorSize.y;
switch (m_iRotate)
{
case DMDO_0:
iRotate = (y - m_CursorRect.top)*m_CursorSize.x
+ x - m_CursorRect.left;
break;
case DMDO_90:
iRotate = (x -
m_CursorRect.left)*m_CursorSize.x + m_CursorSize.y - 1 - (y -
m_CursorRect.top);
break;
case DMDO_180:
iRotate = (m_CursorSize.y - 1 - (y -
m_CursorRect.top))*m_CursorSize.x + m_CursorSize.x - 1 - (x -
m_CursorRect.left);
break;
case DMDO_270:
iRotate = (m_CursorSize.x -1 - (x -
m_CursorRect.left))*m_CursorSize.x + y - m_CursorRect.top;
break;
default:
iRotate = (y - m_CursorRect.top)*m_CursorSize.x
+ x - m_CursorRect.left;
break;
}
cbsLine[x - m_CursorRect.left] = ptrLine[x];
ptrLine[x] &= gCursorMask[iRotate];
ptrLine[x] ^= gCursorData[iRotate];
}
}
m_CursorRect = cursorRectSave;
m_CursorVisible = TRUE;
}
}
void
SA2Video::CursorOff()
{
//USHORT * ptrScreen = (USHORT*)m_pPrimarySurface->Buffer();
//USHORT * ptrLine;
//USHORT * cbsLine;
UCHAR * ptrScreen = (UCHAR *)m_pPrimarySurface->Buffer();
UCHAR * ptrLine;
UCHAR * cbsLine;
if (!m_CursorForcedOff && !m_CursorDisabled && m_CursorVisible)
{
RECTL rSave = m_CursorRect;
RotateRectl(&m_CursorRect);
for (int y = m_CursorRect.top; y < m_CursorRect.bottom; y++)
{
// clip to displayable screen area (top/bottom)
if (y < 0)
{
continue;
}
if (y >= m_nScreenHeightSave)
{
break;
}
ptrLine = &ptrScreen[y * m_pPrimarySurface->Stride() / 2];
cbsLine = (UCHAR *)(&m_CursorBackingStore[(y -
m_CursorRect.top) * m_CursorSize.x]);
for (int x = m_CursorRect.left; x < m_CursorRect.right;
x++)
{
// clip to displayable screen area (left/right)
if (x < 0)
{
continue;
}
if (x >= (int)m_nScreenWidthSave)
{
break;
}
ptrLine[x] = cbsLine[x - m_CursorRect.left];
}
}
m_CursorRect = rSave;
m_CursorVisible = FALSE;
}
}
80.rishi@gmail.com wrote:
> I changed all the USHORTs to UCHARS in cursoron and cursoroff. If I do
> that, My cursor size has gone down, but I see two cursors on screen. am
> I supposed to change anyother thing than cursoron and cursor off.
>
> The mouse can traverse only half of the screen along y axis. X azis
> traversing is ok but if the cursor crosses the y axis(say from left to
> right) another cursor is created in the left most. So I see two
> cursors.
>
> I have changed these buffers from USHORT to UCHAR.
> CURSOR_GLOBALS USHORT gCursorData[CURSOR_BYTES];
> CURSOR_GLOBALS USHORT gCursorMask[CURSOR_BYTES];
> USHORT m_CursorBackingStore[CURSOR_SIZE];
>
> Should I do anything else. Help me out.
>
>
>
>
> voidcoder wrote:
> > >>
> > >>Should I make all USHORTs in cursor functions to UCHAR ?
> > >>
> >
> > Yep. But the best solution will be to remove completely
> > the useless "dirty rect dump" stuff from the driver
> > (which is there since the days of SA1110) and use
> > the supported by the PXA LCD controller h/w cursor.
> >
> >
> > 80.rishi@gmail.com wrote:
> > > I learnt fronm this group I should tweak cursoron and cursor off.
> > >
> > > But I'm not able to understand those functions well.
> > >
> > > Should I make all USHORTs in cursor functions to UCHAR ?
> > >
> > >
> > > voidcoder wrote:
> > >> >> 2) My mouse cursor is so big and skewed.
> > >> >>
> > >>
> > >> It looks like your cursor painting is still in 16bpp
> > >> while the rest stuff migrated to 8bpp.
> > >>
> > >>
> > >>
> > >> 80.rishi@gmail.com wrote:
> > >>> Thanks voidcoder.
> > >>> Bpp = 3.
> > >>>
> > >>> I think I just got it. There is a 'if' statement in DispSetPalette()
> > >>> which is preventing from palette ram update. I modified that and
> > >>> display looks ok now.
> > >>>
> > >>> But Im getting new 2 new issues
> > >>>
> > >>> 1) The title bar of the popup that I get once explorer starts is
> > >>> discolored. Even the text looks faded. But rest of the display and
> > >>> icons are proper.
> > >>>
> > >>> 2) My mouse cursor is so big and skewed.
> > >>>
> > >>> Advise me on these issues.
> > >>>
> > >>> voidcoder wrote:
> > >>>> >> p_LCDRegs->LCCR3 = (LCD_PCD(PCD) | LCD_BPP(BPP) |
> > >>>> >>
> > >>>>
> > >>>> What is value of "BPP" at this point?
> > >>>>
> > >>>>
> > >>>>
> > >>>> 80.rishi@gmail.com wrote:
> > >>>>> Thanks a ton for your reply.
> > >>>>>
> > >>>>> Mainstone II BSP. I chose display type LTM035A776C because only this
> > >>>>> showed sth in the display earlier but with color problems. After which
> > >>>>> I learnt my board is hardwired for 18 bpp. Went for 8 to 18 bpp lookup.
> > >>>>>
> > >>>>> Here is the code. Have given here the code break from diff. parts.
> > >>>>>
> > >>>>> file Dispdrv.c
> > >>>>> ---------------------
> > >>>>>
> > >>>>> DispDrvrInitialize()
> > >>>>> {
> > >>>>> BPP = 8;
> > >>>>> XllpLCD.PixelDataFormat = PDFOR_11;
> > >>>>> }
> > >>>>>
> > >>>>> DispDrvrSetPalette()
> > >>>>> {
> > >>>>> // v_pPaletteBuffer->palette[i] = unsigned long
> > >>>>>
> > >>>>> v_pPaletteBuffer->palette[i] = (
> > >>>>> ((DWORD)(source[i].peBlue>>2) <<2 ) |
> > >>>>> ((DWORD)(source[i].peGreen >> 2) << 10) |
> > >>>>> ((DWORD)(source[i].peRed >> 2) << 18)
> > >>>>> );
> > >>>>> }
> > >>>>>
> > >>>>> typedef struct
> > >>>>> {
> > >>>>> unsigned long palette[256];
> > >>>>> }LCD_PALETTE;
> > >>>>>
> > >>>>> volatile LCD_PALETTE * v_pPaletteBuffer = NULL;
> > >>>>>
> > >>>>> v_pPaletteBuffer = (volatile LCD_PALETTE
> > >>>>> *)(PALETTE_BUFFER_BASE_VIRTUAL);
> > >>>>>
> > >>>>>
> > >>>>> File xllp_lcd.c
> > >>>>> --------------------
> > >>>>> LCDInitController()
> > >>>>> {
> > >>>>>
> > >>>>> case BPP_8:
> > >>>>> //pXllpLCD->PaletteSize = 512;
> > >>>>> pXllpLCD->PaletteSize = 1024;
> > >>>>> break;
> > >>>>>
> > >>>>>
> > >>>>> // Configured for 640*480, pixel clock = 25 Mhz, Vsync = 65 Hz
> > >>>>>
> > >>>>> p_LCDRegs->LCCR0 = (LCD_LDM | LCD_SFM | LCD_IUM | LCD_EFM | LCD_PAS |
> > >>>>> LCD_QDM | LCD_BM | LCD_OUM | LCD_RDSTM | LCD_CMDIM | LCD_OUC |
> > >>>>> LCD_LDDALT);
> > >>>>>
> > >>>>> p_LCDRegs->LCCR1 = (LCD_PPL(0x27FU) | LCD_HSW(0x3F) | LCD_ELW(0x0F) |
> > >>>>> LCD_BLW(0x2fU) );
> > >>>>>
> > >>>>> p_LCDRegs->LCCR2 = (LCD_LPP(0x1df) | LCD_VSW(0x01) | LCD_EFW(0x0B) |
> > >>>>> LCD_BFW(0x1F) );
> > >>>>>
> > >>>>> p_LCDRegs->LCCR3 = (LCD_PCD(PCD) | LCD_BPP(BPP) |
> > >>>>> LCD_PDFOR(pXllpLCD->PixelDataFormat));
> > >>>>>
> > >>>>> p_LCDRegs->LCCR4 = LCD_PAL_FOR(2);
> > >>>>> }
> > >>>>>
> > >>>>> Requet you to help me out. I checked and DispDrvrSetPalette is getting
> > >>>>> called.
> > >>>>>
> > >>>>> -Rishi
> > >>>>>
> > >>>>> voidcoder wrote:
> > >>>>>> Post some code. How do you configure the LCD controller,
> > >>>>>> how do you load the palette etc.
> > >>>>>>
> > >>>>>>
> > >>>>>> 80.rishi@gmail.com wrote:
> > >>>>>>> Guys
> > >>>>>>>
> > >>>>>>> Mainstone II, PB 5.0.
> > >>>>>>>
> > >>>>>>> I have read all the articles to implement 8 to 18 lookup. I think I
> > >>>>>>> have made the necessary changes.
> > >>>>>>> When I load the image my display is pitch black and no color, no text.
> > >>>>>>>
> > >>>>>>> Am I missing something out. How do I use the default palette given in
> > >>>>>>> syspal.h. Do I have to do anything.
> > >>>>>>>
> > >>>>>>> Thanks in advance
> > >>>>>>>
> > >>>>>>> -Rishi
> > >>>>>>>
> > >