/* begin_iring - prepares the ringbuffer 
 * @space: length of sequence in dwords
 * @par: pointer to i810fb_par structure
 *
 * DESCRIPTION:
 * Checks/waits for sufficent space in ringbuffer of size
 * space.  Returns the tail of the buffer
 */ 
static inline u32 begin_iring(struct fb_info *info, u32 space)
{
	struct i810fb_par *par = (struct i810fb_par *) info->par;

	if (par->dev_flags & ALWAYS_SYNC) 
		wait_for_engine_idle(info);
	return wait_for_space(info, space);
}
/** 
 * wait_for_engine_idle - waits for all hardware engines to finish
 * @par: pointer to i810fb_par structure
 *
 * DESCRIPTION:
 * This waits for lring(0), iring(1), and batch(3), etc to finish and
 * waits until ringbuffer is empty.
 */
static inline int wait_for_engine_idle(struct fb_info *info)
{
	struct i810fb_par *par = (struct i810fb_par *) info->par;
	u8 *mmio = par->mmio_start_virtual;
	int count = WAIT_COUNT;

	if (wait_for_space(info, par->iring.size)) /* flush */
		return 1;

	while((i810_readw(INSTDONE, mmio) & 0x7B) != 0x7B && --count); 
	if (count) return 0;

	printk("accel engine lockup!!!\n");
	printk("INSTDONE: 0x%04x\n", i810_readl(INSTDONE, mmio));
	i810_report_error(mmio); 
	par->dev_flags |= LOCKUP;
	info->pixmap.scan_align = 1;
	return 1;
}
Example #3
0
void PixelPipeline::queue(std::unique_ptr<PixelCommand> &command)
{
	wait_for_space();
	delete command_queue[local_writer_index];

#if defined(WIN32) && defined(PROFILE_PIPELINE)
	unsigned __int64 start_time = __rdtsc();
#endif

	command_queue[local_writer_index] = command.get();
	command.release();

	local_writer_index++;
	if (local_writer_index == queue_max)
		local_writer_index = 0;
	local_commands_written++;

	if (local_commands_written == fragment_size)
	{
		cl_compiler_barrier();
		writer_index.set(local_writer_index);
		local_commands_written = 0;

#if defined(WIN32) && defined(PROFILE_PIPELINE)
		unsigned __int64 start_event_time = __rdtsc();
#endif
		for (int i = 0; i < active_cores; i++)
		{
			if (reader_active[i].get() == 0)
				event_more_commands[i].set();
		}
#if defined(WIN32) && defined(PROFILE_PIPELINE)
		unsigned __int64 end_event_time = __rdtsc();
		profiler.set_event_time += end_event_time-start_event_time;
#endif
	}

#if defined(WIN32) && defined(PROFILE_PIPELINE)
	unsigned __int64 end_time = __rdtsc();
	profiler.queue_time += end_time-start_time;
#endif
}