1/* |
2 * Copyright (c) 2010-2012 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 48 unchanged lines hidden (view full) --- 59// initialize clcd registers 60Pl111::Pl111(const Params *p) 61 : AmbaDmaDevice(p), lcdTiming0(0), lcdTiming1(0), lcdTiming2(0), 62 lcdTiming3(0), lcdUpbase(0), lcdLpbase(0), lcdControl(0), lcdImsc(0), 63 lcdRis(0), lcdMis(0), 64 clcdCrsrCtrl(0), clcdCrsrConfig(0), clcdCrsrPalette0(0), 65 clcdCrsrPalette1(0), clcdCrsrXY(0), clcdCrsrClip(0), clcdCrsrImsc(0), 66 clcdCrsrIcr(0), clcdCrsrRis(0), clcdCrsrMis(0), |
67 pixelClock(p->pixel_clock), |
68 vnc(p->vnc), bmp(NULL), width(LcdMaxWidth), height(LcdMaxHeight), 69 bytesPerPixel(4), startTime(0), startAddr(0), maxAddr(0), curAddr(0), 70 waterMark(0), dmaPendingNum(0), readEvent(this), fillFifoEvent(this), 71 dmaDoneEvent(maxOutstandingDma, this), intEvent(this) 72{ 73 pioSize = 0xFFFF; 74 75 pic = simout.create(csprintf("%s.framebuffer.bmp", sys->name()), true); --- 360 unchanged lines hidden (view full) --- 436 startAddr = lcdUpbase; 437 438 // Updating base address, interrupt if we're supposed to 439 lcdRis.baseaddr = 1; 440 if (!intEvent.scheduled()) 441 schedule(intEvent, nextCycle()); 442 443 curAddr = 0; |
444 startTime = curTick(); |
445 446 maxAddr = static_cast<Addr>(length * bytesPerPixel); 447 448 DPRINTF(PL111, " lcd frame buffer size of %d bytes \n", maxAddr); 449 |
450 fillFifo(); 451} 452 453void 454Pl111::fillFifo() 455{ 456 while ((dmaPendingNum < maxOutstandingDma) && (maxAddr >= curAddr + dmaSize )) { 457 // concurrent dma reads need different dma done events --- 11 unchanged lines hidden (view full) --- 469 0, Request::UNCACHEABLE); 470 curAddr += dmaSize; 471 } 472} 473 474void 475Pl111::dmaDone() 476{ |
477 DPRINTF(PL111, "DMA Done\n"); |
478 |
479 Tick maxFrameTime = lcdTiming2.cpl * height * pixelClock; 480 |
481 --dmaPendingNum; 482 483 if (maxAddr == curAddr && !dmaPendingNum) { |
484 if ((curTick() - startTime) > maxFrameTime) { 485 warn("CLCD controller buffer underrun, took %d ticks when should" |
486 " have taken %d\n", curTick() - startTime, maxFrameTime); 487 lcdRis.underflow = 1; 488 if (!intEvent.scheduled()) 489 schedule(intEvent, nextCycle()); 490 } 491 492 assert(!readEvent.scheduled()); 493 if (vnc) 494 vnc->setDirty(); 495 496 DPRINTF(PL111, "-- write out frame buffer into bmp\n"); 497 498 assert(bmp); 499 pic->seekp(0); 500 bmp->write(pic); 501 502 // schedule the next read based on when the last frame started 503 // and the desired fps (i.e. maxFrameTime), we turn the |
504 // argument into a relative number of cycles in the future |
505 if (lcdControl.lcden) |
506 schedule(readEvent, clockEdge(ticksToCycles(startTime - 507 curTick() + 508 maxFrameTime))); |
509 } 510 511 if (dmaPendingNum > (maxOutstandingDma - waterMark)) 512 return; 513 514 if (!fillFifoEvent.scheduled()) 515 schedule(fillFifoEvent, nextCycle()); 516} --- 227 unchanged lines hidden --- |