mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
output: Make implementations inherit MetaOutput
Instead of the home baked "inheritance" system, using a gpointer and a GDestroyNotify function to keep the what effectively is sub type details, make MetaOutput an abstract derivable type, and make the implementations inherit it. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
4920b5064d
commit
4a4f2d8264
@ -53,10 +53,14 @@ struct _MetaMonitorManagerDummyClass
|
||||
MetaMonitorManagerClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct _MetaOutputDummy
|
||||
struct _MetaOutputDummy
|
||||
{
|
||||
MetaOutput parent;
|
||||
|
||||
float scale;
|
||||
} MetaOutputDummy;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaOutputDummy, meta_output_dummy, META_TYPE_OUTPUT)
|
||||
|
||||
G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, META_TYPE_MONITOR_MANAGER);
|
||||
|
||||
@ -67,9 +71,6 @@ struct _MetaGpuDummy
|
||||
|
||||
G_DEFINE_TYPE (MetaGpuDummy, meta_gpu_dummy, META_TYPE_GPU)
|
||||
|
||||
static void
|
||||
meta_output_dummy_notify_destroy (MetaOutput *output);
|
||||
|
||||
typedef struct _CrtcModeSpec
|
||||
{
|
||||
int width;
|
||||
@ -229,19 +230,13 @@ append_monitor (MetaMonitorManager *manager,
|
||||
output_info->possible_crtcs[0] = g_list_last (*crtcs)->data;
|
||||
output_info->n_possible_crtcs = 1;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
output = g_object_new (META_TYPE_OUTPUT_DUMMY,
|
||||
"id", number,
|
||||
"gpu", gpu,
|
||||
"info", output_info,
|
||||
NULL);
|
||||
|
||||
output_dummy = g_new0 (MetaOutputDummy, 1);
|
||||
*output_dummy = (MetaOutputDummy) {
|
||||
.scale = scale
|
||||
};
|
||||
output->driver_private = output_dummy;
|
||||
output->driver_notify =
|
||||
(GDestroyNotify) meta_output_dummy_notify_destroy;
|
||||
output_dummy = META_OUTPUT_DUMMY (output);
|
||||
output_dummy->scale = scale;
|
||||
|
||||
*outputs = g_list_append (*outputs, output);
|
||||
}
|
||||
@ -307,11 +302,6 @@ append_tiled_monitor (MetaMonitorManager *manager,
|
||||
g_autoptr (MetaOutputInfo) output_info = NULL;
|
||||
GList *l;
|
||||
|
||||
output_dummy = g_new0 (MetaOutputDummy, 1);
|
||||
*output_dummy = (MetaOutputDummy) {
|
||||
.scale = scale
|
||||
};
|
||||
|
||||
/* Arbitrary ID unique for this output */
|
||||
number = g_list_length (*outputs) + 1;
|
||||
|
||||
@ -359,25 +349,18 @@ append_tiled_monitor (MetaMonitorManager *manager,
|
||||
}
|
||||
output_info->n_possible_crtcs = n_tiles;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
output = g_object_new (META_TYPE_OUTPUT_DUMMY,
|
||||
"id", number,
|
||||
"gpu", gpu,
|
||||
"info", output_info,
|
||||
NULL);
|
||||
output->driver_private = output_dummy;
|
||||
output->driver_notify =
|
||||
(GDestroyNotify) meta_output_dummy_notify_destroy;
|
||||
output_dummy = META_OUTPUT_DUMMY (output);
|
||||
output_dummy->scale = scale;
|
||||
|
||||
*outputs = g_list_append (*outputs, output);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_dummy_notify_destroy (MetaOutput *output)
|
||||
{
|
||||
g_clear_pointer (&output->driver_private, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
|
||||
{
|
||||
@ -652,7 +635,7 @@ meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *man
|
||||
MetaOutputDummy *output_dummy;
|
||||
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
output_dummy = output->driver_private;
|
||||
output_dummy = META_OUTPUT_DUMMY (output);
|
||||
|
||||
return output_dummy->scale;
|
||||
}
|
||||
@ -799,3 +782,14 @@ meta_gpu_dummy_class_init (MetaGpuDummyClass *klass)
|
||||
|
||||
gpu_class->read_current = meta_gpu_dummy_read_current;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_dummy_init (MetaOutputDummy *output_dummy)
|
||||
{
|
||||
output_dummy->scale = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_dummy_class_init (MetaOutputDummyClass *klass)
|
||||
{
|
||||
}
|
||||
|
@ -25,6 +25,12 @@
|
||||
|
||||
#include "backends/meta-gpu.h"
|
||||
#include "backends/meta-monitor-manager-private.h"
|
||||
#include "backends/meta-output.h"
|
||||
|
||||
#define META_TYPE_OUTPUT_DUMMY (meta_output_dummy_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaOutputDummy, meta_output_dummy,
|
||||
META, OUTPUT_DUMMY,
|
||||
MetaOutput)
|
||||
|
||||
#define META_TYPE_MONITOR_MANAGER_DUMMY (meta_monitor_manager_dummy_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy,
|
||||
|
@ -53,7 +53,7 @@ typedef struct _MetaOutputPrivate
|
||||
int backlight;
|
||||
} MetaOutputPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaOutput, meta_output, G_TYPE_OBJECT)
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaOutput, meta_output, G_TYPE_OBJECT)
|
||||
|
||||
G_DEFINE_BOXED_TYPE (MetaOutputInfo, meta_output_info,
|
||||
meta_output_info_ref,
|
||||
@ -308,9 +308,6 @@ meta_output_finalize (GObject *object)
|
||||
MetaOutput *output = META_OUTPUT (object);
|
||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||
|
||||
if (output->driver_notify)
|
||||
output->driver_notify (output);
|
||||
|
||||
g_clear_pointer (&priv->info, meta_output_info_unref);
|
||||
|
||||
G_OBJECT_CLASS (meta_output_parent_class)->finalize (object);
|
||||
|
@ -101,14 +101,6 @@ typedef struct _MetaOutputInfo
|
||||
MetaTileInfo tile_info;
|
||||
} MetaOutputInfo;
|
||||
|
||||
struct _MetaOutput
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
gpointer driver_private;
|
||||
GDestroyNotify driver_notify;
|
||||
};
|
||||
|
||||
#define META_TYPE_OUTPUT_INFO (meta_output_info_get_type ())
|
||||
META_EXPORT_TEST
|
||||
GType meta_output_info_get_type (void);
|
||||
@ -129,7 +121,13 @@ void meta_output_info_parse_edid (MetaOutputInfo *output_info,
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaOutputInfo, meta_output_info_unref)
|
||||
|
||||
#define META_TYPE_OUTPUT (meta_output_get_type ())
|
||||
META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaOutput, meta_output, META, OUTPUT, GObject)
|
||||
META_EXPORT_TEST
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaOutput, meta_output, META, OUTPUT, GObject)
|
||||
|
||||
struct _MetaOutputClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
META_EXPORT_TEST
|
||||
uint64_t meta_output_get_id (MetaOutput *output);
|
||||
|
@ -157,7 +157,7 @@ generate_crtc_connector_list (MetaGpu *gpu,
|
||||
if (assigned_crtc == crtc)
|
||||
{
|
||||
MetaKmsConnector *kms_connector =
|
||||
meta_output_kms_get_kms_connector (output);
|
||||
meta_output_kms_get_kms_connector (META_OUTPUT_KMS (output));
|
||||
|
||||
connectors = g_list_prepend (connectors, kms_connector);
|
||||
}
|
||||
|
@ -238,7 +238,8 @@ meta_gpu_kms_set_power_save_mode (MetaGpuKms *gpu_kms,
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
meta_output_kms_set_power_save_mode (output, state, kms_update);
|
||||
meta_output_kms_set_power_save_mode (META_OUTPUT_KMS (output),
|
||||
state, kms_update);
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,7 +368,8 @@ find_output_by_connector_id (GList *outputs,
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
if (meta_output_kms_get_connector_id (output) == connector_id)
|
||||
if (meta_output_kms_get_connector_id (META_OUTPUT_KMS (output)) ==
|
||||
connector_id)
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -391,7 +393,8 @@ setup_output_clones (MetaGpu *gpu)
|
||||
if (other_output == output)
|
||||
continue;
|
||||
|
||||
if (meta_output_kms_can_clone (output, other_output))
|
||||
if (meta_output_kms_can_clone (META_OUTPUT_KMS (output),
|
||||
META_OUTPUT_KMS (other_output)))
|
||||
meta_output_add_possible_clone (output, other_output);
|
||||
}
|
||||
}
|
||||
@ -515,7 +518,7 @@ init_outputs (MetaGpuKms *gpu_kms)
|
||||
{
|
||||
MetaKmsConnector *kms_connector = l->data;
|
||||
const MetaKmsConnectorState *connector_state;
|
||||
MetaOutput *output;
|
||||
MetaOutputKms *output_kms;
|
||||
MetaOutput *old_output;
|
||||
GError *error = NULL;
|
||||
|
||||
@ -526,18 +529,18 @@ init_outputs (MetaGpuKms *gpu_kms)
|
||||
old_output =
|
||||
find_output_by_connector_id (old_outputs,
|
||||
meta_kms_connector_get_id (kms_connector));
|
||||
output = meta_create_kms_output (gpu_kms,
|
||||
kms_connector,
|
||||
old_output,
|
||||
&error);
|
||||
if (!output)
|
||||
output_kms = meta_output_kms_new (gpu_kms,
|
||||
kms_connector,
|
||||
old_output,
|
||||
&error);
|
||||
if (!output_kms)
|
||||
{
|
||||
g_warning ("Failed to create KMS output: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputs = g_list_prepend (outputs, output);
|
||||
outputs = g_list_prepend (outputs, output_kms);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ static GBytes *
|
||||
meta_monitor_manager_kms_read_edid (MetaMonitorManager *manager,
|
||||
MetaOutput *output)
|
||||
{
|
||||
return meta_output_kms_read_edid (output);
|
||||
return meta_output_kms_read_edid (META_OUTPUT_KMS (output));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -44,19 +44,19 @@ typedef struct _MetaOutputKms
|
||||
MetaKmsConnector *kms_connector;
|
||||
} MetaOutputKms;
|
||||
|
||||
MetaKmsConnector *
|
||||
meta_output_kms_get_kms_connector (MetaOutput *output)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
G_DEFINE_TYPE (MetaOutputKms, meta_output_kms, META_TYPE_OUTPUT)
|
||||
|
||||
MetaKmsConnector *
|
||||
meta_output_kms_get_kms_connector (MetaOutputKms *output_kms)
|
||||
{
|
||||
return output_kms->kms_connector;
|
||||
}
|
||||
|
||||
void
|
||||
meta_output_kms_set_underscan (MetaOutput *output,
|
||||
meta_output_kms_set_underscan (MetaOutputKms *output_kms,
|
||||
MetaKmsUpdate *kms_update)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
MetaOutput *output = META_OUTPUT (output_kms);
|
||||
const MetaOutputInfo *output_info = meta_output_get_info (output);
|
||||
|
||||
if (!output_info->supports_underscanning)
|
||||
@ -93,20 +93,16 @@ meta_output_kms_set_underscan (MetaOutput *output,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
meta_output_kms_get_connector_id (MetaOutput *output)
|
||||
meta_output_kms_get_connector_id (MetaOutputKms *output_kms)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
|
||||
return meta_kms_connector_get_id (output_kms->kms_connector);
|
||||
}
|
||||
|
||||
void
|
||||
meta_output_kms_set_power_save_mode (MetaOutput *output,
|
||||
meta_output_kms_set_power_save_mode (MetaOutputKms *output_kms,
|
||||
uint64_t dpms_state,
|
||||
MetaKmsUpdate *kms_update)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
|
||||
g_debug ("Setting DPMS state of connector %s to %" G_GUINT64_FORMAT,
|
||||
meta_kms_connector_get_name (output_kms->kms_connector),
|
||||
dpms_state);
|
||||
@ -117,20 +113,16 @@ meta_output_kms_set_power_save_mode (MetaOutput *output,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_output_kms_can_clone (MetaOutput *output,
|
||||
MetaOutput *other_output)
|
||||
meta_output_kms_can_clone (MetaOutputKms *output_kms,
|
||||
MetaOutputKms *other_output_kms)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
MetaOutputKms *other_output_kms = other_output->driver_private;
|
||||
|
||||
return meta_kms_connector_can_clone (output_kms->kms_connector,
|
||||
other_output_kms->kms_connector);
|
||||
}
|
||||
|
||||
GBytes *
|
||||
meta_output_kms_read_edid (MetaOutput *output)
|
||||
meta_output_kms_read_edid (MetaOutputKms *output_kms)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
const MetaKmsConnectorState *connector_state;
|
||||
GBytes *edid_data;
|
||||
|
||||
@ -143,16 +135,6 @@ meta_output_kms_read_edid (MetaOutput *output)
|
||||
return g_bytes_new_from_bytes (edid_data, 0, g_bytes_get_size (edid_data));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_destroy_notify (MetaOutput *output)
|
||||
{
|
||||
MetaOutputKms *output_kms;
|
||||
|
||||
output_kms = output->driver_private;
|
||||
|
||||
g_slice_free (MetaOutputKms, output_kms);
|
||||
}
|
||||
|
||||
static void
|
||||
add_common_modes (MetaOutputInfo *output_info,
|
||||
MetaGpuKms *gpu_kms)
|
||||
@ -287,11 +269,11 @@ init_output_modes (MetaOutputInfo *output_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MetaOutput *
|
||||
meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
MetaKmsConnector *kms_connector,
|
||||
MetaOutput *old_output,
|
||||
GError **error)
|
||||
MetaOutputKms *
|
||||
meta_output_kms_new (MetaGpuKms *gpu_kms,
|
||||
MetaKmsConnector *kms_connector,
|
||||
MetaOutput *old_output,
|
||||
GError **error)
|
||||
{
|
||||
MetaGpu *gpu = META_GPU (gpu_kms);
|
||||
uint32_t connector_id;
|
||||
@ -355,16 +337,12 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
|
||||
output_info->tile_info = connector_state->tile_info;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
output = g_object_new (META_TYPE_OUTPUT_KMS,
|
||||
"id", ((uint64_t) gpu_id << 32) | connector_id,
|
||||
"gpu", gpu,
|
||||
"info", output_info,
|
||||
NULL);
|
||||
|
||||
output_kms = g_slice_new0 (MetaOutputKms);
|
||||
output->driver_private = output_kms;
|
||||
output->driver_notify = (GDestroyNotify) meta_output_destroy_notify;
|
||||
|
||||
output_kms = META_OUTPUT_KMS (output);
|
||||
output_kms->kms_connector = kms_connector;
|
||||
|
||||
if (connector_state->current_crtc_id)
|
||||
@ -401,5 +379,15 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
meta_output_unassign_crtc (output);
|
||||
}
|
||||
|
||||
return output;
|
||||
return output_kms;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_kms_init (MetaOutputKms *output_kms)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_kms_class_init (MetaOutputKmsClass *klass)
|
||||
{
|
||||
}
|
||||
|
@ -27,23 +27,28 @@
|
||||
#include "backends/native/meta-gpu-kms.h"
|
||||
#include "backends/native/meta-kms-types.h"
|
||||
|
||||
void meta_output_kms_set_power_save_mode (MetaOutput *output,
|
||||
#define META_TYPE_OUTPUT_KMS (meta_output_kms_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaOutputKms, meta_output_kms,
|
||||
META, OUTPUT_KMS,
|
||||
MetaOutput)
|
||||
|
||||
void meta_output_kms_set_power_save_mode (MetaOutputKms *output_kms,
|
||||
uint64_t dpms_state,
|
||||
MetaKmsUpdate *kms_update);
|
||||
|
||||
void meta_output_kms_set_underscan (MetaOutput *output,
|
||||
void meta_output_kms_set_underscan (MetaOutputKms *output_kms,
|
||||
MetaKmsUpdate *kms_update);
|
||||
|
||||
gboolean meta_output_kms_can_clone (MetaOutput *output,
|
||||
MetaOutput *other_output);
|
||||
gboolean meta_output_kms_can_clone (MetaOutputKms *output_kms,
|
||||
MetaOutputKms *other_output_kms);
|
||||
|
||||
MetaKmsConnector * meta_output_kms_get_kms_connector (MetaOutput *output);
|
||||
MetaKmsConnector * meta_output_kms_get_kms_connector (MetaOutputKms *output_kms);
|
||||
|
||||
uint32_t meta_output_kms_get_connector_id (MetaOutput *output);
|
||||
uint32_t meta_output_kms_get_connector_id (MetaOutputKms *output_kms);
|
||||
|
||||
GBytes * meta_output_kms_read_edid (MetaOutput *output);
|
||||
GBytes * meta_output_kms_read_edid (MetaOutputKms *output_kms);
|
||||
|
||||
MetaOutput * meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
MetaOutputKms * meta_output_kms_new (MetaGpuKms *gpu_kms,
|
||||
MetaKmsConnector *kms_connector,
|
||||
MetaOutput *old_output,
|
||||
GError **error);
|
||||
|
@ -1436,7 +1436,8 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen *onscreen,
|
||||
}
|
||||
|
||||
meta_crtc_kms_set_mode (onscreen_native->crtc, kms_update);
|
||||
meta_output_kms_set_underscan (onscreen_native->output, kms_update);
|
||||
meta_output_kms_set_underscan (META_OUTPUT_KMS (onscreen_native->output),
|
||||
kms_update);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -191,14 +191,14 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
|
||||
if (xrandr_output->connection != RR_Disconnected)
|
||||
{
|
||||
MetaOutput *output;
|
||||
MetaOutputXrandr *output_xrandr;
|
||||
|
||||
output = meta_create_xrandr_output (gpu_xrandr,
|
||||
xrandr_output,
|
||||
output_id,
|
||||
primary_output);
|
||||
if (output)
|
||||
outputs = g_list_prepend (outputs, output);
|
||||
output_xrandr = meta_output_xrandr_new (gpu_xrandr,
|
||||
xrandr_output,
|
||||
output_id,
|
||||
primary_output);
|
||||
if (output_xrandr)
|
||||
outputs = g_list_prepend (outputs, output_xrandr);
|
||||
}
|
||||
|
||||
XRRFreeOutputInfo (xrandr_output);
|
||||
|
@ -540,7 +540,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
MetaOutputAssignment *output_assignment = outputs[i];
|
||||
MetaOutput *output = output_assignment->output;
|
||||
|
||||
meta_output_xrandr_apply_mode (output);
|
||||
meta_output_xrandr_apply_mode (META_OUTPUT_XRANDR (output));
|
||||
}
|
||||
|
||||
g_list_foreach (to_configure_outputs,
|
||||
@ -643,7 +643,7 @@ meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
|
||||
MetaOutput *output,
|
||||
gint value)
|
||||
{
|
||||
meta_output_xrandr_change_backlight (output, value);
|
||||
meta_output_xrandr_change_backlight (META_OUTPUT_XRANDR (output), value);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -46,6 +46,13 @@
|
||||
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
struct _MetaOutputXrandr
|
||||
{
|
||||
MetaOutput parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaOutputXrandr, meta_output_xrandr, META_TYPE_OUTPUT)
|
||||
|
||||
static Display *
|
||||
xdisplay_from_gpu (MetaGpu *gpu)
|
||||
{
|
||||
@ -133,8 +140,9 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
||||
}
|
||||
|
||||
void
|
||||
meta_output_xrandr_apply_mode (MetaOutput *output)
|
||||
meta_output_xrandr_apply_mode (MetaOutputXrandr *output_xrandr)
|
||||
{
|
||||
MetaOutput *output = META_OUTPUT (output_xrandr);
|
||||
Display *xdisplay = xdisplay_from_output (output);
|
||||
|
||||
if (meta_output_is_primary (output))
|
||||
@ -163,9 +171,10 @@ normalize_backlight (MetaOutput *output,
|
||||
}
|
||||
|
||||
void
|
||||
meta_output_xrandr_change_backlight (MetaOutput *output,
|
||||
int value)
|
||||
meta_output_xrandr_change_backlight (MetaOutputXrandr *output_xrandr,
|
||||
int value)
|
||||
{
|
||||
MetaOutput *output = META_OUTPUT (output_xrandr);
|
||||
const MetaOutputInfo *output_info = meta_output_get_info (output);
|
||||
Display *xdisplay = xdisplay_from_output (output);
|
||||
Atom atom;
|
||||
@ -786,11 +795,11 @@ find_assigned_crtc (MetaGpu *gpu,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MetaOutput *
|
||||
meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
XRROutputInfo *xrandr_output,
|
||||
RROutput output_id,
|
||||
RROutput primary_output)
|
||||
MetaOutputXrandr *
|
||||
meta_output_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||
XRROutputInfo *xrandr_output,
|
||||
RROutput output_id,
|
||||
RROutput primary_output)
|
||||
{
|
||||
MetaGpu *gpu = META_GPU (gpu_xrandr);
|
||||
MetaBackend *backend = meta_gpu_get_backend (gpu);
|
||||
@ -859,7 +868,7 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
output_get_supports_underscanning_xrandr (xdisplay, output_id);
|
||||
output_info_init_backlight_limits_xrandr (output_info, xdisplay, output_id);
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
output = g_object_new (META_TYPE_OUTPUT_XRANDR,
|
||||
"id", output_id,
|
||||
"gpu", gpu_xrandr,
|
||||
"info", output_info,
|
||||
@ -892,6 +901,16 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
}
|
||||
else
|
||||
{
|
||||
return output;
|
||||
return META_OUTPUT_XRANDR (output);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_xrandr_init (MetaOutputXrandr *output_xrandr)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_xrandr_class_init (MetaOutputXrandrClass *klass)
|
||||
{
|
||||
}
|
||||
|
@ -28,16 +28,21 @@
|
||||
#include "backends/x11/meta-gpu-xrandr.h"
|
||||
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
||||
|
||||
void meta_output_xrandr_apply_mode (MetaOutput *output);
|
||||
#define META_TYPE_OUTPUT_XRANDR (meta_output_xrandr_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaOutputXrandr, meta_output_xrandr,
|
||||
META, OUTPUT_XRANDR,
|
||||
MetaOutput)
|
||||
|
||||
void meta_output_xrandr_change_backlight (MetaOutput *output,
|
||||
void meta_output_xrandr_apply_mode (MetaOutputXrandr *output_xrandr);
|
||||
|
||||
void meta_output_xrandr_change_backlight (MetaOutputXrandr *output_xrandr,
|
||||
int value);
|
||||
|
||||
GBytes * meta_output_xrandr_read_edid (MetaOutput *output);
|
||||
GBytes * meta_output_xrandr_read_edid (MetaOutput *output_xrandr);
|
||||
|
||||
MetaOutput * meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
XRROutputInfo *xrandr_output,
|
||||
RROutput output_id,
|
||||
RROutput primary_output);
|
||||
MetaOutputXrandr * meta_output_xrandr_new (MetaGpuXrandr *gpu_xrandr,
|
||||
XRROutputInfo *xrandr_output,
|
||||
RROutput output_id,
|
||||
RROutput primary_output);
|
||||
|
||||
#endif /* META_OUTPUT_XRANDR_H */
|
||||
|
@ -163,7 +163,7 @@ meta_test_headless_monitor_connect (void)
|
||||
output_info->possible_crtcs = possible_crtcs;
|
||||
output_info->connector_type = META_CONNECTOR_TYPE_DisplayPort;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
output = g_object_new (META_TYPE_OUTPUT_TEST,
|
||||
"id", 1,
|
||||
"gpu", gpu,
|
||||
"info", output_info,
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "backends/meta-output.h"
|
||||
#include "tests/meta-backend-test.h"
|
||||
|
||||
G_DEFINE_TYPE (MetaOutputTest, meta_output_test, META_TYPE_OUTPUT)
|
||||
|
||||
struct _MetaMonitorManagerTest
|
||||
{
|
||||
MetaMonitorManager parent;
|
||||
@ -296,7 +298,7 @@ meta_monitor_manager_test_calculate_monitor_mode_scale (MetaMonitorManager *mana
|
||||
MetaOutputTest *output_test;
|
||||
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
output_test = output->driver_private;
|
||||
output_test = META_OUTPUT_TEST (output);
|
||||
|
||||
if (output_test)
|
||||
return output_test->scale;
|
||||
@ -423,3 +425,14 @@ meta_monitor_manager_test_class_init (MetaMonitorManagerTestClass *klass)
|
||||
manager_class->get_max_screen_size = meta_monitor_manager_test_get_max_screen_size;
|
||||
manager_class->get_default_layout_mode = meta_monitor_manager_test_get_default_layout_mode;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_test_init (MetaOutputTest *output_test)
|
||||
{
|
||||
output_test->scale = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_test_class_init (MetaOutputTestClass *klass)
|
||||
{
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#define META_MONITOR_MANAGER_TEST_H
|
||||
|
||||
#include "backends/meta-monitor-manager-private.h"
|
||||
#include "backends/meta-output.h"
|
||||
|
||||
typedef struct _MetaMonitorTestSetup
|
||||
{
|
||||
@ -29,13 +30,20 @@ typedef struct _MetaMonitorTestSetup
|
||||
GList *crtcs;
|
||||
} MetaMonitorTestSetup;
|
||||
|
||||
typedef struct _MetaOutputTest
|
||||
struct _MetaOutputTest
|
||||
{
|
||||
MetaOutput parent;
|
||||
|
||||
float scale;
|
||||
} MetaOutputTest;
|
||||
};
|
||||
|
||||
typedef MetaMonitorTestSetup * (* CreateTestSetupFunc) (void);
|
||||
|
||||
#define META_TYPE_OUTPUT_TEST (meta_output_test_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaOutputTest, meta_output_test,
|
||||
META, OUTPUT_TEST,
|
||||
MetaOutput)
|
||||
|
||||
#define META_TYPE_MONITOR_MANAGER_TEST (meta_monitor_manager_test_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaMonitorManagerTest, meta_monitor_manager_test,
|
||||
META, MONITOR_MANAGER_TEST, MetaMonitorManager)
|
||||
|
@ -529,12 +529,6 @@ check_monitor_configuration (MonitorTestCaseExpect *expect)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_output_test_destroy_notify (MetaOutput *output)
|
||||
{
|
||||
g_clear_pointer (&output->driver_private, g_free);
|
||||
}
|
||||
|
||||
MetaMonitorTestSetup *
|
||||
create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||
MonitorTestFlag flags)
|
||||
@ -627,16 +621,10 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||
possible_crtc_index);
|
||||
}
|
||||
|
||||
output_test = g_new0 (MetaOutputTest, 1);
|
||||
|
||||
scale = setup->outputs[i].scale;
|
||||
if (scale < 1)
|
||||
scale = 1;
|
||||
|
||||
*output_test = (MetaOutputTest) {
|
||||
.scale = scale
|
||||
};
|
||||
|
||||
is_laptop_panel = setup->outputs[i].is_laptop_panel;
|
||||
|
||||
serial = setup->outputs[i].serial;
|
||||
@ -679,12 +667,15 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||
output_info->panel_orientation_transform =
|
||||
setup->outputs[i].panel_orientation_transform;
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT,
|
||||
output = g_object_new (META_TYPE_OUTPUT_TEST,
|
||||
"id", i,
|
||||
"gpu", test_get_gpu (),
|
||||
"info", output_info,
|
||||
NULL);
|
||||
|
||||
output_test = META_OUTPUT_TEST (output);
|
||||
output_test->scale = scale;
|
||||
|
||||
if (crtc)
|
||||
{
|
||||
MetaOutputAssignment output_assignment;
|
||||
@ -695,9 +686,6 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||
meta_output_assign_crtc (output, crtc, &output_assignment);
|
||||
}
|
||||
|
||||
output->driver_private = output_test;
|
||||
output->driver_notify = (GDestroyNotify) meta_output_test_destroy_notify;
|
||||
|
||||
test_setup->outputs = g_list_append (test_setup->outputs, output);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user