mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
crtc: Move all_transforms field into instance private
Now set as a property during construction. Only actually set by the Xrandr backend, as it's the only one currently not supporting all transforms, which is the default. While at it, move the 'ALL_TRANFORMS' macro to meta-monitor-tranforms.h. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
1406348be4
commit
c3fc6025b1
@ -29,6 +29,7 @@ enum
|
||||
|
||||
PROP_ID,
|
||||
PROP_GPU,
|
||||
PROP_ALL_TRANSFORMS,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
@ -40,6 +41,8 @@ typedef struct _MetaCrtcPrivate
|
||||
uint64_t id;
|
||||
|
||||
MetaGpu *gpu;
|
||||
|
||||
MetaMonitorTransform all_transforms;
|
||||
} MetaCrtcPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
|
||||
@ -62,6 +65,14 @@ meta_crtc_get_gpu (MetaCrtc *crtc)
|
||||
return priv->gpu;
|
||||
}
|
||||
|
||||
MetaMonitorTransform
|
||||
meta_crtc_get_all_transforms (MetaCrtc *crtc)
|
||||
{
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
|
||||
return priv->all_transforms;
|
||||
}
|
||||
|
||||
void
|
||||
meta_crtc_set_config (MetaCrtc *crtc,
|
||||
graphene_rect_t *layout,
|
||||
@ -103,6 +114,9 @@ meta_crtc_set_property (GObject *object,
|
||||
case PROP_GPU:
|
||||
priv->gpu = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_ALL_TRANSFORMS:
|
||||
priv->all_transforms = g_value_get_uint (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -125,6 +139,9 @@ meta_crtc_get_property (GObject *object,
|
||||
case PROP_GPU:
|
||||
g_value_set_object (value, priv->gpu);
|
||||
break;
|
||||
case PROP_ALL_TRANSFORMS:
|
||||
g_value_set_uint (value, priv->all_transforms);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@ -146,6 +163,9 @@ meta_crtc_finalize (GObject *object)
|
||||
static void
|
||||
meta_crtc_init (MetaCrtc *crtc)
|
||||
{
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
|
||||
priv->all_transforms = META_MONITOR_ALL_TRANSFORMS;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -173,6 +193,16 @@ meta_crtc_class_init (MetaCrtcClass *klass)
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_ALL_TRANSFORMS] =
|
||||
g_param_spec_uint ("all-transforms",
|
||||
"all-transforms",
|
||||
"All transforms",
|
||||
0,
|
||||
META_MONITOR_ALL_TRANSFORMS,
|
||||
META_MONITOR_ALL_TRANSFORMS,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,6 @@ struct _MetaCrtc
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
unsigned int all_transforms;
|
||||
|
||||
MetaCrtcConfig *config;
|
||||
|
||||
gpointer driver_private;
|
||||
@ -97,6 +95,8 @@ uint64_t meta_crtc_get_id (MetaCrtc *crtc);
|
||||
META_EXPORT_TEST
|
||||
MetaGpu * meta_crtc_get_gpu (MetaCrtc *crtc);
|
||||
|
||||
MetaMonitorTransform meta_crtc_get_all_transforms (MetaCrtc *crtc);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_crtc_set_config (MetaCrtc *crtc,
|
||||
graphene_rect_t *layout,
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include "backends/meta-output.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
||||
|
||||
#define MAX_MONITORS 5
|
||||
#define MAX_OUTPUTS (MAX_MONITORS * 2)
|
||||
#define MAX_CRTCS (MAX_MONITORS * 2)
|
||||
@ -203,7 +201,6 @@ append_monitor (MetaMonitorManager *manager,
|
||||
"id", g_list_length (*crtcs) + 1,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
crtc->all_transforms = ALL_TRANSFORMS;
|
||||
*crtcs = g_list_append (*crtcs, crtc);
|
||||
|
||||
number = g_list_length (*outputs) + 1;
|
||||
@ -298,7 +295,6 @@ append_tiled_monitor (MetaMonitorManager *manager,
|
||||
"id", g_list_length (*crtcs) + i + 1,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
crtc->all_transforms = ALL_TRANSFORMS;
|
||||
new_crtcs = g_list_append (new_crtcs, crtc);
|
||||
}
|
||||
*crtcs = g_list_concat (*crtcs, new_crtcs);
|
||||
|
@ -1021,8 +1021,10 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
|
||||
g_variant_builder_init (&transforms, G_VARIANT_TYPE ("au"));
|
||||
for (j = 0; j <= META_MONITOR_TRANSFORM_FLIPPED_270; j++)
|
||||
if (crtc->all_transforms & (1 << j))
|
||||
g_variant_builder_add (&transforms, "u", j);
|
||||
{
|
||||
if (meta_crtc_get_all_transforms (crtc) & (1 << j))
|
||||
g_variant_builder_add (&transforms, "u", j);
|
||||
}
|
||||
|
||||
crtc_config = crtc->config;
|
||||
|
||||
|
@ -36,6 +36,7 @@ enum _MetaMonitorTransform
|
||||
META_MONITOR_TRANSFORM_FLIPPED_270,
|
||||
};
|
||||
#define META_MONITOR_N_TRANSFORMS (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)
|
||||
#define META_MONITOR_ALL_TRANSFORMS ((1 << META_MONITOR_N_TRANSFORMS) - 1)
|
||||
|
||||
/* Returns true if transform causes width and height to be inverted
|
||||
This is true for the odd transforms in the enum */
|
||||
|
@ -302,7 +302,6 @@ meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
||||
"id", meta_kms_crtc_get_id (kms_crtc),
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
crtc->all_transforms = ALL_TRANSFORMS_MASK;
|
||||
|
||||
crtc_kms = g_new0 (MetaCrtcKms, 1);
|
||||
crtc_kms->kms_crtc = kms_crtc;
|
||||
|
@ -46,8 +46,6 @@
|
||||
#include "backends/x11/meta-gpu-xrandr.h"
|
||||
#include "backends/x11/meta-monitor-manager-xrandr.h"
|
||||
|
||||
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
||||
|
||||
typedef struct _MetaCrtcXrandr
|
||||
{
|
||||
MetaRectangle rect;
|
||||
@ -161,7 +159,7 @@ meta_monitor_transform_from_xrandr_all (Rotation rotation)
|
||||
/* All rotations and one reflection -> all of them by composition */
|
||||
if ((rotation & ALL_ROTATIONS) &&
|
||||
((rotation & RR_Reflect_X) || (rotation & RR_Reflect_Y)))
|
||||
return ALL_TRANSFORMS;
|
||||
return META_MONITOR_ALL_TRANSFORMS;
|
||||
|
||||
ret = 1 << META_MONITOR_TRANSFORM_NORMAL;
|
||||
if (rotation & RR_Rotate_90)
|
||||
@ -242,15 +240,19 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
||||
META_MONITOR_MANAGER_XRANDR (monitor_manager);
|
||||
Display *xdisplay =
|
||||
meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
|
||||
MetaMonitorTransform all_transforms;
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcXrandr *crtc_xrandr;
|
||||
XRRPanning *panning;
|
||||
unsigned int i;
|
||||
GList *modes;
|
||||
|
||||
all_transforms =
|
||||
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
||||
crtc = g_object_new (META_TYPE_CRTC,
|
||||
"id", crtc_id,
|
||||
"gpu", gpu,
|
||||
"all-transforms", all_transforms,
|
||||
NULL);
|
||||
|
||||
crtc_xrandr = g_new0 (MetaCrtcXrandr, 1);
|
||||
@ -280,9 +282,6 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
||||
};
|
||||
}
|
||||
|
||||
crtc->all_transforms =
|
||||
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
||||
|
||||
modes = meta_gpu_get_modes (gpu);
|
||||
for (i = 0; i < (unsigned int) resources->nmode; i++)
|
||||
{
|
||||
|
@ -857,7 +857,8 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
g_warn_if_fail ((crtc->all_transforms & transform) == transform);
|
||||
g_warn_if_fail ((meta_crtc_get_all_transforms (crtc) & transform) ==
|
||||
transform);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "tests/test-utils.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
|
||||
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
||||
#define FRAME_WARNING "Frame has assigned frame counter but no frame drawn time"
|
||||
|
||||
static gboolean
|
||||
@ -143,7 +142,6 @@ meta_test_headless_monitor_connect (void)
|
||||
"id", 1,
|
||||
"gpu", gpu,
|
||||
NULL);
|
||||
crtc->all_transforms = ALL_TRANSFORMS;
|
||||
test_setup->crtcs = g_list_append (NULL, crtc);
|
||||
|
||||
modes = g_new0 (MetaCrtcMode *, 1);
|
||||
|
@ -576,7 +576,6 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
|
||||
"id", i + 1,
|
||||
"gpu", test_get_gpu (),
|
||||
NULL);
|
||||
crtc->all_transforms = ALL_TRANSFORMS;
|
||||
|
||||
test_setup->crtcs = g_list_append (test_setup->crtcs, crtc);
|
||||
}
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "backends/meta-crtc.h"
|
||||
#include "backends/meta-output.h"
|
||||
|
||||
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
||||
|
||||
#define MAX_N_MODES 10
|
||||
#define MAX_N_OUTPUTS 10
|
||||
#define MAX_N_CRTCS 10
|
||||
|
Loading…
Reference in New Issue
Block a user