Lines Matching refs:hwc_dev
54 static bool is_valid_display(omap_hwc_device_t* hwc_dev, int disp) in is_valid_display() argument
56 if (disp < 0 || disp >= MAX_DISPLAYS || !hwc_dev->displays[disp]) in is_valid_display()
120 static void get_connectors(omap_hwc_device_t* hwc_dev) in get_connectors() argument
126 for (auto connector : hwc_dev->card->get_connectors()) { in get_connectors()
129 hwc_dev->primaryConector = connector; in get_connectors()
137 hwc_dev->primaryConector = connector; in get_connectors()
144 for (auto connector : hwc_dev->card->get_connectors()) { in get_connectors()
146 hwc_dev->externalConector = connector; in get_connectors()
152 static int init_primary_display(omap_hwc_device_t* hwc_dev) in init_primary_display() argument
154 if (hwc_dev->displays[HWC_DISPLAY_PRIMARY]) { in init_primary_display()
159 kms::Connector* connector = hwc_dev->primaryConector; in init_primary_display()
162 hwc_dev->displays[HWC_DISPLAY_PRIMARY] = display; in init_primary_display()
192 display->disp_link.card = hwc_dev->card; in init_primary_display()
205 static int add_external_hdmi_display(omap_hwc_device_t* hwc_dev) in add_external_hdmi_display() argument
207 if (hwc_dev->displays[HWC_DISPLAY_EXTERNAL]) { in add_external_hdmi_display()
212 kms::Connector* connector = hwc_dev->externalConector; in add_external_hdmi_display()
228 hwc_dev->displays[HWC_DISPLAY_EXTERNAL] = display; in add_external_hdmi_display()
238 display->disp_link.card = hwc_dev->card; in add_external_hdmi_display()
251 static void remove_external_hdmi_display(omap_hwc_device_t* hwc_dev) in remove_external_hdmi_display() argument
253 HWCDisplay* display = hwc_dev->displays[HWC_DISPLAY_EXTERNAL]; in remove_external_hdmi_display()
259 delete hwc_dev->displays[HWC_DISPLAY_EXTERNAL]; in remove_external_hdmi_display()
260 hwc_dev->displays[HWC_DISPLAY_EXTERNAL] = NULL; in remove_external_hdmi_display()
263 static void handle_hotplug(omap_hwc_device_t* hwc_dev, bool state) in handle_hotplug() argument
266 int err = add_external_hdmi_display(hwc_dev); in handle_hotplug()
268 remove_external_hdmi_display(hwc_dev); in handle_hotplug()
273 remove_external_hdmi_display(hwc_dev); in handle_hotplug()
278 static int find_hdmi_connector_status(omap_hwc_device_t* hwc_dev) in find_hdmi_connector_status() argument
280 auto connector = hwc_dev->externalConector; in find_hdmi_connector_status()
296 static bool check_hotplug_status(omap_hwc_device_t* hwc_dev, bool old_state) in check_hotplug_status() argument
298 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in check_hotplug_status()
300 bool state = find_hdmi_connector_status(hwc_dev); in check_hotplug_status()
302 handle_hotplug(hwc_dev, state); in check_hotplug_status()
306 if (hwc_dev->cb_procs) { in check_hotplug_status()
307 if (hwc_dev->cb_procs->hotplug) in check_hotplug_status()
308 hwc_dev->cb_procs->hotplug(hwc_dev->cb_procs, HWC_DISPLAY_EXTERNAL, state); in check_hotplug_status()
309 if (hwc_dev->cb_procs->invalidate) in check_hotplug_status()
310 hwc_dev->cb_procs->invalidate(hwc_dev->cb_procs); in check_hotplug_status()
318 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)data; in hwc_hdmi_thread() local
337 bool state = check_hotplug_status(hwc_dev, false); in hwc_hdmi_thread()
352 state = check_hotplug_status(hwc_dev, state); in hwc_hdmi_thread()
366 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)data; in hwc_drm_event_thread() local
371 pfds.fd = hwc_dev->card->fd(), in hwc_drm_event_thread()
420 static int hwc_prepare_for_display(omap_hwc_device_t* hwc_dev, int disp, hwc_display_contents_1_t* … in hwc_prepare_for_display() argument
422 if (!is_valid_display(hwc_dev, disp)) in hwc_prepare_for_display()
425 HWCDisplay* display = hwc_dev->displays[disp]; in hwc_prepare_for_display()
447 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_prepare() local
448 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_prepare()
463 int disp_err = hwc_prepare_for_display(hwc_dev, i, contents); in hwc_prepare()
472 static int hwc_set_for_display(omap_hwc_device_t* hwc_dev, int disp, hwc_display_contents_1_t* cont… in hwc_set_for_display() argument
474 if (!is_valid_display(hwc_dev, disp)) in hwc_set_for_display()
477 HWCDisplay* display = hwc_dev->displays[disp]; in hwc_set_for_display()
516 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_set() local
517 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_set()
532 int disp_err = hwc_set_for_display(hwc_dev, i, contents); in hwc_set()
543 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_eventControl() local
544 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_eventControl()
546 if (!is_valid_display(hwc_dev, disp)) in hwc_eventControl()
552 hwc_dev->displays[disp]->cb_procs = hwc_dev->cb_procs; in hwc_eventControl()
555 return hwc_dev->displays[disp]->set_vsync_state(enabled); in hwc_eventControl()
566 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_blank() local
567 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_blank()
571 if (!is_valid_display(hwc_dev, disp)) in hwc_blank()
574 hwc_dev->displays[disp]->blank(blank); in hwc_blank()
581 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_query() local
582 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_query()
606 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_registerProcs() local
607 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_registerProcs()
609 hwc_dev->cb_procs = (typeof(hwc_dev->cb_procs))procs; in hwc_registerProcs()
613 hwc_dev->hdmi_thread = new std::thread(hwc_hdmi_thread, hwc_dev); in hwc_registerProcs()
621 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_getDisplayConfigs() local
622 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_getDisplayConfigs()
624 if (!is_valid_display(hwc_dev, disp)) in hwc_getDisplayConfigs()
627 HWCDisplay* display = hwc_dev->displays[disp]; in hwc_getDisplayConfigs()
634 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)dev; in hwc_getDisplayAttributes() local
635 std::unique_lock<std::mutex> lock(hwc_dev->mutex); in hwc_getDisplayAttributes()
637 if (!is_valid_display(hwc_dev, disp)) in hwc_getDisplayAttributes()
640 HWCDisplay* display = hwc_dev->displays[disp]; in hwc_getDisplayAttributes()
647 omap_hwc_device_t* hwc_dev = (omap_hwc_device_t*)device; in hwc_device_close() local
649 if (hwc_dev) { in hwc_device_close()
650 if (hwc_dev->event_thread) in hwc_device_close()
651 delete hwc_dev->event_thread; in hwc_device_close()
654 delete hwc_dev->displays[i]; in hwc_device_close()
656 delete hwc_dev; in hwc_device_close()
667 omap_hwc_device_t* hwc_dev = new omap_hwc_device_t; in hwc_device_open() local
668 memset(hwc_dev, 0, sizeof(*hwc_dev)); in hwc_device_open()
671 hwc_dev->card = new kms::Card(); in hwc_device_open()
674 get_connectors(hwc_dev); in hwc_device_open()
676 int ret = init_primary_display(hwc_dev); in hwc_device_open()
682 hwc_dev->event_thread = new std::thread(hwc_drm_event_thread, hwc_dev); in hwc_device_open()
684 hwc_dev->device.common.tag = HARDWARE_DEVICE_TAG; in hwc_device_open()
685 hwc_dev->device.common.version = HWC_DEVICE_API_VERSION_1_1; in hwc_device_open()
686 hwc_dev->device.common.module = (hw_module_t*)module; in hwc_device_open()
687 hwc_dev->device.common.close = hwc_device_close; in hwc_device_open()
688 hwc_dev->device.prepare = hwc_prepare; in hwc_device_open()
689 hwc_dev->device.set = hwc_set; in hwc_device_open()
690 hwc_dev->device.eventControl = hwc_eventControl; in hwc_device_open()
691 hwc_dev->device.blank = hwc_blank; in hwc_device_open()
692 hwc_dev->device.query = hwc_query; in hwc_device_open()
693 hwc_dev->device.registerProcs = hwc_registerProcs; in hwc_device_open()
694 hwc_dev->device.getDisplayConfigs = hwc_getDisplayConfigs; in hwc_device_open()
695 hwc_dev->device.getDisplayAttributes = hwc_getDisplayAttributes; in hwc_device_open()
697 *device = &hwc_dev->device.common; in hwc_device_open()