mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
crtc: Move MetaCrtcConfig field to instance private
Last piece before MetCrtc can be made a derivable type. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
c3fc6025b1
commit
092c5304a9
@ -43,6 +43,8 @@ typedef struct _MetaCrtcPrivate
|
||||
MetaGpu *gpu;
|
||||
|
||||
MetaMonitorTransform all_transforms;
|
||||
|
||||
MetaCrtcConfig *config;
|
||||
} MetaCrtcPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
|
||||
@ -79,6 +81,7 @@ meta_crtc_set_config (MetaCrtc *crtc,
|
||||
MetaCrtcMode *mode,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
MetaCrtcConfig *config;
|
||||
|
||||
meta_crtc_unset_config (crtc);
|
||||
@ -88,13 +91,23 @@ meta_crtc_set_config (MetaCrtc *crtc,
|
||||
config->mode = mode;
|
||||
config->transform = transform;
|
||||
|
||||
crtc->config = config;
|
||||
priv->config = config;
|
||||
}
|
||||
|
||||
void
|
||||
meta_crtc_unset_config (MetaCrtc *crtc)
|
||||
{
|
||||
g_clear_pointer (&crtc->config, g_free);
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
|
||||
g_clear_pointer (&priv->config, g_free);
|
||||
}
|
||||
|
||||
const MetaCrtcConfig *
|
||||
meta_crtc_get_config (MetaCrtc *crtc)
|
||||
{
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
|
||||
return priv->config;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -151,11 +164,12 @@ static void
|
||||
meta_crtc_finalize (GObject *object)
|
||||
{
|
||||
MetaCrtc *crtc = META_CRTC (object);
|
||||
MetaCrtcPrivate *priv = meta_crtc_get_instance_private (crtc);
|
||||
|
||||
if (crtc->driver_notify)
|
||||
crtc->driver_notify (crtc);
|
||||
|
||||
g_clear_pointer (&crtc->config, g_free);
|
||||
g_clear_pointer (&priv->config, g_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_crtc_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -60,8 +60,6 @@ struct _MetaCrtc
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
MetaCrtcConfig *config;
|
||||
|
||||
gpointer driver_private;
|
||||
GDestroyNotify driver_notify;
|
||||
};
|
||||
@ -106,4 +104,7 @@ void meta_crtc_set_config (MetaCrtc *crtc,
|
||||
META_EXPORT_TEST
|
||||
void meta_crtc_unset_config (MetaCrtc *crtc);
|
||||
|
||||
META_EXPORT_TEST
|
||||
const MetaCrtcConfig * meta_crtc_get_config (MetaCrtc *crtc);
|
||||
|
||||
#endif /* META_CRTC_H */
|
||||
|
@ -119,10 +119,14 @@ static MetaMonitorTransform
|
||||
derive_monitor_transform (MetaMonitor *monitor)
|
||||
{
|
||||
MetaOutput *main_output;
|
||||
MetaCrtc *crtc;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
MetaMonitorTransform transform;
|
||||
|
||||
main_output = meta_monitor_get_main_output (monitor);
|
||||
transform = meta_output_get_assigned_crtc (main_output)->config->transform;
|
||||
crtc = meta_output_get_assigned_crtc (main_output);
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
transform = crtc_config->transform;
|
||||
|
||||
return meta_monitor_crtc_to_logical_transform (monitor, transform);
|
||||
}
|
||||
|
@ -1017,7 +1017,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
{
|
||||
MetaCrtc *crtc = l->data;
|
||||
GVariantBuilder transforms;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
|
||||
g_variant_builder_init (&transforms, G_VARIANT_TYPE ("au"));
|
||||
for (j = 0; j <= META_MONITOR_TRANSFORM_FLIPPED_270; j++)
|
||||
@ -1026,8 +1026,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
g_variant_builder_add (&transforms, "u", j);
|
||||
}
|
||||
|
||||
crtc_config = crtc->config;
|
||||
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
if (crtc_config)
|
||||
{
|
||||
int current_mode_index;
|
||||
|
@ -642,8 +642,14 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
|
||||
monitor_priv->preferred_mode = mode;
|
||||
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
if (crtc && crtc->config && crtc_mode == crtc->config->mode)
|
||||
monitor_priv->current_mode = mode;
|
||||
if (crtc)
|
||||
{
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
if (crtc_config && crtc_mode == crtc_config->mode)
|
||||
monitor_priv->current_mode = mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,11 +695,11 @@ meta_monitor_normal_derive_layout (MetaMonitor *monitor,
|
||||
{
|
||||
MetaOutput *output;
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
g_return_if_fail (crtc_config);
|
||||
|
||||
@ -910,11 +916,14 @@ is_monitor_mode_assigned (MetaMonitor *monitor,
|
||||
MetaOutput *output = l->data;
|
||||
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
||||
MetaCrtc *crtc;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
crtc_config = crtc ? meta_crtc_get_config (crtc) : NULL;
|
||||
|
||||
if (monitor_crtc_mode->crtc_mode &&
|
||||
(!crtc || !crtc->config ||
|
||||
crtc->config->mode != monitor_crtc_mode->crtc_mode))
|
||||
(!crtc || !crtc_config ||
|
||||
crtc_config->mode != monitor_crtc_mode->crtc_mode))
|
||||
return FALSE;
|
||||
else if (!monitor_crtc_mode->crtc_mode && crtc)
|
||||
return FALSE;
|
||||
@ -1379,14 +1388,14 @@ meta_monitor_tiled_derive_layout (MetaMonitor *monitor,
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
graphene_rect_t *crtc_layout;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
const graphene_rect_t *crtc_layout;
|
||||
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
if (!crtc)
|
||||
continue;
|
||||
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
g_return_if_fail (crtc_config);
|
||||
|
||||
crtc_layout = &crtc_config->layout;
|
||||
@ -1553,7 +1562,8 @@ is_current_mode_known (MetaMonitor *monitor)
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
|
||||
return meta_monitor_is_active (monitor) == (crtc && crtc->config);
|
||||
return (meta_monitor_is_active (monitor) ==
|
||||
(crtc && meta_crtc_get_config (crtc)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -80,9 +80,12 @@ meta_crtc_kms_apply_transform (MetaCrtc *crtc,
|
||||
MetaKmsPlaneAssignment *kms_plane_assignment)
|
||||
{
|
||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
MetaMonitorTransform hw_transform;
|
||||
|
||||
hw_transform = crtc->config->transform;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
hw_transform = crtc_config->transform;
|
||||
if (!meta_crtc_kms_is_transform_handled (crtc, hw_transform))
|
||||
hw_transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||
if (!meta_crtc_kms_is_transform_handled (crtc, hw_transform))
|
||||
@ -98,7 +101,7 @@ meta_crtc_kms_assign_primary_plane (MetaCrtc *crtc,
|
||||
uint32_t fb_id,
|
||||
MetaKmsUpdate *kms_update)
|
||||
{
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
MetaFixed16Rectangle src_rect;
|
||||
MetaFixed16Rectangle dst_rect;
|
||||
MetaKmsAssignPlaneFlag flags;
|
||||
@ -107,8 +110,7 @@ meta_crtc_kms_assign_primary_plane (MetaCrtc *crtc,
|
||||
MetaKmsPlane *primary_kms_plane;
|
||||
MetaKmsPlaneAssignment *plane_assignment;
|
||||
|
||||
crtc_config = crtc->config;
|
||||
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
src_rect = (MetaFixed16Rectangle) {
|
||||
.x = meta_fixed_16_from_int (0),
|
||||
@ -168,7 +170,6 @@ void
|
||||
meta_crtc_kms_set_mode (MetaCrtc *crtc,
|
||||
MetaKmsUpdate *kms_update)
|
||||
{
|
||||
MetaCrtcConfig *crtc_config = crtc->config;
|
||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
||||
GList *connectors;
|
||||
drmModeModeInfo *mode;
|
||||
@ -177,6 +178,8 @@ meta_crtc_kms_set_mode (MetaCrtc *crtc,
|
||||
|
||||
if (connectors)
|
||||
{
|
||||
const MetaCrtcConfig *crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
mode = crtc_config->mode->driver_private;
|
||||
|
||||
g_debug ("Setting CRTC (%ld) mode to %s",
|
||||
|
@ -65,11 +65,11 @@ meta_output_kms_set_underscan (MetaOutput *output,
|
||||
if (meta_output_is_underscanning (output))
|
||||
{
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
uint64_t hborder, vborder;
|
||||
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
hborder = MIN (128, (uint64_t) round (crtc_config->mode->width * 0.05));
|
||||
vborder = MIN (128, (uint64_t) round (crtc_config->mode->height * 0.05));
|
||||
|
||||
|
@ -1127,6 +1127,7 @@ notify_view_crtc_presented (MetaRendererView *view,
|
||||
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
||||
CoglFrameInfo *frame_info;
|
||||
MetaCrtc *crtc;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
float refresh_rate;
|
||||
MetaGpuKms *gpu_kms;
|
||||
|
||||
@ -1138,9 +1139,8 @@ notify_view_crtc_presented (MetaRendererView *view,
|
||||
frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
|
||||
|
||||
crtc = meta_crtc_kms_from_kms_crtc (kms_crtc);
|
||||
refresh_rate = crtc && crtc->config ?
|
||||
crtc->config->mode->refresh_rate :
|
||||
0.0f;
|
||||
crtc_config = crtc ? meta_crtc_get_config (crtc) : NULL;
|
||||
refresh_rate = crtc_config ? crtc_config->mode->refresh_rate : 0.0f;
|
||||
if (refresh_rate >= frame_info->refresh_rate)
|
||||
{
|
||||
frame_info->presentation_time = time_ns;
|
||||
@ -2240,10 +2240,12 @@ meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
|
||||
{
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
MetaDrmBuffer *fb;
|
||||
struct gbm_bo *gbm_bo;
|
||||
|
||||
if (onscreen_native->crtc->config->transform != META_MONITOR_TRANSFORM_NORMAL)
|
||||
crtc_config = meta_crtc_get_config (onscreen_native->crtc);
|
||||
if (crtc_config->transform != META_MONITOR_TRANSFORM_NORMAL)
|
||||
return FALSE;
|
||||
|
||||
if (onscreen_native->secondary_gpu_state)
|
||||
@ -3155,7 +3157,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
|
||||
CoglDisplayEGL *cogl_display_egl;
|
||||
CoglOnscreenEGL *onscreen_egl;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
MetaMonitorTransform view_transform;
|
||||
CoglOnscreen *onscreen = NULL;
|
||||
CoglOffscreen *offscreen = NULL;
|
||||
@ -3167,7 +3169,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
MetaRendererView *view;
|
||||
GError *error = NULL;
|
||||
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
onscreen_width = crtc_config->mode->width;
|
||||
onscreen_height = crtc_config->mode->height;
|
||||
|
||||
@ -3219,7 +3221,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
else
|
||||
scale = 1.0;
|
||||
|
||||
meta_rectangle_from_graphene_rect (&crtc->config->layout,
|
||||
meta_rectangle_from_graphene_rect (&crtc_config->layout,
|
||||
META_ROUNDING_STRATEGY_ROUND,
|
||||
&view_layout);
|
||||
view = g_object_new (META_TYPE_RENDERER_VIEW,
|
||||
@ -3297,7 +3299,7 @@ meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
|
||||
{
|
||||
MetaCrtc *crtc = k->data;
|
||||
|
||||
if (crtc->config)
|
||||
if (meta_crtc_get_config (crtc))
|
||||
continue;
|
||||
|
||||
kms_update = meta_kms_ensure_pending_update (kms);
|
||||
|
@ -408,10 +408,10 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
{
|
||||
MetaCrtcAssignment *crtc_assignment = crtcs[i];
|
||||
MetaCrtc *crtc = crtc_assignment->crtc;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
int x2, y2;
|
||||
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
if (!crtc_config)
|
||||
continue;
|
||||
|
||||
@ -439,7 +439,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
{
|
||||
MetaCrtc *crtc = l->data;
|
||||
|
||||
if (!crtc->config)
|
||||
if (!meta_crtc_get_config (crtc))
|
||||
continue;
|
||||
|
||||
xrandr_set_crtc_config (manager_xrandr,
|
||||
|
@ -106,11 +106,11 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
||||
if (underscanning)
|
||||
{
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
uint32_t border_value;
|
||||
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
prop = XInternAtom (xdisplay, "underscan hborder", False);
|
||||
border_value = crtc_config->mode->width * 0.05;
|
||||
|
@ -185,6 +185,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
MetaMonitorTransform view_transform;
|
||||
float view_scale;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
int width, height;
|
||||
CoglOffscreen *fake_onscreen;
|
||||
CoglOffscreen *offscreen;
|
||||
@ -198,8 +199,9 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
|
||||
else
|
||||
view_scale = 1.0;
|
||||
|
||||
width = roundf (crtc->config->layout.size.width * view_scale);
|
||||
height = roundf (crtc->config->layout.size.height * view_scale);
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
width = roundf (crtc_config->layout.size.width * view_scale);
|
||||
height = roundf (crtc_config->layout.size.height * view_scale);
|
||||
|
||||
fake_onscreen = create_offscreen (cogl_context, width, height);
|
||||
|
||||
@ -208,7 +210,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
|
||||
else
|
||||
offscreen = NULL;
|
||||
|
||||
meta_rectangle_from_graphene_rect (&crtc->config->layout,
|
||||
meta_rectangle_from_graphene_rect (&crtc_config->layout,
|
||||
META_ROUNDING_STRATEGY_ROUND,
|
||||
&view_layout);
|
||||
|
||||
|
@ -109,7 +109,7 @@ draw_view (MetaStageX11Nested *stage_nested,
|
||||
CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen);
|
||||
ClutterStageView *stage_view = CLUTTER_STAGE_VIEW (renderer_view);
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
CoglMatrix projection_matrix;
|
||||
CoglMatrix transform;
|
||||
float texture_width, texture_height;
|
||||
@ -120,7 +120,7 @@ draw_view (MetaStageX11Nested *stage_nested,
|
||||
texture_height = cogl_texture_get_height (texture);
|
||||
|
||||
crtc = g_object_get_data (G_OBJECT (renderer_view), "crtc");
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
sample_x = 0;
|
||||
sample_y = 0;
|
||||
|
@ -185,12 +185,12 @@ check_current_monitor_mode (MetaMonitor *monitor,
|
||||
}
|
||||
else
|
||||
{
|
||||
MetaCrtcConfig *crtc_config;
|
||||
const MetaCrtcConfig *crtc_config;
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
|
||||
g_assert_nonnull (crtc);
|
||||
|
||||
crtc_config = crtc->config;
|
||||
crtc_config = meta_crtc_get_config (crtc);
|
||||
g_assert_nonnull (crtc_config);
|
||||
|
||||
g_assert (monitor_crtc_mode->crtc_mode == crtc_config->mode);
|
||||
@ -498,7 +498,7 @@ check_monitor_configuration (MonitorTestCaseExpect *expect)
|
||||
for (l = crtcs, i = 0; l; l = l->next, i++)
|
||||
{
|
||||
MetaCrtc *crtc = l->data;
|
||||
MetaCrtcConfig *crtc_config = crtc->config;
|
||||
const MetaCrtcConfig *crtc_config = meta_crtc_get_config (crtc);
|
||||
|
||||
if (expect->crtcs[i].current_mode == -1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user