diff options
author | james qian wang (Arm Technology China) <james.qian.wang@arm.com> | 2019-06-10 11:15:55 +0100 |
---|---|---|
committer | Liviu Dudau <Liviu.Dudau@arm.com> | 2019-06-19 11:42:17 +0100 |
commit | 9a28105f5a439d3dc5e595042b3f97b1bb4cd4f1 (patch) | |
tree | c13950995fb89a24f2d16b61b24dbc1caee40129 /drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c | |
parent | 619053220a7d5620d26d60d1848ca9c681bea830 (diff) | |
download | lwn-9a28105f5a439d3dc5e595042b3f97b1bb4cd4f1.tar.gz lwn-9a28105f5a439d3dc5e595042b3f97b1bb4cd4f1.zip |
drm/komeda: Add component komeda_merger
Introduce a new component komeda_merger, because D71 HW supports to split
a whole image to two half parts and does the scaling independently. Merger
merges two separate results to one, and output it to compositor or wb_layer
For this patch:
- Add the definition of komeda_merger/merger_state
- Report and initialize komeda_merger according to the D71 HW.
v2: Rebase
Signed-off-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Diffstat (limited to 'drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c')
-rw-r--r-- | drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c b/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c index bac90ab8fdc9..0f4e1f601ce0 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c @@ -147,6 +147,49 @@ static int komeda_compiz_obj_add(struct komeda_kms_dev *kms, } static struct drm_private_state * +komeda_merger_atomic_duplicate_state(struct drm_private_obj *obj) +{ + struct komeda_merger_state *st; + + st = kmemdup(obj->state, sizeof(*st), GFP_KERNEL); + if (!st) + return NULL; + + komeda_component_state_reset(&st->base); + __drm_atomic_helper_private_obj_duplicate_state(obj, &st->base.obj); + + return &st->base.obj; +} + +static void komeda_merger_atomic_destroy_state(struct drm_private_obj *obj, + struct drm_private_state *state) +{ + kfree(to_merger_st(priv_to_comp_st(state))); +} + +static const struct drm_private_state_funcs komeda_merger_obj_funcs = { + .atomic_duplicate_state = komeda_merger_atomic_duplicate_state, + .atomic_destroy_state = komeda_merger_atomic_destroy_state, +}; + +static int komeda_merger_obj_add(struct komeda_kms_dev *kms, + struct komeda_merger *merger) +{ + struct komeda_merger_state *st; + + st = kzalloc(sizeof(*st), GFP_KERNEL); + if (!st) + return -ENOMEM; + + st->base.component = &merger->base; + drm_atomic_private_obj_init(&kms->base, + &merger->base.obj, &st->base.obj, + &komeda_merger_obj_funcs); + + return 0; +} + +static struct drm_private_state * komeda_improc_atomic_duplicate_state(struct drm_private_obj *obj) { struct komeda_improc_state *st; @@ -311,6 +354,12 @@ int komeda_kms_add_private_objs(struct komeda_kms_dev *kms, if (err) return err; + if (pipe->merger) { + err = komeda_merger_obj_add(kms, pipe->merger); + if (err) + return err; + } + err = komeda_improc_obj_add(kms, pipe->improc); if (err) return err; |