コード例 #1
0
static struct nvhost_hwctx *ctx3d_alloc(struct nvhost_channel *ch)
{
	struct nvhost_hwctx *ctx;
	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
	if (!ctx)
		return NULL;
	ctx->restore = nvmap_alloc(context_restore_size * 4, 32,
				NVMEM_HANDLE_WRITE_COMBINE,
				(void**)&ctx->save_cpu_data);
	if (IS_ERR_OR_NULL(ctx->restore)) {
		kfree(ctx);
		return NULL;
	}
	setup_restore(ctx->save_cpu_data, NVWAITBASE_3D);
	ctx->channel = ch;
	ctx->restore_phys = nvmap_pin_single(ctx->restore);
	ctx->restore_size = context_restore_size;
	ctx->save = context_save_buf;
	ctx->save_phys = context_save_phys;
	ctx->save_size = context_save_size;
	ctx->save_incrs = 3;
	ctx->restore_incrs = 1;
	ctx->valid = false;
	kref_init(&ctx->ref);
	return ctx;
}
コード例 #2
0
ファイル: main.c プロジェクト: prophile/dim3
void app_report_error_ask_fix_setup(char *err_str)
{
#ifdef D3_OS_MAC	
	short					hit;
	char					str[256];
	unsigned char			p_str[256];
	AlertStdAlertParamRec	alert_param;
	
	InitCursor();
	
	memset(&alert_param,0x0,sizeof(AlertStdAlertParamRec));
	alert_param.defaultText="\pYes";
	alert_param.cancelText="\pNo";
	alert_param.defaultButton=kAlertStdAlertOKButton;
	alert_param.position=kWindowDefaultPosition;
	
	strcpy(str,err_str);
	strncat(str,"\n\nClick the Yes button if you want dim3 to reset your setup to their default values.  This might allow you to start the application properly.",256);
	str[255]=0x0;
	
	CopyCStringToPascal(str,p_str);

	StandardAlert(0,"\pdim3 Fatal Error",p_str,&alert_param,&hit);
	
	if (hit==kAlertStdAlertOKButton) setup_restore();
#endif

#ifdef D3_OS_LINUX
	app_report_error("Check your setup files.");
#endif

#ifdef D3_OS_WINDOWS
	char			str[1024];

	strcpy(str,err_str);
	strncat(str,"\n\nClick the Yes button if you want dim3 to reset your setup to their default values.  This might allow you to start the application properly.",1024);
	str[1023]=0x0;

	if (MessageBox(NULL,str,"dim3 Fatal Error",MB_YESNO)==IDYES) setup_restore();
#endif
}
コード例 #3
0
static int ctx3d_init(struct nvhost_hwctx *ctx)
{
	ctx->restore = nvmap_alloc(context_restore_size * 4, 32,
				NVMEM_HANDLE_WRITE_COMBINE,
				(void**)&ctx->save_cpu_data);
	if (IS_ERR_OR_NULL(ctx->restore))
		return PTR_ERR(ctx->restore);

	setup_restore(ctx->save_cpu_data, NVWAITBASE_3D);
	ctx->restore_phys = nvmap_pin_single(ctx->restore);
	ctx->restore_size = context_restore_size;
	ctx->save = context_save_buf;
	ctx->save_phys = context_save_phys;
	ctx->save_size = context_save_size;
	ctx->save_incrs = 3;
	ctx->restore_incrs = 1;
	ctx->valid = false;
	return 0;
}
コード例 #4
0
ファイル: rados-fd.c プロジェクト: karcaw/bareos-contrib
/*
 * Handle an event that was generated in Bareos
 */
static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
   bRC retval;
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

   if (!p_ctx) {
      return bRC_Error;
   }

   switch (event->eventType) {
   case bEventLevel:
      p_ctx->backup_level = (int64_t)value;
      retval = bRC_OK;
      break;
   case bEventSince:
      p_ctx->since = (int64_t)value;
      retval = bRC_OK;
      break;
   case bEventRestoreCommand:
      retval = parse_plugin_definition(ctx, value);
      if (retval == bRC_OK) {
         retval = setup_restore(ctx, value);
      }
      break;
   case bEventBackupCommand:
      retval = parse_plugin_definition(ctx, value);
      if (retval == bRC_OK) {
         retval = setup_backup(ctx, value);
      }
      break;
   case bEventPluginCommand:
      retval = parse_plugin_definition(ctx, value);
      break;
   case bEventNewPluginOptions:
      /*
       * Free any previous value.
       */
      if (p_ctx->plugin_options) {
         free(p_ctx->plugin_options);
         p_ctx->plugin_options = NULL;
      }

      retval = parse_plugin_definition(ctx, value);

      /*
       * Save that we got a plugin override.
       */
      p_ctx->plugin_options = bstrdup((char *)value);
      break;
   case bEventEndRestoreJob:
      retval = end_restore_job(ctx, value);
      break;
   default:
      Jmsg(ctx, M_FATAL, "rados-fd: unknown event=%d\n", event->eventType);
      Dmsg(ctx, dbglvl, "rados-fd: unknown event=%d\n", event->eventType);
      retval = bRC_Error;
      break;
   }

   return retval;
}