Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/videomode Make re-usuable to userland. The vesagtf s...



details:   https://anonhg.NetBSD.org/src/rev/50a2fd762e3a
branches:  trunk
changeset: 1029184:50a2fd762e3a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Dec 25 13:51:31 2021 +0000

description:
Make re-usuable to userland. The vesagtf standalone build is #if'd out for now.

diffstat:

 sys/dev/videomode/edid.c    |  23 +++++++++++++++++------
 sys/dev/videomode/vesagtf.c |  16 +++++++---------
 2 files changed, 24 insertions(+), 15 deletions(-)

diffs (127 lines):

diff -r 87df1b34d3b8 -r 50a2fd762e3a sys/dev/videomode/edid.c
--- a/sys/dev/videomode/edid.c  Sat Dec 25 13:41:12 2021 +0000
+++ b/sys/dev/videomode/edid.c  Sat Dec 25 13:51:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edid.c,v 1.15 2020/01/25 15:59:11 maxv Exp $ */
+/* $NetBSD: edid.c,v 1.16 2021/12/25 13:51:31 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,13 +32,22 @@
  */ 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.15 2020/01/25 15:59:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edid.c,v 1.16 2021/12/25 13:51:31 mlelstv Exp $");
 
+#ifdef _KERNEL
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
+#else
+#include <stdlib.h>
+#include <inttypes.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#endif
+
 #include <dev/videomode/videomode.h>
 #include <dev/videomode/ediddevs.h>
 #include <dev/videomode/edidreg.h>
@@ -132,7 +141,7 @@
 {
        int sum = 0, i;
        uint8_t sig[8] = EDID_SIGNATURE;
-       
+
        if (memcmp(d, sig, 8) != 0)
                return EINVAL;
        
@@ -430,7 +439,7 @@
         */
        if (edid->edid_preferred_mode == NULL) {
                edid->edid_preferred_mode = m;
-       } else if ((strncmp(edid->edid_vendor, "IVM", 3) == 0) &&
+       } else if ((strncmp((char*)edid->edid_vendor, "IVM", 3) == 0) &&
                   (edid->edid_product == 0x4800) &&
                   (edid->edid_preferred_mode->dot_clock < m->dot_clock))
                edid->edid_preferred_mode = m;
@@ -546,14 +555,14 @@
        edid->edid_product = data[EDID_OFFSET_PRODUCT_ID] + 
            (data[EDID_OFFSET_PRODUCT_ID + 1] << 8);
 
-       name = edid_findvendor(edid->edid_vendor);
+       name = edid_findvendor((char *)edid->edid_vendor);
        if (name != NULL)
                strlcpy(edid->edid_vendorname, name,
                    sizeof(edid->edid_vendorname));
        else
                edid->edid_vendorname[0] = '\0';
 
-       name = edid_findproduct(edid->edid_vendor, edid->edid_product);
+       name = edid_findproduct((char *)edid->edid_vendor, edid->edid_product);
        if (name != NULL)
                strlcpy(edid->edid_productname, name,
                    sizeof(edid->edid_productname));
@@ -647,8 +656,10 @@
                if (edid->edid_modes[i].dot_clock > max_dotclock)
                        max_dotclock = edid->edid_modes[i].dot_clock;
 
+#ifdef _KERNEL
        aprint_debug("max_dotclock according to supported modes: %d\n",
            max_dotclock);
+#endif
 
        mhz = (max_dotclock + 999) / 1000;
 
diff -r 87df1b34d3b8 -r 50a2fd762e3a sys/dev/videomode/vesagtf.c
--- a/sys/dev/videomode/vesagtf.c       Sat Dec 25 13:41:12 2021 +0000
+++ b/sys/dev/videomode/vesagtf.c       Sat Dec 25 13:51:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vesagtf.c,v 1.3 2014/03/21 22:00:00 dholland Exp $ */
+/* $NetBSD: vesagtf.c,v 1.4 2021/12/25 13:51:31 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -153,21 +153,17 @@
 #ifdef _KERNEL
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: vesagtf.c,v 1.3 2014/03/21 22:00:00 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vesagtf.c,v 1.4 2021/12/25 13:51:31 mlelstv Exp $");
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <dev/videomode/videomode.h>
-#include <dev/videomode/vesagtf.h>
 #else
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/types.h>
-#include "videomode.h"
-#include "vesagtf.h"
-
-void print_xf86_mode(struct videomode *m);
+#include <inttypes.h>
 #endif
+#include <dev/videomode/videomode.h>
+#include <dev/videomode/vesagtf.h>
 
 #define CELL_GRAN         8     /* assumed character cell granularity        */
 
@@ -660,6 +656,7 @@
 
 /* print_xf86_mode() - print the XFree86 modeline, given mode timings. */
 
+#if 0
 #ifndef _KERNEL
 void
 print_xf86_mode (struct videomode *vmp)
@@ -700,3 +697,4 @@
     
 }
 #endif
+#endif



Home | Main Index | Thread Index | Old Index