mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* PATCH: FrameBuffer Monitor Functions
@ 2002-02-26 15:28 Carlos Manuel Duclos Vergara
  0 siblings, 0 replies; 3+ messages in thread
From: Carlos Manuel Duclos Vergara @ 2002-02-26 15:28 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

Hi,
this patch is to avoid the cooking of monitors from inside the
framebuffer subsystem. Normally this would be made by
fbmon_valid_timings function, but actually this function does nothing.
So i start writing a new implementation that will make some checks, note
that is not the full answer because it requires to user use another data
structures normally don't used, but for now it checks the basic stuff.
(i will continue improving this, i use this on uclinux not on linux so i
probably have another things in mind when i create this patches)


 bye



-- 
"Solo me arrepiento de unos * de menos y unos ++ de sobra"
Carlos Manuel Duclos Vergara


[-- Attachment #2: fbmon_c.patch --]
[-- Type: application/octet-stream, Size: 2504 bytes --]

--- uclinux-2.4.x/drivers/video/fbmon.c	Wed Mar  8 15:18:25 2000
+++ ecl-uclinux-2.4.x/drivers/video/fbmon.c	Mon Feb 25 14:20:25 2002
@@ -46,31 +46,54 @@
 int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
                         const struct fb_info *fb_info)
 {
-#if 0
   /*
-   * long long divisions .... $#%%#$
+   * Ohhh, i discover the Secret of Ramses II tomb!
+   * _PLEASE_ note that this is only worth if you _FILL_ _UP_
+   * a fb_monspecs with your monitor specs!
+   * If you don't do that, this will only check for vesa compatible
+   * modes at some "generic" multifrequency monitors! (not done yet)
+   * I will think in how to auto detect monitors, or maybe how you can tell in
+   * runtime what kind of monitor do you have.
+   * If you want to know the progress of that, email me at: carlos@embedded.cl
+   * Note 1: I don't assume nothing, so in htotal & vtotal use your values...
+   * if you want a sugestion use: htotal = hres * 1.2 and vtotal = vres * 1.1
+   * Note 2: We only need to calculate one thing to see if your monitor will cook
+   * (please don't blame me if it cooks anyway, you must be aware that this function
+   * do its best to check but is not _the_ final answer!
    */
-    unsigned long long hpicos, vpicos;
-    const unsigned long long _1e12 = 1000000000000ULL;
-    const struct fb_monspecs *monspecs = &fb_info->monspecs;
 
-    hpicos = (unsigned long long)htotal*(unsigned long long)pixclock;
-    vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos;
-    if (!vpicos)
-      return 0;
-    
-    if (monspecs->hfmin == 0)
+  if( !fb_info->monspecs )
+    {
+      /*
+       * Dear God...
+       */
+      printk( KERN_INFO "fb: We could not check your monitor, due lack of monspecs!\n" );
       return 1;
-    
-    if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 ||
-        vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12)
+    }
+
+  if( pixelclock > (fb_info->monspecs.hfmax * htotal) )
+    {
+      /* 
+       * We will cook this monitor!
+       */
+      printk( KERN_INFO "fb: To avoid cooking your monitor we won't use this resolution!\n" );
       return 0;
-#endif
-    return 1;
+    }
+
+  /*
+   * If we get here, we're safe (almost)
+   */
+
+  return 1;
 }
 
 int fbmon_dpms(const struct fb_info *fb_info)
 {
+  if( !fb_info->monspecs )
+    {
+      printk( KERN_INFO "fb: No monspecs!\n" );
+      return -EINVAL;
+    }
   return fb_info->monspecs.dpms;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread
* PATCH: FrameBuffer Monitor Functions
@ 2002-02-25 17:50 Carlos Manuel Duclos Vergara
  2002-02-25 17:58 ` James Simmons
  0 siblings, 1 reply; 3+ messages in thread
From: Carlos Manuel Duclos Vergara @ 2002-02-25 17:50 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Hi,
this patch is to avoid the cooking of monitors from inside the
framebuffer subsystem. Normally this would be made by
fbmon_valid_timings function, but actually this function does nothing.
So i start writing a new implementation that will make some checks, note
that is not the full answer because it requires to user use another data
structures normally don't used, but for now it checks the basic stuff.
bye



-- 
"Solo me arrepiento de unos * de menos y unos ++ de sobra"
Carlos Manuel Duclos Vergara

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-02-26 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26 15:28 PATCH: FrameBuffer Monitor Functions Carlos Manuel Duclos Vergara
  -- strict thread matches above, loose matches on Subject: below --
2002-02-25 17:50 Carlos Manuel Duclos Vergara
2002-02-25 17:58 ` James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®