pixelpump.cc (11012:f2ca575d27fd) pixelpump.cc (11897:bfddfbac3a1a)
1/*
1/*
2 * Copyright (c) 2015 ARM Limited
2 * Copyright (c) 2015, 2017 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

--- 120 unchanged lines hidden (view full) ---

131
132 // We don't need to reschedule the event here since the event was
133 // suspended by PixelEvent::drain() and will be rescheduled by
134 // PixelEvent::drainResume().
135 for (PixelEvent *event : pixelEvents)
136 event->unserializeSection(cp, event->name());
137}
138
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

--- 120 unchanged lines hidden (view full) ---

131
132 // We don't need to reschedule the event here since the event was
133 // suspended by PixelEvent::drain() and will be rescheduled by
134 // PixelEvent::drainResume().
135 for (PixelEvent *event : pixelEvents)
136 event->unserializeSection(cp, event->name());
137}
138
139
140void
139void
141BasePixelPump::start(const DisplayTimings &timings)
140BasePixelPump::updateTimings(const DisplayTimings &timings)
142{
141{
142 panic_if(active(), "Trying to update timings in active PixelPump\n");
143
143 _timings = timings;
144
145 // Resize the frame buffer if needed
146 if (_timings.width != fb.width() || _timings.height != fb.height())
147 fb.resize(timings.width, timings.height);
148
149 // Set the current line past the last line in the frame. This
150 // triggers the new frame logic in beginLine().
151 line = _timings.linesPerFrame();
144 _timings = timings;
145
146 // Resize the frame buffer if needed
147 if (_timings.width != fb.width() || _timings.height != fb.height())
148 fb.resize(timings.width, timings.height);
149
150 // Set the current line past the last line in the frame. This
151 // triggers the new frame logic in beginLine().
152 line = _timings.linesPerFrame();
153}
154
155void
156BasePixelPump::start()
157{
152 schedule(evBeginLine, clockEdge());
153}
154
158 schedule(evBeginLine, clockEdge());
159}
160
161
155void
156BasePixelPump::stop()
157{
158 if (evVSyncEnd.scheduled())
159 deschedule(evVSyncEnd);
160
161 if (evHSyncBegin.scheduled())
162 deschedule(evHSyncBegin);

--- 73 unchanged lines hidden (view full) ---

236 if (_posX < _timings.width) {
237 schedule(evRenderPixels, clockEdge(Cycles(pxl_count)));
238 } else {
239 if (pos_y == _timings.height - 1)
240 onFrameDone();
241 }
242}
243
162void
163BasePixelPump::stop()
164{
165 if (evVSyncEnd.scheduled())
166 deschedule(evVSyncEnd);
167
168 if (evHSyncBegin.scheduled())
169 deschedule(evHSyncBegin);

--- 73 unchanged lines hidden (view full) ---

243 if (_posX < _timings.width) {
244 schedule(evRenderPixels, clockEdge(Cycles(pxl_count)));
245 } else {
246 if (pos_y == _timings.height - 1)
247 onFrameDone();
248 }
249}
250
251void
252BasePixelPump::renderFrame()
253{
254 _underrun = false;
255 line = 0;
256
257 // Signal vsync end and render the frame
258 line = _timings.lineVBackPorchStart();
259 onVSyncEnd();
260
261 // We only care about the visible screen area when rendering the
262 // frame
263 for (line = _timings.lineFirstVisible();
264 line < _timings.lineFrontPorchStart();
265 ++line) {
266
267 _posX = 0;
268
269 onHSyncBegin();
270 onHSyncEnd();
271
272 renderLine();
273 }
274
275 line = _timings.lineFrontPorchStart() - 1;
276 onFrameDone();
277
278 // Signal vsync until the next frame begins
279 line = _timings.lineVSyncStart();
280 onVSyncBegin();
281}
282
283void
284BasePixelPump::renderLine()
285{
286 const unsigned pos_y(posY());
287
288 Pixel pixel(0, 0, 0);
289 for (_posX = 0; _posX < _timings.width; ++_posX) {
290 if (!nextPixel(pixel)) {
291 panic("Unexpected underrun in BasePixelPump (%u, %u)\n",
292 _posX, pos_y);
293 }
294 fb.pixel(_posX, pos_y) = pixel;
295 }
296}
297
298
244BasePixelPump::PixelEvent::PixelEvent(
245 const char *name, BasePixelPump *_parent, CallbackType _func)
246 : Event(), Drainable(),
247 _name(name), parent(*_parent), func(_func),
248 suspended(false),
249 relativeTick(0)
250{
251 parent.pixelEvents.push_back(this);

--- 55 unchanged lines hidden ---
299BasePixelPump::PixelEvent::PixelEvent(
300 const char *name, BasePixelPump *_parent, CallbackType _func)
301 : Event(), Drainable(),
302 _name(name), parent(*_parent), func(_func),
303 suspended(false),
304 relativeTick(0)
305{
306 parent.pixelEvents.push_back(this);

--- 55 unchanged lines hidden ---