Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm Support command-line modes by...



details:   https://anonhg.NetBSD.org/src/rev/5fdf7c69b14c
branches:  trunk
changeset: 341628:5fdf7c69b14c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Nov 14 13:27:29 2015 +0000

description:
Support command-line modes by picking up connector modes from the device
properties. The connector name is the key name in the device properties
dictionary.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_fb_helper.c |  14 +++-----
 sys/external/bsd/drm2/dist/drm/drm_modes.c     |  41 +++++++++++++++----------
 2 files changed, 30 insertions(+), 25 deletions(-)

diffs (165 lines):

diff -r 00bc82046978 -r 5fdf7c69b14c sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
--- a/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c    Sat Nov 14 11:55:36 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c    Sat Nov 14 13:27:29 2015 +0000
@@ -117,7 +117,6 @@
 }
 EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors);
 
-#ifndef __NetBSD__             /* XXX fb command line */
 static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
 {
        struct drm_fb_helper_connector *fb_helper_conn;
@@ -133,8 +132,14 @@
                mode = &fb_helper_conn->cmdline_mode;
 
                /* do something on return - turn off connector maybe */
+#if defined(__NetBSD__)
+               prop_dictionary_t prop = device_properties(connector->dev->dev);
+               if (prop_dictionary_get_cstring(prop, drm_get_connector_name(connector), &option) == false)
+                       continue;
+#else
                if (fb_get_options(drm_get_connector_name(connector), &option))
                        continue;
+#endif
 
                if (drm_mode_parse_command_line_for_connector(option,
                                                              connector,
@@ -171,7 +176,6 @@
        }
        return 0;
 }
-#endif
 
 static void drm_fb_helper_save_lut_atomic(struct drm_crtc *crtc, struct drm_fb_helper *helper)
 {
@@ -1207,9 +1211,6 @@
 struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
                                                      int width, int height)
 {
-#ifdef __NetBSD__              /* XXX fb command line */
-       return NULL;
-#else
        struct drm_cmdline_mode *cmdline_mode;
        struct drm_display_mode *mode = NULL;
        bool prefer_non_interlace;
@@ -1257,7 +1258,6 @@
                                                 cmdline_mode);
        list_add(&mode->head, &fb_helper_conn->connector->modes);
        return mode;
-#endif
 }
 EXPORT_SYMBOL(drm_pick_cmdline_mode);
 
@@ -1601,9 +1601,7 @@
        struct drm_device *dev = fb_helper->dev;
        int count = 0;
 
-#ifndef __NetBSD__             /* XXX fb command line */
        drm_fb_helper_parse_command_line(fb_helper);
-#endif
 
        mutex_lock(&dev->mode_config.mutex);
        count = drm_fb_helper_probe_connector_modes(fb_helper,
diff -r 00bc82046978 -r 5fdf7c69b14c sys/external/bsd/drm2/dist/drm/drm_modes.c
--- a/sys/external/bsd/drm2/dist/drm/drm_modes.c        Sat Nov 14 11:55:36 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_modes.c        Sat Nov 14 13:27:29 2015 +0000
@@ -1057,8 +1057,6 @@
 }
 EXPORT_SYMBOL(drm_mode_connector_list_update);
 
-#ifndef __NetBSD__
-
 /**
  * drm_mode_parse_command_line_for_connector - parse command line modeline for connector
  * @mode_option: optional per connector mode option
@@ -1087,16 +1085,18 @@
        const char *name;
        unsigned int namelen;
        bool res_specified = false, bpp_specified = false, refresh_specified = false;
-       unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
+       long xres = 0, yres = 0, bpp = 32, refresh = 0;
        bool yres_specified = false, cvt = false, rb = false;
        bool interlace = false, margins = false, was_digit = false;
        int i;
        enum drm_connector_force force = DRM_FORCE_UNSPECIFIED;
 
+#if !defined(__NetBSD__)
 #ifdef CONFIG_FB
        if (!mode_option)
                mode_option = fb_mode_option;
 #endif
+#endif
 
        if (!mode_option) {
                mode->specified = false;
@@ -1110,26 +1110,35 @@
                case '@':
                        if (!refresh_specified && !bpp_specified &&
                            !yres_specified && !cvt && !rb && was_digit) {
-                               refresh = simple_strtol(&name[i+1], NULL, 10);
-                               refresh_specified = true;
-                               was_digit = false;
+                               if (kstrtol(&name[i+1], 10, &refresh) == 0) {
+                                       refresh_specified = true;
+                                       was_digit = false;
+                               } else {
+                                       goto done;
+                               }
                        } else
                                goto done;
                        break;
                case '-':
                        if (!bpp_specified && !yres_specified && !cvt &&
                            !rb && was_digit) {
-                               bpp = simple_strtol(&name[i+1], NULL, 10);
-                               bpp_specified = true;
-                               was_digit = false;
+                               if (kstrtol(&name[i+1], 10, &bpp) == 0) {
+                                       bpp_specified = true;
+                                       was_digit = false;
+                               } else {
+                                       goto done;
+                               }
                        } else
                                goto done;
                        break;
                case 'x':
                        if (!yres_specified && was_digit) {
-                               yres = simple_strtol(&name[i+1], NULL, 10);
-                               yres_specified = true;
-                               was_digit = false;
+                               if (kstrtol(&name[i+1], 10, &yres) == 0) {
+                                       yres_specified = true;
+                                       was_digit = false;
+                               } else {
+                                       goto done;
+                               }
                        } else
                                goto done;
                        break;
@@ -1187,8 +1196,8 @@
        }
 
        if (i < 0 && yres_specified) {
-               char *ch;
-               xres = simple_strtol(name, &ch, 10);
+               char *ch = NULL;
+               xres = strtoll(name, &ch, 10);
                if ((ch != NULL) && (*ch == 'x'))
                        res_specified = true;
                else
@@ -1199,7 +1208,7 @@
        }
 done:
        if (i >= 0) {
-               printk(KERN_WARNING
+               DRM_ERROR(
                        "parse error at position %i in video mode '%s'\n",
                        i, name);
                mode->specified = false;
@@ -1264,5 +1273,3 @@
        return mode;
 }
 EXPORT_SYMBOL(drm_mode_create_from_cmdline_mode);
-
-#endif



Home | Main Index | Thread Index | Old Index