Re: [PATCH 09/14] drm/edid: Add test for monitor reduced blanking support.

2010-05-06 Thread Mark Marshall
Adam Jackson wrote:
 The generic block walk callback looks like overkill, but we'll need it
 for other detailed block walks in the future.
 
 Signed-off-by: Adam Jackson a...@redhat.com
 ---
  drivers/gpu/drm/drm_edid.c |   47 ---
  1 files changed, 43 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
 index fb7c2fc..ead57ab 100644
 --- a/drivers/gpu/drm/drm_edid.c
 +++ b/drivers/gpu/drm/drm_edid.c
 @@ -33,6 +33,10 @@
  #include drmP.h
  #include drm_edid.h
  
 +#define EDID_EST_TIMINGS 16
 +#define EDID_STD_TIMINGS 8
 +#define EDID_DETAILED_TIMINGS 4
 +
  /*
   * EDID blocks out in the wild have a variety of bugs, try to collect
   * them here (note that userspace may work around broken monitors first,
 @@ -673,6 +677,45 @@ static struct drm_display_mode *drm_find_dmt(struct 
 drm_device *dev,
   return mode;
  }
  
 +typedef void detailed_cb(struct detailed_timing *timing, void *closure);
 +
 +static void
 +drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
 +{
 + int i;
 + struct edid *edid = (struct edid *)raw_edid;
 +
 + if (edid == NULL)
 + return;
 +
 + for (i = 0; i  EDID_DETAILED_TIMINGS; i++)
 + cb((edid-detailed_timings[i]), closure);
 +
 + /* XXX extension block walk */
 +}
 +
 +static void
 +is_rb(struct detailed_timing *t, void *data)
 +{
 + u8 *r = (u8 *)t;
 + if (r[3] == EDID_DETAIL_MONITOR_RANGE)
 + if (r[15]  0x10)
 + *(bool *)data = true;
 +}
 +
 +/* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
 +static bool
 +drm_monitor_supports_rb(struct edid *edid)
 +{
 + if (edid-revision = 4) {
 + bool ret;

You need to initialize ret here (bool ret = false;).

 + drm_for_each_detailed_block((u8 *)edid, is_rb, ret);
 + return ret;
 + }
 +
 + return ((edid-input  DRM_EDID_INPUT_DIGITAL) != 0);
 +}
 +
  /*
   * 0 is reserved.  The spec says 0x01 fill for unused timings.  Some old
   * monitors fill with ascii space (0x20) instead.
 @@ -964,10 +1007,6 @@ static struct drm_display_mode edid_est_modes[] = {
  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 
 1152x...@75hz */
  };
  
 -#define EDID_EST_TIMINGS 16
 -#define EDID_STD_TIMINGS 8
 -#define EDID_DETAILED_TIMINGS 4
 -
  /**
   * add_established_modes - get est. modes from EDID and add them
   * @edid: EDID block to scan

MM


--
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


[PATCH 09/14] drm/edid: Add test for monitor reduced blanking support.

2010-03-29 Thread Adam Jackson
The generic block walk callback looks like overkill, but we'll need it
for other detailed block walks in the future.

Signed-off-by: Adam Jackson a...@redhat.com
---
 drivers/gpu/drm/drm_edid.c |   47 ---
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fb7c2fc..ead57ab 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -33,6 +33,10 @@
 #include drmP.h
 #include drm_edid.h
 
+#define EDID_EST_TIMINGS 16
+#define EDID_STD_TIMINGS 8
+#define EDID_DETAILED_TIMINGS 4
+
 /*
  * EDID blocks out in the wild have a variety of bugs, try to collect
  * them here (note that userspace may work around broken monitors first,
@@ -673,6 +677,45 @@ static struct drm_display_mode *drm_find_dmt(struct 
drm_device *dev,
return mode;
 }
 
+typedef void detailed_cb(struct detailed_timing *timing, void *closure);
+
+static void
+drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
+{
+   int i;
+   struct edid *edid = (struct edid *)raw_edid;
+
+   if (edid == NULL)
+   return;
+
+   for (i = 0; i  EDID_DETAILED_TIMINGS; i++)
+   cb((edid-detailed_timings[i]), closure);
+
+   /* XXX extension block walk */
+}
+
+static void
+is_rb(struct detailed_timing *t, void *data)
+{
+   u8 *r = (u8 *)t;
+   if (r[3] == EDID_DETAIL_MONITOR_RANGE)
+   if (r[15]  0x10)
+   *(bool *)data = true;
+}
+
+/* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
+static bool
+drm_monitor_supports_rb(struct edid *edid)
+{
+   if (edid-revision = 4) {
+   bool ret;
+   drm_for_each_detailed_block((u8 *)edid, is_rb, ret);
+   return ret;
+   }
+
+   return ((edid-input  DRM_EDID_INPUT_DIGITAL) != 0);
+}
+
 /*
  * 0 is reserved.  The spec says 0x01 fill for unused timings.  Some old
  * monitors fill with ascii space (0x20) instead.
@@ -964,10 +1007,6 @@ static struct drm_display_mode edid_est_modes[] = {
   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 
1152x...@75hz */
 };
 
-#define EDID_EST_TIMINGS 16
-#define EDID_STD_TIMINGS 8
-#define EDID_DETAILED_TIMINGS 4
-
 /**
  * add_established_modes - get est. modes from EDID and add them
  * @edid: EDID block to scan
-- 
1.6.6.1


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel