Exemplo n.º 1
0
static gboolean rc_area_changed_cb(gpointer data)
{
	RendererClutter *rc = (RendererClutter *)data;
	PixbufRenderer *pr = rc->pr;

	RendererClutterAreaParam *par = rc->pending_updates->data;

	gint h = MAX_REGION_AREA / par->w;
	if (h == 0) h = 1;
	if (h > par->h) h = par->h;


	DEBUG_3("%s upload start", get_exec_time());
	if (pr->pixbuf)
		{
		CoglHandle texture = clutter_texture_get_cogl_texture(CLUTTER_TEXTURE(rc->texture));

		cogl_texture_set_region(texture,
					par->x + GET_RIGHT_PIXBUF_OFFSET(rc),
					par->y,
					par->x,
					par->y,
					par->w,
					h,
					par->w,
					h,
					gdk_pixbuf_get_has_alpha(pr->pixbuf) ? COGL_PIXEL_FORMAT_BGRA_8888 : COGL_PIXEL_FORMAT_BGR_888,
					gdk_pixbuf_get_rowstride(pr->pixbuf),
					gdk_pixbuf_get_pixels(pr->pixbuf));
		}
	DEBUG_3("%s upload end", get_exec_time());
	rc_area_clip_add(rc, par->x, par->y, par->w, h);


	par->y += h;
	par->h -= h;

	if (par->h == 0)
		{
		rc->pending_updates = g_list_remove(rc->pending_updates, par);
		g_free(par);
		}
	if (!rc->pending_updates)
		{
		clutter_actor_queue_redraw(CLUTTER_ACTOR(rc->texture));
		rc->idle_update = 0;

		/* FIXME: find a better place for this */
		if (!rc->clut_updated) rc_prepare_post_process_lut(rc);

		return FALSE;
		}

	rc_schedule_texture_upload(rc);

	return FALSE; /* it was rescheduled, possibly with different prio */
}
Exemplo n.º 2
0
void log_domain_print_debug(const gchar *domain, const gchar *file_name, const gchar *function_name,
									int line_number, const gchar *format, ...)
{
	va_list ap;
	gchar *message;
	gchar *location;
	gchar *buf;

	va_start(ap, format);
	message = g_strdup_vprintf(format, ap);
	va_end(ap);

	if (options && options->log_window.timer_data)
		{
		location = g_strdup_printf("%s:%s:%s:%d:", get_exec_time(), file_name,
												function_name, line_number);
		}
	else
		{
		location = g_strdup_printf("%s:%s:%d:", file_name, function_name, line_number);
		}

	buf = g_strconcat(location, message, NULL);
	log_domain_print_message(domain,buf);
	g_free(location);
	g_free(message);
}
Exemplo n.º 3
0
static void rc_schedule_texture_upload(RendererClutter *rc)
{
	if (g_get_monotonic_time() - rc->last_pixbuf_change < 50000)
		{
		/* delay clutter redraw until the texture has some data
		   set priority between gtk redraw and clutter redraw */
		DEBUG_3("%s tex upload high prio", get_exec_time());
		rc->idle_update = g_idle_add_full(CLUTTER_PRIORITY_REDRAW - 10, rc_area_changed_cb, rc, NULL);
		}
	else
		{
		/* higher prio than histogram */
		DEBUG_3("%s tex upload low prio", get_exec_time());

		rc->idle_update = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE - 5, rc_area_changed_cb, rc, NULL);
		}
}
Exemplo n.º 4
0
void sobliv_on_exit_top_m(struct task_struct* t)
{
	if (budget_precisely_tracked(t)) {
		if (tsk_rt(t)->budget.timer.armed) {

			if (!is_running(t)) {
				/* the time at which we started draining budget while
				 * suspended is recorded in evt_timestamp.  evt_timestamp
				 * was set either when 't' exited the top-m while suspended
				 * or when 't' blocked. */
				lt_t suspend_cost;
				BUG_ON(!tsk_rt(t)->budget.suspend_timestamp);
				suspend_cost = litmus_clock() -
						tsk_rt(t)->budget.suspend_timestamp;
				TRACE_TASK(t, "budget consumed while suspended: %llu\n",
								suspend_cost);
				get_exec_time(t) += suspend_cost;

				/* timer should have fired before now */
				if (get_exec_time(t) + 1000000/10 > get_exec_cost(t)) {
					TRACE_TASK(t,
						"budget overrun while suspended by over 1/10 "
						"millisecond! timer should have already fired!\n");
					WARN_ON(1);
				}
			}

			TRACE_TASK(t, "stops draining budget\n");
			/* the callback will handle it if it is executing */
			if (!hrtimer_callback_running(&tsk_rt(t)->budget.timer.timer)) {
				/* TODO: record a timestamp if the task isn't running */
				cancel_enforcement_timer(t);
			}
			else {
				TRACE_TASK(t,
					"within callback context. skipping operation.\n");
			}
		}
		else {
			TRACE_TASK(t, "was not draining budget\n");
		}
	}
}
Exemplo n.º 5
0
static void rc_update_pixbuf(void *renderer, gboolean lazy)
{
	RendererClutter *rc = (RendererClutter *)renderer;
	PixbufRenderer *pr = rc->pr;

	DEBUG_3("rc_update_pixbuf");

	rc_remove_pending_updates(rc);

	rc->last_pixbuf_change = g_get_monotonic_time();
	DEBUG_3("%s change time reset", get_exec_time());

	if (pr->pixbuf)
		{
		gint width = gdk_pixbuf_get_width(pr->pixbuf);
		gint height = gdk_pixbuf_get_height(pr->pixbuf);

		DEBUG_3("pixbuf size %d x %d (%d)", width, height, gdk_pixbuf_get_has_alpha(pr->pixbuf) ? 32 : 24);

		gint prev_width, prev_height;

		if (pr->stereo_data == STEREO_PIXBUF_SBS || pr->stereo_data == STEREO_PIXBUF_CROSS)
			{
			width /= 2;
			}


		clutter_texture_get_base_size(CLUTTER_TEXTURE(rc->texture), &prev_width, &prev_height);

		if (width != prev_width || height != prev_height)
			{
			/* FIXME use CoglMaterial with multiple textures for background, color management, anaglyph, ... */
			CoglHandle texture = cogl_texture_new_with_size(width,
									height,
									COGL_TEXTURE_NO_AUTO_MIPMAP | COGL_TEXTURE_NO_SLICING,
									gdk_pixbuf_get_has_alpha(pr->pixbuf) ? COGL_PIXEL_FORMAT_BGRA_8888 : COGL_PIXEL_FORMAT_BGR_888);

			if (texture != COGL_INVALID_HANDLE)
				{
				clutter_texture_set_cogl_texture(CLUTTER_TEXTURE(rc->texture), texture);
				cogl_handle_unref(texture);
				}
			}
		clutter_actor_set_clip(rc->texture, 0, 0, 0, 0); /* visible area is extended as area_changed events arrive */
		if (!lazy)
			{
			rc_area_changed(renderer, GET_RIGHT_PIXBUF_OFFSET(rc), 0, width, height);
			}
		}

	rc->clut_updated = FALSE;
}
Exemplo n.º 6
0
feather_callback void do_sched_trace_task_switch_away(unsigned long id,
						      unsigned long _task)
{
	struct task_struct *t = (struct task_struct*) _task;
	struct st_event_record* rec;
	if (is_realtime(t)) {
		rec = get_record(ST_SWITCH_AWAY, t);
		if (rec) {
			rec->data.switch_away.when      = now();
			rec->data.switch_away.exec_time = get_exec_time(t);
			put_record(rec);
		}
	}
}
Exemplo n.º 7
0
void simple_io_on_wakeup(struct task_struct* t)
{
	/* we're waking up from an io-based suspension */
	if (tsk_rt(t)->budget.suspend_timestamp) {
		lt_t suspend_cost = litmus_clock() -
				tsk_rt(t)->budget.suspend_timestamp;
		tsk_rt(t)->budget.suspend_timestamp = 0;
		TRACE_TASK(t, "budget consumed while io-suspended: %llu\n",
						suspend_cost);
		get_exec_time(t) += suspend_cost;
	}
	else {
		TRACE_TASK(t, "waking from non-io blocking\n");
	}
}
Exemplo n.º 8
0
void sobliv_on_wakeup(struct task_struct* t)
{
	if (bt_flag_is_set(t, BTF_IS_TOP_M)) {
		/* we're waking up while in top-m.  record the time spent
		 * suspended while draining in exec_cost. suspend_timestamp was
		 * either set when we entered top-m while asleep, or when we
		 * blocked. */
		if (tsk_rt(t)->budget.suspend_timestamp) {
			lt_t suspend_cost = litmus_clock() -
					tsk_rt(t)->budget.suspend_timestamp;
			tsk_rt(t)->budget.suspend_timestamp = 0;
			TRACE_TASK(t, "budget consumed while suspended: %llu\n",
					suspend_cost);
			get_exec_time(t) += suspend_cost;
		}
		else {
			WARN_ON(!bt_flag_is_set(t, BTF_WAITING_FOR_RELEASE));
		}
	}
}
Exemplo n.º 9
0
static void rc_prepare_post_process_lut(RendererClutter *rc)
{
	PixbufRenderer *pr = rc->pr;
	static guchar clut[CLUT_SIZE * CLUT_SIZE * CLUT_SIZE * 3];
	guint r, g, b;
	GdkPixbuf *tmp_pixbuf;
	CoglHandle material;
	CoglHandle tex3d;

	DEBUG_3("%s clut start", get_exec_time());

	for (r = 0; r < CLUT_SIZE; r++)
		{
		for (g = 0; g < CLUT_SIZE; g++)
			{
			for (b = 0; b < CLUT_SIZE; b++)
				{
				guchar *ptr = clut + ((b * CLUT_SIZE + g) * CLUT_SIZE + r) * 3;
				ptr[0] = floor ((double) r / (CLUT_SIZE - 1) * 255.0 + 0.5);
				ptr[1] = floor ((double) g / (CLUT_SIZE - 1) * 255.0 + 0.5);
				ptr[2] = floor ((double) b / (CLUT_SIZE - 1) * 255.0 + 0.5);
				}
			}
		}
	tmp_pixbuf = gdk_pixbuf_new_from_data(clut, GDK_COLORSPACE_RGB, FALSE, 8,
					      CLUT_SIZE * CLUT_SIZE,
					      CLUT_SIZE,
					      CLUT_SIZE * CLUT_SIZE * 3,
					      NULL, NULL);
	if (pr->func_post_process)
		{
		pr->func_post_process(pr, &tmp_pixbuf, 0, 0, CLUT_SIZE * CLUT_SIZE, CLUT_SIZE, pr->post_process_user_data);
		}
	g_object_unref(tmp_pixbuf);

	DEBUG_3("%s clut upload start", get_exec_time());
#if COGL_VERSION_CHECK(1,18,2)
	{
	CoglContext *ctx = clutter_backend_get_cogl_context(clutter_get_default_backend ());

	tex3d = cogl_texture_3d_new_from_data(ctx,
					      CLUT_SIZE, CLUT_SIZE, CLUT_SIZE,
					      COGL_PIXEL_FORMAT_RGB_888,
					      CLUT_SIZE * 3,
					      CLUT_SIZE * CLUT_SIZE * 3,
					      clut,
					      NULL);
	}
#elif COGL_VERSION_CHECK(1,10,4)
	{
	CoglContext *ctx = clutter_backend_get_cogl_context(clutter_get_default_backend ());

	tex3d = cogl_texture_3d_new_from_data(ctx,
					      CLUT_SIZE, CLUT_SIZE, CLUT_SIZE,
					      COGL_PIXEL_FORMAT_RGB_888,
					      COGL_PIXEL_FORMAT_RGB_888,
					      CLUT_SIZE * 3,
					      CLUT_SIZE * CLUT_SIZE * 3,
					      clut,
					      NULL);
	}
#else
	tex3d = cogl_texture_3d_new_from_data(CLUT_SIZE, CLUT_SIZE, CLUT_SIZE,
					      COGL_TEXTURE_NONE,
					      COGL_PIXEL_FORMAT_RGB_888,
					      COGL_PIXEL_FORMAT_RGB_888,
					      CLUT_SIZE * 3,
					      CLUT_SIZE * CLUT_SIZE * 3,
					      clut,
					      NULL);
#endif
	material = clutter_texture_get_cogl_material(CLUTTER_TEXTURE(rc->texture));
	cogl_material_set_layer(material, 1, tex3d);
	cogl_handle_unref(tex3d);
	DEBUG_3("%s clut end", get_exec_time());
	rc->clut_updated = TRUE;
}
Exemplo n.º 10
0
void init_exec_time(void)
{
	get_exec_time();
}