int main() { printf("Expected result: Program should print \"deadlock prevented!\" and exit.\n"); printf("... valgrind won't run clean if exit() is called without calls to _destroy(). This is fine.\n"); printf("... this program should print right away and exit. If it takes longer than a second, it likely deadlocked.\n"); drm_setmode(DEADLOCK_PREVENTION); drm_init(&m1); drm_init(&m2); pthread_t t1, t2; pthread_create(&t1, NULL, count_up, NULL); pthread_create(&t2, NULL, count_down, NULL); pthread_join(t1, NULL); pthread_join(t2, NULL); drm_destroy(&m1); drm_destroy(&m2); drm_cleanup(); printf("%d\n", x); return 0; }
int main() { printf("Expected result: Program should print \"Deadlock detected! Edges: 1 -> 2, 2 -> 1\", where 1 and 2 will be specific thread_ids.\n"); printf("... after that, the program should output a non-zero number (usually a number close to 100000 or -100000).\n"); printf("... as you run your program multiple times, the number should vary between positive and negative.\n"); printf(" ...remember, the thread you send the signal to should be random, so you will be switching between killing the\n"); printf(" count_up() and the count_down() threads.\n"); printf("\n"); printf("... this program should exit within a second or two and exit. If it takes longer than 5 seconds, it likely deadlocked.\n"); printf("... due to how valgrind handles signals, the tester may not work under valgrind.\n"); printf("\n"); drm_setmode(DEADLOCK_DETECTION); drm_init(&m1); drm_init(&m2); pthread_t t1, t2; pthread_create(&t1, NULL, count_up, NULL); pthread_create(&t2, NULL, count_down, NULL); pthread_join(t1, NULL); pthread_join(t2, NULL); drm_destroy(&m1); drm_destroy(&m2); drm_cleanup(); printf("%d\n", x); return 0; }
static int __init radeon_init(void) { driver = &driver_old; driver->num_ioctls = radeon_max_ioctl; #ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force() && radeon_modeset == -1) { DRM_INFO("VGACON disable radeon kernel modesetting.\n"); driver = &driver_old; driver->driver_features &= ~DRIVER_MODESET; radeon_modeset = 0; } #endif /* if enabled by default */ if (radeon_modeset == -1) { #ifdef CONFIG_DRM_RADEON_KMS DRM_INFO("radeon defaulting to kernel modesetting.\n"); radeon_modeset = 1; #else DRM_INFO("radeon defaulting to userspace modesetting.\n"); radeon_modeset = 0; #endif } if (radeon_modeset == 1) { DRM_INFO("radeon kernel modesetting enabled.\n"); driver = &kms_driver; driver->driver_features |= DRIVER_MODESET; driver->num_ioctls = radeon_max_kms_ioctl; } /* if the vga console setting is enabled still * let modprobe override it */ return drm_init(driver); }
static int __init i915_init(void) { driver.num_ioctls = i915_max_ioctl; /* * If CONFIG_DRM_I915_KMS is set, default to KMS unless * explicitly disabled with the module pararmeter. * * Otherwise, just follow the parameter (defaulting to off). * * Allow optional vga_text_mode_force boot option to override * the default behavior. */ #if defined(CONFIG_DRM_I915_KMS) if (i915_modeset != 0) driver.driver_features |= DRIVER_MODESET; #endif if (i915_modeset == 1) driver.driver_features |= DRIVER_MODESET; #ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force() && i915_modeset == -1) driver.driver_features &= ~DRIVER_MODESET; #endif return drm_init(&driver); }
static int __init PVRSRVDrmInit(void) { int iRes; #if !defined(SUPPORT_DRI_DRM_EXTERNAL) sPVRDrmDriver.num_ioctls = pvr_max_ioctl; #endif PVRDPFInit(); #if defined(PVR_DRI_DRM_NOT_PCI) iRes = drm_pvr_dev_add(); if (iRes != 0) { return iRes; } #endif #if defined(SUPPORT_DRI_DRM_EXTERNAL) iRes = omap_drm_register_plugin(&plugin); pvr_ioctl_base = plugin.ioctl_base; pvr_mapper_id = omap_drm_register_mapper(); #else iRes = drm_init(&sPVRDrmDriver); #endif #if defined(PVR_DRI_DRM_NOT_PCI) if (iRes != 0) { drm_pvr_dev_remove(); } #endif return iRes; }
static IMG_INT __init PVRSRVDrmInit(void) { IMG_INT iRes; sPVRDrmDriver.num_ioctls = pvr_max_ioctl; PVRDPFInit(); #if defined(PVR_DRI_DRM_NOT_PCI) iRes = drm_pvr_dev_add(); if (iRes != 0) { return iRes; } #endif iRes = drm_init(&sPVRDrmDriver); #if defined(PVR_DRI_DRM_NOT_PCI) if (iRes != 0) { drm_pvr_dev_remove(); } #endif return iRes; }
int mali_drm_init(struct platform_device *dev) { printk(KERN_INFO "Mali DRM initialize, driver name: %s, version %d.%d\n", DRIVER_NAME, DRIVER_MAJOR, DRIVER_MINOR); driver.num_ioctls = 0; driver.platform_device = dev; return drm_init(&driver); }
static int __init vboxvideo_init(void) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61) return drm_init(&driver); #else return drm_pci_init(&driver, &pci_driver); #endif }
static int __init vboxvideo_init(void) { printk(KERN_INFO "vboxvideo initializing\n"); driver.num_ioctls = vboxvideo_max_ioctl; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) return drm_init(&driver); #else return drm_pci_init(&driver, &pci_driver); #endif }
static IMG_INT __init PVRSRVDrmInit(IMG_VOID) { IMG_INT iRes; sPVRDrmDriver.num_ioctls = pvr_max_ioctl; PVRDPFInit(); iRes = drm_init(&sPVRDrmDriver); return iRes; }
void MultiDisplayComposer::initialize_l() { ALOGV("IMDS-Native: MultiDisplayComposer.cpp: initialize_l"); if (!drm_init()) { ALOGE("%s: drm_init fails.", __func__); return; } mDrmInit = true; if (drm_hdmi_isSupported()) { mDisplayCapability |= MDS_HW_SUPPORT_HDMI; setModePolicy_l(MDS_HDMI_ON_ALLOWED); } setModePolicy_l(MDS_MIPI_OFF_NOT_ALLOWED); // start mipi listener run("MIPIListener", PRIORITY_URGENT_DISPLAY); }
static int __init i915_init(void) { if (!intel_agp_enabled) { DRM_ERROR("drm/i915 can't work without intel_agp module!\n"); return -ENODEV; } driver.num_ioctls = i915_max_ioctl; i915_gem_shrinker_init(); /* * If CONFIG_DRM_I915_KMS is set, default to KMS unless * explicitly disabled with the module pararmeter. * * Otherwise, just follow the parameter (defaulting to off). * * Allow optional vga_text_mode_force boot option to override * the default behavior. */ #if defined(CONFIG_DRM_I915_KMS) if (i915_modeset != 0) driver.driver_features |= DRIVER_MODESET; #endif if (i915_modeset == 1) driver.driver_features |= DRIVER_MODESET; #ifdef CONFIG_VGA_CONSOLE if (vgacon_text_force() && i915_modeset == -1) driver.driver_features &= ~DRIVER_MODESET; #endif if (!(driver.driver_features & DRIVER_MODESET)) { driver.suspend = i915_suspend; driver.resume = i915_resume; } return drm_init(&driver); }
static int __init i830_init(void) { driver.num_ioctls = i830_max_ioctl; return drm_init(&driver, pciidlist); }
/* 考虑到升级是个非常重要但又较少依赖其他模块的功能,因此即使大部分模块初始化失败,也一样要继续运行,只要组播功能正常即可。 */ void *main_thread() { DEBUG("main thread start...\n"); compile_timeprint(); _wLBM_zyzdmb(13578642); smarthome_gw_sn_init(); if(-1==setting_init()){ DEBUG("setting init failed\n"); //return NULL; } if(-1==push_decoder_buf_init()){ DEBUG("push decoder buf init failed\n"); //return NULL; } chanFilterInit(); smc_init(); if(-1==sqlite_init()){ DEBUG("sqlite init failed\n"); //return NULL; } setting_init_with_database(); maintenance_thread_init(); if(-1==xmlparser_init()){ DEBUG("xmlparser init failed\n"); //return NULL; } // return parse_xml("pushroot/pushinfo/1/ProductDesc.xml", PRODUCTDESC_XML, NULL); if(0!=drm_init()){ DEBUG("drm init failed\n"); //return NULL; } upgrade_info_init(); // 根据首次开机标记"/data/data/com.dbstar/files/flag"决定是否要重置国电网关序列号 smarthome_sn_init_when_network_init(); #if 0 /* 慎用:只有在需要清理已有授权、重新接收授权时使用,正式版本不能调用。 */ DEBUG("\n\nWarning: you call function CDCASTB_FormatBuffer, it is an unnormal action\n\n\n"); CDCASTB_FormatBuffer(); #endif if(-1==mid_push_init(PUSH_CONF)){ DEBUG("push model init with \"%s\" failed\n", PUSH_CONF); //return NULL; } if(-1==igmp_init()){ DEBUG("igmp init failed\n"); //return NULL; } if(-1==softdvb_init()){ DEBUG("dvb init with failed\n"); //return NULL; } smartlife_connect_init(); DEBUG("OK ================================ OK\n"); msg_send2_UI(STATUS_DVBPUSH_INIT_SUCCESS, NULL, 0); int main_running = 1; while(1==main_running) { pthread_mutex_lock(&mtx_main); /* 需要本线程先运行到这里,再在其他非父线程中执行pthread_cond_signal(&cond_push_monitor)才能生效。 */ pthread_cond_wait(&cond_main,&mtx_main); DEBUG("main thread is closed by external call\n"); main_running = 0; pthread_mutex_unlock(&mtx_main); } DEBUG("exit from main thread\n"); return NULL; }
static int __init mga_init(void) { driver.num_ioctls = mga_max_ioctl; return drm_init(&driver); }
static int __init i915_init(void) { driver.num_ioctls = i915_max_ioctl; return drm_init(&driver); }
static int __init sis_init(void) { driver.num_ioctls = sis_max_ioctl; return drm_init(&driver); }
static int __init via_chrome9_init(void) { driver.num_ioctls = via_chrome9_max_ioctl; driver.dev_priv_size = sizeof(struct drm_via_chrome9_private); return drm_init(&driver); }
static int __init tdfx_init(void) { return drm_init(&driver); }
static int __init r128_init(void) { driver.num_ioctls = r128_max_ioctl; return drm_init(&driver); }
static int __init via_init(void) { via_init_command_verifier(); return drm_init(&driver, pciidlist); }
static int __init radeon_init(void) { driver.num_ioctls = radeon_max_ioctl; return drm_init(&driver); }
static int __init i830_init(void) { return drm_init(&driver, pciidlist); }
static int __init via_init(void) { driver.num_ioctls = via_max_ioctl; via_init_command_verifier(); return drm_init(&driver); }