[mutter] backends: Make KMS EDID information equal to X11's
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] backends: Make KMS EDID information equal to X11's
- Date: Wed, 14 Jan 2015 11:17:05 +0000 (UTC)
commit 625d3de2ee19ee335810bb53b088db0b67aedd47
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jan 4 21:24:05 2015 +0100
backends: Make KMS EDID information equal to X11's
EDID parsing has been refactored to a common meta_output_parse_edid()
function, which ensures the extracted information is the same on both KMS
and X11 backend, so it can be used consistently on eg. settings values.
https://bugzilla.gnome.org/show_bug.cgi?id=742882
src/backends/meta-monitor-manager.c | 33 ++++++++++++++++++++++++
src/backends/meta-monitor-manager.h | 3 ++
src/backends/native/meta-monitor-manager-kms.c | 21 +--------------
src/backends/x11/meta-monitor-manager-xrandr.c | 27 +------------------
4 files changed, 38 insertions(+), 46 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 5b97f62..3e6207f 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -35,6 +35,7 @@
#include <meta/main.h>
#include "util-private.h"
#include <meta/errors.h>
+#include "edid.h"
#include "meta-monitor-config.h"
#include "backends/x11/meta-monitor-manager-xrandr.h"
#include "meta-backend-private.h"
@@ -1211,6 +1212,38 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
}
void
+meta_output_parse_edid (MetaOutput *meta_output,
+ GBytes *edid)
+{
+ MonitorInfo *parsed_edid;
+ gsize len;
+
+ parsed_edid = decode_edid (g_bytes_get_data (edid, &len));
+
+ if (parsed_edid)
+ {
+ meta_output->vendor = g_strndup (parsed_edid->manufacturer_code, 4);
+ if (parsed_edid->dsc_product_name[0])
+ meta_output->product = g_strndup (parsed_edid->dsc_product_name, 14);
+ else
+ meta_output->product = g_strdup_printf ("0x%04x", (unsigned) parsed_edid->product_code);
+ if (parsed_edid->dsc_serial_number[0])
+ meta_output->serial = g_strndup (parsed_edid->dsc_serial_number, 14);
+ else
+ meta_output->serial = g_strdup_printf ("0x%08x", parsed_edid->serial_number);
+
+ g_free (parsed_edid);
+ }
+
+ if (!meta_output->vendor)
+ {
+ meta_output->vendor = g_strdup ("unknown");
+ meta_output->product = g_strdup ("unknown");
+ meta_output->serial = g_strdup ("unknown");
+ }
+}
+
+void
meta_monitor_manager_on_hotplug (MetaMonitorManager *manager)
{
gboolean applied_config = FALSE;
diff --git a/src/backends/meta-monitor-manager.h b/src/backends/meta-monitor-manager.h
index 8ba3b46..b4a0eeb 100644
--- a/src/backends/meta-monitor-manager.h
+++ b/src/backends/meta-monitor-manager.h
@@ -361,6 +361,9 @@ void meta_monitor_manager_apply_configuration (MetaMonitorManager
void meta_monitor_manager_confirm_configuration (MetaMonitorManager *manager,
gboolean ok);
+void meta_output_parse_edid (MetaOutput *output,
+ GBytes *edid);
+
void meta_crtc_info_free (MetaCRTCInfo *info);
void meta_output_info_free (MetaOutputInfo *info);
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index 564bc50..13709f1 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -39,7 +39,6 @@
#include <meta/main.h>
#include <meta/errors.h>
-#include "edid.h"
#include <gudev/gudev.h>
@@ -515,27 +514,9 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
edid = read_output_edid (manager_kms, meta_output);
if (edid)
{
- MonitorInfo *parsed_edid;
- gsize len;
-
- parsed_edid = decode_edid (g_bytes_get_data (edid, &len));
- if (parsed_edid)
- {
- meta_output->vendor = g_strndup (parsed_edid->manufacturer_code, 4);
- meta_output->product = g_strndup (parsed_edid->dsc_product_name, 14);
- meta_output->serial = g_strndup (parsed_edid->dsc_serial_number, 14);
-
- g_free (parsed_edid);
- }
-
+ meta_output_parse_edid (meta_output, edid);
g_bytes_unref (edid);
}
- if (!meta_output->vendor)
- {
- meta_output->vendor = g_strdup ("unknown");
- meta_output->product = g_strdup ("unknown");
- meta_output->serial = g_strdup ("unknown");
- }
/* MetaConnectorType matches DRM's connector types */
meta_output->connector_type = (MetaConnectorType) connector->connector_type;
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index b047aca..03b4152 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -41,7 +41,6 @@
#include "meta-backend-x11.h"
#include <meta/main.h>
#include <meta/errors.h>
-#include "edid.h"
#include "meta-monitor-config.h"
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
@@ -689,7 +688,6 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
if (output->connection != RR_Disconnected)
{
GBytes *edid;
- MonitorInfo *parsed_edid;
meta_output->winsys_id = resources->outputs[i];
meta_output->name = g_strdup (output->name);
@@ -697,33 +695,10 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
edid = read_output_edid (manager_xrandr, meta_output->winsys_id);
if (edid)
{
- gsize len;
-
- parsed_edid = decode_edid (g_bytes_get_data (edid, &len));
- if (parsed_edid)
- {
- meta_output->vendor = g_strndup (parsed_edid->manufacturer_code, 4);
- if (parsed_edid->dsc_product_name[0])
- meta_output->product = g_strndup (parsed_edid->dsc_product_name, 14);
- else
- meta_output->product = g_strdup_printf ("0x%04x", (unsigned)parsed_edid->product_code);
- if (parsed_edid->dsc_serial_number[0])
- meta_output->serial = g_strndup (parsed_edid->dsc_serial_number, 14);
- else
- meta_output->serial = g_strdup_printf ("0x%08x", parsed_edid->serial_number);
-
- g_free (parsed_edid);
- }
-
+ meta_output_parse_edid (meta_output, edid);
g_bytes_unref (edid);
}
- if (!meta_output->vendor)
- {
- meta_output->vendor = g_strdup ("unknown");
- meta_output->product = g_strdup ("unknown");
- meta_output->serial = g_strdup ("unknown");
- }
meta_output->width_mm = output->mm_width;
meta_output->height_mm = output->mm_height;
meta_output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]