Lines Matching refs:fb_helper

68  * @fb_helper: fbdev initialized with drm_fb_helper_init
71 * fb_helper. This is a separate step to allow drivers to freely assign
78 int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
80 struct drm_device *dev = fb_helper->dev;
92 fb_helper->connector_info[fb_helper->connector_count++] = fb_helper_connector;
96 for (i = 0; i < fb_helper->connector_count; i++) {
97 kfree(fb_helper->connector_info[i], sizeof(struct drm_fb_helper_connector));
98 fb_helper->connector_info[i] = NULL;
100 fb_helper->connector_count = 0;
104 static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
106 struct drm_device *dev = fb_helper->dev;
112 for (i = 0; i < fb_helper->connector_count; i++) {
114 fb_helper_conn = fb_helper->connector_info[i];
173 bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
180 if (fb_helper == NULL)
183 dev = fb_helper->dev;
188 for (i = 0; i < fb_helper->crtc_count; i++) {
189 struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
225 static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
227 struct drm_device *dev = fb_helper->dev;
234 if (crtc->fb == fb_helper->fb)
261 struct drm_fb_helper *fb_helper,
267 fb_helper->dev = dev;
270 INIT_LIST_HEAD(&fb_helper->kernel_fb_list);
272 fb_helper->crtc_info = kcalloc(crtc_count, sizeof(struct drm_fb_helper_crtc), GFP_KERNEL);
273 if (!fb_helper->crtc_info)
276 fb_helper->crtc_count = crtc_count;
277 fb_helper->connector_info = kcalloc(dev->mode_config.num_connector, sizeof(struct drm_fb_helper_connector *), GFP_KERNEL);
278 if (!fb_helper->connector_info) {
279 kfree(fb_helper->crtc_info, sizeof(struct drm_fb_helper_crtc));
282 fb_helper->connector_count = 0;
285 fb_helper->crtc_info[i].mode_set.connectors =
290 if (!fb_helper->crtc_info[i].mode_set.connectors)
292 fb_helper->crtc_info[i].mode_set.num_connectors = 0;
297 fb_helper->crtc_info[i].mode_set.crtc = crtc;
303 drm_fb_helper_crtc_free(fb_helper);
307 void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
309 if (!list_empty(&fb_helper->kernel_fb_list)) {
310 list_del(&fb_helper->kernel_fb_list);
316 drm_fb_helper_crtc_free(fb_helper);
320 int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
341 for (i = 0; i < fb_helper->connector_count; i++) {
342 struct drm_fb_helper_connector *fb_helper_conn = fb_helper->connector_info[i];
372 for (i = 0; i < fb_helper->crtc_count; i++) {
374 desired_mode = fb_helper->crtc_info[i].desired_mode;
378 gamma_size = fb_helper->crtc_info[i].mode_set.crtc->gamma_size;
400 ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
411 for (i = 0; i < fb_helper->crtc_count; i++)
412 if (fb_helper->crtc_info[i].mode_set.num_connectors)
413 fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb;
422 list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list, (caddr_t)fb_helper);
427 static int drm_fb_helper_probe_connector_modes(struct drm_fb_helper *fb_helper,
435 for (i = 0; i < fb_helper->connector_count; i++) {
436 connector = fb_helper->connector_info[i]->connector;
520 static void drm_enable_connectors(struct drm_fb_helper *fb_helper,
527 for (i = 0; i < fb_helper->connector_count; i++) {
528 connector = fb_helper->connector_info[i]->connector;
538 for (i = 0; i < fb_helper->connector_count; i++) {
539 connector = fb_helper->connector_info[i]->connector;
544 static bool drm_target_cloned(struct drm_fb_helper *fb_helper,
554 if (fb_helper->crtc_count > 1)
558 for (i = 0; i < fb_helper->connector_count; i++) {
569 for (i = 0; i < fb_helper->connector_count; i++) {
572 fb_helper_conn = fb_helper->connector_info[i];
593 dmt_mode = drm_mode_find_dmt(fb_helper->dev, 1024, 768, 60, false);
595 for (i = 0; i < fb_helper->connector_count; i++) {
600 fb_helper_conn = fb_helper->connector_info[i];
617 static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
624 for (i = 0; i < fb_helper->connector_count; i++) {
625 fb_helper_conn = fb_helper->connector_info[i];
652 static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
658 struct drm_device *dev = fb_helper->dev;
667 if (n == fb_helper->connector_count)
672 fb_helper_conn = fb_helper->connector_info[n];
676 best_score = drm_pick_crtcs(fb_helper, best_crtcs, modes, n+1, width, height);
700 for (c = 0; c < fb_helper->crtc_count; c++) {
701 crtc = &fb_helper->crtc_info[c];
712 if (fb_helper->crtc_count > 1)
721 score = my_score + drm_pick_crtcs(fb_helper, crtcs, modes, n + 1,
735 static void drm_setup_crtcs(struct drm_fb_helper *fb_helper)
737 struct drm_device *dev = fb_helper->dev;
767 drm_enable_connectors(fb_helper, enabled);
769 if (!(fb_helper->funcs->initial_config &&
770 fb_helper->funcs->initial_config(fb_helper, crtcs, modes,
775 if (!drm_target_cloned(fb_helper,
777 !drm_target_preferred(fb_helper,
784 (void) drm_pick_crtcs(fb_helper, crtcs, modes, 0, width, height);
789 for (i = 0; i < fb_helper->crtc_count; i++) {
790 modeset = &fb_helper->crtc_info[i].mode_set;
795 for (i = 0; i < fb_helper->connector_count; i++) {
808 modeset->connectors[modeset->num_connectors++] = fb_helper->connector_info[i]->connector;
809 modeset->fb = fb_helper->fb;
814 for (i = 0; i < fb_helper->crtc_count; i++) {
815 modeset = &fb_helper->crtc_info[i].mode_set;
853 bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
855 struct drm_device *dev = fb_helper->dev;
858 (void) drm_fb_helper_parse_command_line(fb_helper);
860 count = drm_fb_helper_probe_connector_modes(fb_helper,
869 drm_setup_crtcs(fb_helper);
871 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
878 * @fb_helper: the drm_fb_helper
880 * Scan the connectors attached to the fb_helper and try to put together a
888 * Scan the connectors attached to the fb_helper and try to put together a
894 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
896 struct drm_device *dev = fb_helper->dev;
899 if (!fb_helper->fb)
902 mutex_lock(&fb_helper->dev->mode_config.mutex);
903 if (!drm_fb_helper_is_bound(fb_helper)) {
904 fb_helper->delayed_hotplug = true;
905 mutex_unlock(&fb_helper->dev->mode_config.mutex);
910 max_width = fb_helper->fb->width;
911 max_height = fb_helper->fb->height;
912 bpp_sel = fb_helper->fb->bits_per_pixel;
914 (void) drm_fb_helper_probe_connector_modes(fb_helper, max_width,
916 mutex_unlock(&fb_helper->dev->mode_config.mutex);
919 drm_setup_crtcs(fb_helper);
922 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);