static void leo_loadcmap (struct fb_info_sbusfb *fb, struct display *p, int index, int count)
{
        struct leo_lx_krn *lx_krn = fb->s.leo.lx_krn;
	unsigned long flags;
	u32 tmp;
	int i;
	
	spin_lock_irqsave(&fb->lock, flags);
	sbus_writel(LEO_KRN_TYPE_CLUT0, &lx_krn->krn_type);
	i = leo_wait (lx_krn);
	if (i)
		goto out;
	sbus_writel(LEO_KRN_TYPE_CLUTDATA, &lx_krn->krn_type);
	for (i = 0; i < 256; i++) {
		u32 val;

		val = fb->color_map CM(i,0) |
			(fb->color_map CM(i,1) << 8) |
			(fb->color_map CM(i,2) << 16);

		sbus_writel(val, &lx_krn->krn_value); /* Throw colors there :)) */
	}
	sbus_writel(LEO_KRN_TYPE_CLUT0, &lx_krn->krn_type);
	tmp = sbus_readl(&lx_krn->krn_csr);
	tmp |= (LEO_KRN_CSR_UNK|LEO_KRN_CSR_UNK2);
	sbus_writel(tmp, &lx_krn->krn_csr);
out:
	spin_unlock_irqrestore(&fb->lock, flags);
}
示例#2
0
void fillWall(struct TILE *map, int sy, int sx, int ft, int wt){
	int y, x;
	for(y = 1; y < sy - 1; y++){
		for(x = 1; x < sx - 1; x++){
			if(map[CM(y,sx,x)].tT == TILE_BLANK){
				if(map[TL(y,sx,x)].tT == ft ||
				map[TM(y,sx,x)].tT == ft ||
				map[TR(y,sx,x)].tT == ft ||
				map[CL(y,sx,x)].tT == ft ||
				map[CR(y,sx,x)].tT == ft ||
				map[BL(y,sx,x)].tT == ft ||
				map[BM(y,sx,x)].tT == ft ||
				map[BR(y,sx,x)].tT == ft){
					map[CM(y,sx,x)].tT = wt;
				}
			}
		}
	}
	for(y = 0; y < sy; y++){
		for(x = 0; x < sx; x++){
			if(y == 0){
				if(map[S(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt;
			}
			if(x == 0){
				if(map[E(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt;
			}
			if(y == sy - 1){
				if(map[N(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt;
			}
			if(x == sx - 1){
				if(map[W(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt;
			}
		}
	}
}
示例#3
0
void fillMap(struct TILE *map, int sy, int sx, int tt){
	int y,x;
	for(y = 0; y < sy; y++){
		for(x = 0; x < sx; x++){
			map[CM(y,sx,x)].tX = x;
			map[CM(y,sx,x)].tY = y;
			map[CM(y,sx,x)].tT = tt;
		}
	}
}
示例#4
0
static void tcx_loadcmap (struct fb_info_sbusfb *fb, struct display *p, int index, int count)
{
	struct bt_regs *bt = fb->s.tcx.bt;
	int i;
                
	bt->addr = index << 24;
	for (i = index; count--; i++){
		bt->color_map = fb->color_map CM(i,0) << 24;
		bt->color_map = fb->color_map CM(i,1) << 24;
		bt->color_map = fb->color_map CM(i,2) << 24;
	}
	bt->addr = 0;
}
示例#5
0
static int sun3fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
			    u_int transp, struct fb_info *info)
{
	struct fb_info_sbusfb *fb = sbusfbinfo(info);

	if (!fb->color_map || regno > 255)
		return 1;
	red >>= 8;
	green >>= 8;
	blue >>= 8;
	fb->color_map CM(regno, 0) = red;
	fb->color_map CM(regno, 1) = green;
	fb->color_map CM(regno, 2) = blue;
	return 0;
}
示例#6
0
static int mp_set_audio_mute(TPMediaPlayer * mp,int mute)
{
    USERDATA(mp);
    CM(ud);

    int old_mute = ud->mute;

    ud->mute = mute ? 1 : 0;

    if ( old_mute != ud->mute )
    {
        if ( ud->mute )
        {
            ud->volume = clutter_media_get_audio_volume(cm);
            clutter_media_set_audio_volume(cm,0);
        }
        else
        {
            clutter_media_set_audio_volume(cm,ud->volume);
            ud->volume = 0;
        }
    }

    return 0;
}
示例#7
0
const MeshPotato::MPUtils::DeepPixelBuffer VDBRayMarcher::deepL(MPRay &ray, IntersectorT &intersector2, SamplerType &interpolator2) const {
	float deltaT;
	MeshPotato::MPUtils::DeepPixelBuffer deepPixelBuf;

	if (!intersector2.setWorldRay(ray)) return deepPixelBuf;
        double step = mImpl->table.findDoubleAttr("step");	
	double K = mImpl->table.findDoubleAttr("K");
	double t0 = 0, t1 = 0;
	while (int n = intersector2.march(t0, t1)) {
		for (float time = step*ceil(t0/step); time <= t1; time += step) {
				MPVec3 P = intersector2.getWorldPos(time);
				double density = interpolator2.wsSample(P);

				if (density > 0) {
					deltaT = exp(-K*density*step);
					Color CM(1,1,1,1);
	                		Color CI = mImpl->dsm->eval(P);
					Color CS = CI*CM;

					MeshPotato::MPUtils::DeepPixel deepPixel;

	            
					Color _L = ((CS)*(1 - deltaT));
					deepPixel.color = _L;
					deepPixel.color[3] = 1.0 - deltaT;
					deepPixel.depth_front = (P - mImpl->camera->eye()).length();//(ray(time)).dot(cam.view());
					deepPixelBuf.push_back(deepPixel);
				}
		}

	}
	return deepPixelBuf;
}
示例#8
0
/* Home cursor (left top corner) */
void
HO(void)
{
	argc=1;
	args[0]=args[1]=1;
	CM();
}
示例#9
0
MeshPotato::MPUtils::Color RayMarcher::L(MPRay &ray) const {
        Color _L = Color(0,0,0,0);
        float deltaT;
        float _T = 1.0f;
        float time = 0.0f;
        double t0 = ray.t0(), t1 = ray.t1();
	time = t0;
		double step = mImpl->table.findDoubleAttr("step");
		double K = mImpl->table.findDoubleAttr("K");
        while (time < t1) {
                        time += step;
                        while (time < t1) {
                        MeshPotato::MPUtils::MPVec3 P = ray(time);
                        float density = mImpl->grid->eval(P);
                        if (density > 0) {
                                deltaT = exp(-K * density * step);
				Color CI = mImpl->dsm->eval(P); 
				Color CM(1,1,1,1);
				Color CS = CI*CM;
//                              Color CS = density * (Color(1.0, 1.0, 1.0, 1.0) * exp(-dsm->eval(P) * K));
                                _L += ((CS) * _T * (1.0 - deltaT));
                                _T *=deltaT;
                                if (_T < 0.0000001) break;
                        }
                        time += step;
                	}
        }
        return Color(_L[0],_L[1],_L[2],1.0 - _T);
}
示例#10
0
const MeshPotato::MPUtils::Color VDBRayMarcher::L(MPRay &ray, IntersectorT &intersector2, SamplerType &interpolator2) const {
	Color _L = Color(0,0,0,0);
	float deltaT;
	float _T = 1.0f;
	float time = 0.0f;
        double step = mImpl->table.findDoubleAttr("step");
        double K = mImpl->table.findDoubleAttr("K");	
	if (!intersector2.setWorldRay(ray)) return _L;
	double t0 = 0, t1 = 0;
	while (int n = intersector2.march(t0, t1)) {
		for (double time = step*ceil(t0/step); time <= t1; time += step) {
				MPVec3 P = intersector2.getWorldPos(time);
				double density = interpolator2.wsSample(P);

				if (density > 0) {
					deltaT = exp(-K*density*step);
					Color CM(1,1,1,1);
			                Color CI = mImpl->dsm->eval(P);
			                Color CS = CI*CM;
	            
					_L += ((CS)*_T*(1.0 - deltaT));
					_T *=deltaT;
					if (_T < 0.0000001) return Color(_L[0],_L[1],_L[2],1.0 - _T);
				}
		}

	}
	return Color(_L[0],_L[1],_L[2],1.0 - _T);
}
示例#11
0
static void disconnect_loading_messages(TPMediaPlayer * mp)
{
    USERDATA(mp);
    CM(ud);

    if (!ud->load_signal)
        return;

#if (CLUTTER_GST_MAJOR_VERSION<1)
    GstElement * pipeline=clutter_gst_video_texture_get_playbin(CLUTTER_GST_VIDEO_TEXTURE(cm));
#else
    GstElement * pipeline=clutter_gst_video_texture_get_pipeline(CLUTTER_GST_VIDEO_TEXTURE(cm));
#endif

    if (!pipeline)
        return;

    GstBus * bus=gst_pipeline_get_bus(GST_PIPELINE(pipeline));

    if (!bus)
        return;

    g_signal_handler_disconnect(bus,ud->load_signal);
    ud->load_signal=0;

    gst_object_unref(GST_OBJECT(bus));
}
示例#12
0
static int mp_pause(TPMediaPlayer * mp)
{
    USERDATA(mp);
    CM(ud);

    clutter_media_set_playing(cm,FALSE);
    return 0;
}
示例#13
0
static int mp_get_duration(TPMediaPlayer * mp,double * seconds)
{
    USERDATA(mp);
    CM(ud);

    *seconds=clutter_media_get_duration(cm);
    return 0;
}
unsigned long oom_badness_low(struct task_struct *p, struct mem_cgroup *memcg,
			  const nodemask_t *nodemask, unsigned long totalpages)
{
	long points;
	long adj;

	if (oom_unkillable_task(p, memcg, nodemask))
		return 0;

	p = find_lock_task_mm(p);
	if (!p)
		return 0;

	adj = (long)p->signal->oom_score_adj;
	if (adj == OOM_SCORE_ADJ_MIN) {
		task_unlock(p);
		return 0;
	}

	/*
	 * The baseline for the badness score is the proportion of RAM that each
	 * task's rss, pagetable and swap space use.
	 */
	points = CM(get_mm_counter(p->mm, MM_LOW_FILEPAGES)) +
		CM(get_mm_counter(p->mm, MM_LOW_ANONPAGES)) +
		p->mm->nr_ptes;
	task_unlock(p);

	/*
	 * Root processes get 3% bonus, just like the __vm_enough_memory()
	 * implementation used by LSMs.
	 */
	if (has_capability_noaudit(p, CAP_SYS_ADMIN))
		adj -= 30;

	/* Normalize to oom_score_adj units */
	adj *= totalpages / 1000;
	points += adj;

	/*
	 * Never return 0 for an eligible task regardless of the root bonus and
	 * oom_score_adj (oom_score_adj can't be OOM_SCORE_ADJ_MIN here).
	 */
	return points > 0 ? points : 1;
}
示例#15
0
static int mp_get_audio_mute(TPMediaPlayer * mp,int * mute)
{
    USERDATA(mp);
    CM(ud);

    *mute = ud->mute;

    return 0;
}
示例#16
0
static int mp_set_viewport_geometry(TPMediaPlayer * mp,int left,int top,int width,int height)
{
    USERDATA(mp);
    CM(ud);

    clutter_actor_set_position(CLUTTER_ACTOR(cm),left,top);
    clutter_actor_set_size(CLUTTER_ACTOR(cm),width,height);
    return 0;
}
示例#17
0
static int mp_get_buffered_duration(TPMediaPlayer * mp,double * start_seconds,double * end_seconds)
{
    USERDATA(mp);
    CM(ud);

    *start_seconds=0;
    *end_seconds=clutter_media_get_duration(cm) * clutter_media_get_buffer_fill(cm);
    return 0;
}
示例#18
0
void drawMap(){
	int y, x;
	for(y = WINSTARTY; y < WINENDX; y++){
		for(x = WINSTARTX; x < MAXWIDTH; x++){
			attron(COLOR_PAIR( TILE_INDEX[MAP[C( (y+VIEW->y - WINSTARTY), (MAPTAIL->tX + 1), (x+VIEW->x) )].tT].tColor) );
			mvaddch(y, x, TILE_INDEX[MAP[CM( (y+VIEW->y - WINSTARTY), (MAPTAIL->tX+1), (x+VIEW->x) )].tT].tChar);
			attroff(COLOR_PAIR( TILE_INDEX[MAP[C( (y+VIEW->y - WINSTARTY), (MAPTAIL->tX + 1), (x+VIEW->x) )].tT].tColor) );
		}
	}
}
示例#19
0
static int mp_seek(TPMediaPlayer * mp,double seconds)
{
    USERDATA(mp);
    CM(ud);

    if (!clutter_media_get_can_seek(cm))
        return 1;
    clutter_media_set_progress(cm,seconds/clutter_media_get_duration(cm));
    return 0;
}
示例#20
0
static int mp_load(TPMediaPlayer * mp,const char * uri,const char * extra)
{
    USERDATA(mp);
    CM(ud);

    clutter_media_set_uri(cm,uri);

#if (CLUTTER_GST_MAJOR_VERSION<1)
    GstElement * pipeline=clutter_gst_video_texture_get_playbin(CLUTTER_GST_VIDEO_TEXTURE(cm));
#else
    GstElement * pipeline=clutter_gst_video_texture_get_pipeline(CLUTTER_GST_VIDEO_TEXTURE(cm));
#endif

    if (!pipeline)
        return 1;

    GstStateChangeReturn r=gst_element_set_state(pipeline,GST_STATE_PAUSED);

    g_debug("STATE CHANGE RETURN IS %d",r);

    switch(r)
    {
        case GST_STATE_CHANGE_FAILURE:
        {
            return 2;
        }

        case GST_STATE_CHANGE_SUCCESS:
        case GST_STATE_CHANGE_NO_PREROLL:
        {
            get_stream_information(mp);
            tp_media_player_loaded(mp);
            break;
        }

        case GST_STATE_CHANGE_ASYNC:
        {
            // The state change happens asynchronously, so we connect a signal
            // handler to see when it is done

            GstBus * bus=gst_pipeline_get_bus(GST_PIPELINE(pipeline));

            if (!bus)
                return 3;

            ud->load_signal=g_signal_connect(bus,"message",G_CALLBACK(loading_messages),mp);

            gst_object_unref(GST_OBJECT(bus));

            break;
        }
    }

    return 0;
}
示例#21
0
static int mp_play(TPMediaPlayer * mp)
{
    USERDATA(mp);
    CM(ud);

    clutter_media_set_playing(cm,TRUE);

    if (ud->media_type&TP_MEDIA_TYPE_VIDEO)
        clutter_actor_show(CLUTTER_ACTOR(cm));
    return 0;
}
示例#22
0
matrix4x4 matrix4x4::transpose() const
    {
    matrix4x4 ret;
    for( unsigned int x=0; x<4; x++ )
        {
        for( unsigned int y=0; y<4; y++ )
            {
            ret.RM(x,y) = CM(x,y);
            }
        }
    return ret;
    }
示例#23
0
static void ffb_loadcmap (struct fb_info_sbusfb *fb, struct display *p, int index, int count)
{
	struct ffb_dac *dac = fb->s.ffb.dac;
	unsigned long flags;
	int i, j = count;
	
	spin_lock_irqsave(&fb->lock, flags);
	upa_writel(0x2000 | index, &dac->type);
	for (i = index; j--; i++) {
		u32 val;

		/* Feed the colors in :)) */
		val = ((fb->color_map CM(i,0))) |
			((fb->color_map CM(i,1)) << 8) |
			((fb->color_map CM(i,2)) << 16);
		upa_writel(val, &dac->value);
	}
	if (!p)
		goto out;
	for (i = index, j = count; i < 16 && j--; i++)
		((u32 *)p->dispsw_data)[i] = ((fb->color_map CM(i,0))) |
			      		     ((fb->color_map CM(i,1)) << 8) |
					     ((fb->color_map CM(i,2)) << 16);
out:
	spin_unlock_irqrestore(&fb->lock, flags);
}
示例#24
0
static int mp_get_viewport_geometry(TPMediaPlayer * mp,int * left,int * top,int * width,int * height)
{
    USERDATA(mp);
    CM(ud);

    gfloat x,y,w,h;
    clutter_actor_get_position(CLUTTER_ACTOR(cm),&x,&y);
    clutter_actor_get_size(CLUTTER_ACTOR(cm),&w,&h);
    *left=x;
    *top=y;
    *width=w;
    *height=h;
    return 0;
}
示例#25
0
void initialize_grid(struct grid *g, struct parList *pars)
{
    int i;
    int nx = g->nx;
    int nq = g->nq;

    for(i=0; i<nx; i++)
    {
        double xm = g->x[i];
        double xp = g->x[i+1];
        double x = CM(xm,xp);
        initial_value(&(g->prim[nq*i]), x, pars);
    }
}
示例#26
0
static int mp_get_audio_volume(TPMediaPlayer * mp,double * volume)
{
    USERDATA(mp);
    CM(ud);

    if ( ud->mute )
    {
        * volume = ud->volume;
    }
    else
    {
        *volume=clutter_media_get_audio_volume(cm);
    }
    return 0;
}
示例#27
0
static int mp_set_audio_volume(TPMediaPlayer * mp,double volume)
{
    USERDATA(mp);
    CM(ud);

    if ( ud->mute )
    {
        ud->volume = volume;
    }
    else
    {
        clutter_media_set_audio_volume(cm,volume);
    }
    return 0;
}
示例#28
0
static void mp_reset(TPMediaPlayer * mp)
{
    USERDATA(mp);
    CM(ud);

    disconnect_loading_messages(mp);

    ud->video_width=0;
    ud->video_height=0;
    ud->media_type=0;

    // Reset should do more - it should truly forget all about the resource

    clutter_media_set_playing(cm,FALSE);
    clutter_media_set_progress(cm,0);

    clutter_actor_hide(CLUTTER_ACTOR(cm));
}
示例#29
0
static int sun3fb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue,
			  u_int *transp, struct fb_info *info)
{
	struct fb_info_sbusfb *fb = sbusfbinfo(info);

	if (!fb->color_map || regno > 255)
		return 1;
	*red = (fb->color_map CM(regno, 0)<<8) | fb->color_map CM(regno, 0);
	*green = (fb->color_map CM(regno, 1)<<8) | fb->color_map CM(regno, 1);
	*blue = (fb->color_map CM(regno, 2)<<8) | fb->color_map CM(regno, 2);
	*transp = 0;
	return 0;
}
示例#30
0
const char* to_str(GLenum val){
#define CM(T) case T: return # T
	switch(val){
		CM(GL_FLOAT);
		CM(GL_FLOAT_VEC2);
		CM(GL_FLOAT_VEC3);
		CM(GL_FLOAT_VEC4);
		CM(GL_INT);
		CM(GL_INT_VEC2);
		CM(GL_INT_VEC3);
		CM(GL_INT_VEC4);
		CM(GL_BOOL);
		CM(GL_BOOL_VEC2);
		CM(GL_BOOL_VEC3);
		CM(GL_BOOL_VEC4);
		CM(GL_FLOAT_MAT2);
		CM(GL_FLOAT_MAT3);
		CM(GL_FLOAT_MAT4);
		CM(GL_FLOAT_MAT2x3);
		CM(GL_FLOAT_MAT2x4);
		CM(GL_FLOAT_MAT3x2);
		CM(GL_FLOAT_MAT3x4);
		CM(GL_FLOAT_MAT4x2);
		CM(GL_FLOAT_MAT4x3);
		CM(GL_SAMPLER_1D);
		CM(GL_SAMPLER_2D);
		CM(GL_SAMPLER_3D);
		CM(GL_SAMPLER_CUBE);
		CM(GL_SAMPLER_1D_SHADOW);
		CM(GL_SAMPLER_2D_SHADOW);
	};
	return 0;
}