void initGrabberMethod()
{
  if (method == AUTO) {
    L("No grabber method selected, auto-detecting...\n"); 
    if (initFlinger() != -1)
      method = FLINGER;
    else if (initGralloc()!=-1)
      method = GRALLOC;
    else if (initFB() != -1) {
      method = FRAMEBUFFER;
    }
    #if 0
    else if (initADB() != -1) {
      method = ADB;
      readBufferADB();
    }
    #endif
  } else if (method == FRAMEBUFFER)
    initFB();
  #if 0
  else if (method == ADB) {
    initADB(); 
    readBufferADB();
  }
  #endif
  else if (method == GRALLOC)
    initGralloc();
  else if (method == FLINGER)
    initFlinger();
}
示例#2
0
int glInit(void){
	if(debugmode) printf("DEBUG -- Initialising OpenGL \n");


	GLenum glewError = glewInit();
	if( glewError != GLEW_OK ){
		printf( "Error initializing GLEW! %s\n", glewGetErrorString( glewError ) );
		return FALSE;
	}
	glDisable(GL_DEPTH_TEST);
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);

	glEnable(GL_TEXTURE_2D);

	//todo move this stuff

	glViewport(0, 0, playwidth, playheight);
	glMatrixMode(GL_PROJECTION);// Select The Projection Matrix
	glLoadIdentity();// Reset The Projection Matrix
	glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, 0.1f, 100.0f); //maybe change
	glMatrixMode(GL_MODELVIEW);                     // Select The Modelview Matrix
	glLoadIdentity();                           // Reset The Modelview Matrix

	glColor3f(1.0f, 1.0f, 1.0f); //wont need this much longer


	//todo error checkelecking
	if(!initShader()) return FALSE;
	if(!initFB())	return FALSE;
//	glUseProgram(programobject);
	initVBO();

	return TRUE;
}
bool info_ennowelbers_proxyframebuffer_driver::start(IOService *provider)
{
	bool res=super::start(provider);
	if(res)
	{
		//in order to get a framebuffer up and working, we need to correctly configure powermanagement.
		//we're setting up three power states: off, on and usable.
		PMinit();
		getProvider()->joinPMtree(this);
		static IOPMPowerState myPowerStates[3];
		myPowerStates[0].version=1;
		myPowerStates[0].capabilityFlags=0;
		myPowerStates[0].outputPowerCharacter=0;
		myPowerStates[0].inputPowerRequirement=0;
		myPowerStates[1].version=1;
		myPowerStates[1].capabilityFlags=0;
		myPowerStates[1].outputPowerCharacter=0;
		myPowerStates[1].inputPowerRequirement=IOPMPowerOn;
		myPowerStates[2].version=1;
		myPowerStates[2].capabilityFlags=IOPMDeviceUsable;
		myPowerStates[2].outputPowerCharacter=IOPMPowerOn;
		myPowerStates[2].inputPowerRequirement=IOPMPowerOn;
		registerPowerDriver(this, myPowerStates, 3);
		//and we're switching to power state USABLE
		changePowerStateTo(2);
		//you need to to this AFTER setting power configuration.
		//at least that's what i recall
		registerService();
		IOLog("EWProxyFrameBuffer: start with maximum resolution %dx%d\n",getMaxWidth(),getMaxHeight());
		if(shouldInitFB())
		{
			IOLog("EWProxyFrameBuffer: Initializing Framebuffer. Unload from this point is impossible.\n");
			initFB();
		}
		else
		{
			IOLog("EWProxyFrameBuffer: Framebuffer initialization deactivated.\n");
		}
		//StartFramebuffer(640, 480);
	}
	//IOLog("Starting\n");
	return res;
}
示例#4
0
/**
 *	This is the systems main entry, some call it a boot thread.
 *
 *	-- Absolutely nothing wrong with this being called main(), just it doesn't have
 *	-- the same prototype as you'd see in a linux program.
 **/
