Example #1
0
 Renderer::Renderer(void)
 {
   this->driver = PF_NEW(RendererDriver);
   this->streamer = PF_NEW(TextureStreamer, *this);
   const TextureRequest req("Maps/default.tga", PF_TEX_FORMAT_PLAIN, GL_NEAREST, GL_NEAREST);
   Ref<Task> loadingTask = this->streamer->createLoadTask(req);
   loadingTask->scheduled();
   TaskingSystemWait(loadingTask);
   const TextureState state = this->streamer->getTextureState("Maps/default.tga");
   this->defaultTex = state.tex;
   FATAL_IF (defaultTex == false  || defaultTex->isValid() == false,
             "Default \"default.tga\" texture not found");
 }
Example #2
0
static ssize_t
background_show(struct kobject *kobj,
		struct kobj_attribute *attr,
		char *buf)
{
#ifndef CONFIG_ANDROID_LOW_MEMORY_KILLER
	return snprintf(buf, PAGE_SIZE, "0\n");
#else
	
	FATAL_IF(lowmemAdjSize != 6);
	return snprintf(buf, PAGE_SIZE, "%d\n",
			Balloon_AndroidBackgroundPages(lowmemAdj[4]));
#endif
}
Example #3
0
 void WinOpen(int w, int h) {
   int argc = 0;
   FATAL_IF(window, "A window is already opened");
   PF_MSG_V("GLUT: initialization");
   glutInitWindowSize(w, h);
   glutInitWindowPosition(64, 64);
   glutInit(&argc, NULL);
   glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
   glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
   PF_MSG_V("GLUT: creating window");
   window = glutCreateWindow("point-frag");
   previousInput = PF_NEW(InputControl);
   previousInput->processEvents();
 }
Example #4
0
LOCAL cl_context
cl_create_context(const cl_context_properties *  properties,
                  cl_uint                        num_devices,
                  const cl_device_id *           devices,
                  void (CL_CALLBACK * pfn_notify) (const char*, const void*, size_t, void*),
                  void *                         user_data,
                  cl_int *                       errcode_ret)
{
  /* cl_platform_id platform = NULL; */
  struct _cl_context_prop props;
  cl_context ctx = NULL;
  cl_int err = CL_SUCCESS;
  cl_uint prop_len = 0;
  /* XXX */
  FATAL_IF (num_devices != 1, "Only one device is supported");

  /* Check that we are getting the right platform */
  if (UNLIKELY(((err = cl_context_properties_process(properties, &props, &prop_len)) != CL_SUCCESS)))
    goto error;

  /* We are good */
  if (UNLIKELY((ctx = cl_context_new(&props)) == NULL)) {
    err = CL_OUT_OF_HOST_MEMORY;
    goto error;
  }

  if(properties != NULL && prop_len > 0) {
    TRY_ALLOC (ctx->prop_user, CALLOC_ARRAY(cl_context_properties, prop_len));
    memcpy(ctx->prop_user, properties, sizeof(cl_context_properties)*prop_len);
  }
  ctx->prop_len = prop_len;
  /* Attach the device to the context */
  ctx->device = *devices;

  /* Save the user callback and user data*/
  ctx->pfn_notify = pfn_notify;
  ctx->user_data = user_data;

exit:
  if (errcode_ret != NULL)
    *errcode_ret = err;
  return ctx;
error:
  cl_context_delete(ctx);
  ctx = NULL;
  goto exit;
}
/**
 * @brief initialize mutex
 * @param[in,out] mutex mutex to initialize
 */
void
Mutex_Init(Mutex *mutex)
{
	wait_queue_head_t *wq;
	int i;

	wq = kcalloc(MUTEX_CVAR_MAX + 1, sizeof(wait_queue_head_t), 0);
	FATAL_IF(wq == NULL);

	memset(mutex, 0, sizeof(*mutex));
	mutex->mtxHKVA = (HKVA)mutex;
	mutex->lockWaitQ = (HKVA)&wq[0];
	INITWAITQ(mutex->lockWaitQ);

	for (i = 0; i < MUTEX_CVAR_MAX; i++) {
		mutex->cvarWaitQs[i] = (HKVA)&wq[i + 1];
		INITWAITQ(mutex->cvarWaitQs[i]);
	}
}