int main(void) {
	SetGpioFunction(47, 1);			// RDY led

	initFB();
	SetGpio(47, 1);
	videotest();

	DisableInterrupts();
	InitInterruptController();

	xTaskCreate(task1, "LED_0", 128, NULL, 0, NULL);
	xTaskCreate(task2, "LED_1", 128, NULL, 0, NULL);

	vTaskStartScheduler();

	/*
	 *	We should never get here, but just in case something goes wrong,
	 *	we'll place the CPU into a safe loop.
	 */
	while(1) {
		;
	}
}
示例#5
0
文件: matbuild.c 项目: FairSky/ggnfs
int main(int argC, char *args[])
/****************************************************/
{ char       fbName[64], prelName[40], newRelName[64], depName[64], colName[64];
  char       str[128], line[128];
  int        i, qcbSize = DEFAULT_QCB_SIZE, seed=DEFAULT_SEED, retVal=0;
  u32        maxRelsInFF=MAX_RELS_IN_FF;
  double     startTime, stopTime;
  s32        totalRels, relsInFile;
  nfs_fb_t   FB;
  multi_file_t prelF, lpF;
  FILE      *fp;

  lxmalloc(4000000,0);
  prelF.numFiles = DEFAULT_NUM_FILES;
  lpF.numFiles = 0;
  prelF.prefix[0] = lpF.prefix[0]=0;
  fbName[0] = newRelName[0] = 0;
  strcpy(depName, DEFAULT_DEPNAME);
  strcpy(colName, DEFAULT_COLNAME);
  strcpy(lpF.prefix, DEFAULT_LPI_NAME);
  strcpy(prelF.prefix, DEFAULT_PRELPREFIX);
  line[0]=0;
  printf(START_MSG, GGNFS_VERSION);
  minFF=0;

  for (i=1; i<argC; i++) {
    if (strcmp(args[i], "-fb")==0) {
      if ((++i) < argC) 
        strncpy(fbName, args[i], 64);
    } else if (strcmp(args[i], "-cols")==0) {
      if ((++i) < argC) 
        strncpy(colName, args[i], 64);
    } else if (strcmp(args[i], "-prel")==0) {
      if ((++i) < argC) 
        strncpy(prelF.prefix, args[i], 32);
    } else if (strcmp(args[i], "-qs")==0) {
      if ((++i) < argC)
        qcbSize = atoi(args[i]);
    } else if (strcmp(args[i], "-minff")==0) {
      if ((++i) < argC)
        minFF = atoi(args[i]);
    } else if (strcmp(args[i], "-seed")==0) {
      if ((++i) < argC)
        seed = atoi(args[i]);
    } else if (strcmp(args[i], "-v")==0) {
      verbose++;
    } else if (strcmp(args[i], "-maxrelsinff")==0) {
      if ((++i) < argC) 
        maxRelsInFF = atoi(args[i]);
    }
  }
  maxRelsInFF=MIN(MAX_RELS_IN_FF,maxRelsInFF);
  srand(seed);
  startTime = sTime();

  if ((fbName[0]==0) || (prelF.prefix[0]==0)) {
    printf("USAGE: %s %s\n", args[0], USAGE);
    exit(0);
  }
  msgLog("", "GGNFS-%s : matbuild", GGNFS_VERSION);
  sprintf(prelName, "%s.%d", prelF.prefix, 0);
  initFB(&FB);
  if (loadFB(fbName, &FB)) {
    printf("Could not load FB from %s!\n", fbName);
    exit(-1);
  }

  if (minFF < FB.rfb_size + FB.afb_size + 64 + 32)
    minFF = FB.rfb_size + FB.afb_size + 64 + 32;
  if (verbose)
    printf("Getting QCB of size %d...\n", qcbSize);

  /* Very strange! Why is this being done here?? */
  generateQCB(&FB, qcbSize); 

  count_prelF(&prelF);

  totalRels=0;
  for (i=0; i<prelF.numFiles; i++) {
    sprintf(prelName, "%s.%d", prelF.prefix, i);
    if ((fp = fopen(prelName, "rb"))) {
      rewind(fp);
      fread(&relsInFile, sizeof(s32), 1, fp);
      fclose(fp);
    }
    totalRels += relsInFile;
  }

  finalFF = getCols(colName, &prelF, &lpF, &FB, minFF, maxRelsInFF);
  msgLog("", "Heap stats for matbuild run.");
  logHeapStats();

  if (finalFF > 0)
    msgLog("", "rels:%" PRId32 ", initialFF:%" PRId32 ", finalFF:%" PRId32, 
           initialRelations, initialFF, finalFF);
  if (finalFF < minFF) {
    printf("More columns needed (current = %" PRId32 ", min = %" PRId32 ")\n",
           finalFF, minFF);
    exit(0);
  }

  /* Write some header information that will eventually be needed
     in the `deps' file.
  */
  if (!(fp = fopen("depinf", "wb"))) {
    fprintf(stderr, "Error opening %s for write!\n", "depinf");
  } else {
    sprintf(str, "NUMCOLS: %8.8" PRIx32, finalFF); writeBinField(fp, str);
    sprintf(str, "COLNAME: %s.index", colName); writeBinField(fp, str);
    sprintf(str, "MAXRELS: %8.8" PRIx32, totalRels); writeBinField(fp, str);
    sprintf(str, "RELPREFIX: %s", prelF.prefix); writeBinField(fp, str);
    sprintf(str, "RELFILES: %x", prelF.numFiles); writeBinField(fp, str);
    sprintf(str, "LPFPREFIX: %s", lpF.prefix); writeBinField(fp, str);
    sprintf(str, "LPFFILES: %x", lpF.numFiles); writeBinField(fp, str);
    sprintf(str, "END_HEADER"); writeBinField(fp, str);
    fclose(fp);
  }
  printf("`depinf' written. You can now run matprune.\n");
  msgLog("", "depinf file written. Run matprune.");

  stopTime = sTime();
  printf("Total elapsed time: %1.2lf seconds.\n", stopTime-startTime);

  return retVal;
}
示例#6
0
/**
 * INIT
 */
int handleINIT(sessionid_t sessionid, bus_t bus, char *device,
               char *parameter, char *reply)
{
    struct timeval time;
    int rc = SRCP_UNSUPPORTEDDEVICEGROUP;

    /*INIT <bus> GL "<addr> <protocol> <optional further parameters>" */
    if (bus_has_devicegroup(bus, DG_GL)
        && strncasecmp(device, "GL", 2) == 0) {
        long addr, protversion, n_fs, n_func, nelem;
        char prot;
        nelem =
            sscanf(parameter, "%ld %c %ld %ld %ld", &addr, &prot,
                   &protversion, &n_fs, &n_func);
        if (nelem >= 5) {
            sessionid_t lockid = 0;
            /* Only if not locked !! */
            cacheGetLockGL(bus, addr, &lockid);
            if (lockid == 0 || lockid == sessionid) {
                rc = cacheInitGL(bus, addr, prot, protversion, n_fs, n_func);
            }
            else {
                rc = SRCP_DEVICELOCKED;
            }
        }
        else {
            rc = SRCP_LISTTOOSHORT;
        }
    }

    else if (bus_has_devicegroup(bus, DG_GA)
             && strncasecmp(device, "GA", 2) == 0) {
        long addr, nelem;
        char prot;
        nelem = sscanf(parameter, "%ld %c", &addr, &prot);
        if (nelem >= 2) {
            rc = initGA(bus, addr, prot);
        }
        else {
            rc = SRCP_LISTTOOSHORT;
        }
    }

    else if (bus_has_devicegroup(bus, DG_FB)
             && strncasecmp(device, "FB", 2) == 0) {
        long addr, index, nelem;
        char prot;
        nelem = sscanf(parameter, "%ld %c %ld", &addr, &prot, &index);
        if (nelem >= 3) {
            rc = initFB(bus, addr, prot, index);
        }
        else {
            rc = SRCP_LISTTOOSHORT;
        }
    }

    else if (bus_has_devicegroup(bus, DG_POWER)
             && strncasecmp(device, "POWER", 5) == 0) {
        rc = initPower(bus);
    }

    else if (bus_has_devicegroup(bus, DG_TIME)
             && strncasecmp(device, "TIME", 4) == 0) {
        int nelem;
        long rx, ry;
        nelem = sscanf(parameter, "%ld %ld", &rx, &ry);
        if (nelem >= 2) {
            rc = initTIME(rx, ry);      /* checks also values! */
        }
        else {
            rc = SRCP_LISTTOOSHORT;
        }
    }

    /* INIT <bus> SM "<protocol>" */
    else if (bus_has_devicegroup(bus, DG_SM)
             && strncasecmp(device, "SM", 2) == 0) {
        int result;
        char protocol[MAXSRCPLINELEN];

        result = sscanf(parameter, "%s", protocol);
        if (result < 1)
            rc = SRCP_LISTTOOSHORT;
        else if (strncasecmp(protocol, "NMRA", 4) == 0)
            rc = infoSM(bus, INIT, 0, -1, NMRA, 0, 0, reply);
        else
            rc = SRCP_WRONGVALUE;
    }

    gettimeofday(&time, NULL);
    srcp_fmt_msg(rc, reply, time);
    return rc;
}