diff options
author | james qian wang (Arm Technology China) <james.qian.wang@arm.com> | 2019-05-23 14:09:57 +0300 |
---|---|---|
committer | Liviu Dudau <Liviu.Dudau@arm.com> | 2019-06-19 13:42:16 +0300 |
commit | 7fded557c439642ca83559d57ceefd18cf125a01 (patch) | |
tree | 040e4e7f75567e5d09264e59aa8d1d08a9608cf9 /drivers/gpu/drm/arm | |
parent | 65ad2392dd6d1691db93e82b08d3311298b9d64a (diff) | |
download | linux-7fded557c439642ca83559d57ceefd18cf125a01.tar.xz |
drm/komeda: Attach scaler to drm as private object
According to the komeda pipeline configuration, attach scaler to drm as
private object.
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')
-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 d53bd6c23c5d..bac90ab8fdc9 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c @@ -61,6 +61,49 @@ static int komeda_layer_obj_add(struct komeda_kms_dev *kms, } static struct drm_private_state * +komeda_scaler_atomic_duplicate_state(struct drm_private_obj *obj) +{ + struct komeda_scaler_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_scaler_atomic_destroy_state(struct drm_private_obj *obj, + struct drm_private_state *state) +{ + kfree(to_scaler_st(priv_to_comp_st(state))); +} + +static const struct drm_private_state_funcs komeda_scaler_obj_funcs = { + .atomic_duplicate_state = komeda_scaler_atomic_duplicate_state, + .atomic_destroy_state = komeda_scaler_atomic_destroy_state, +}; + +static int komeda_scaler_obj_add(struct komeda_kms_dev *kms, + struct komeda_scaler *scaler) +{ + struct komeda_scaler_state *st; + + st = kzalloc(sizeof(*st), GFP_KERNEL); + if (!st) + return -ENOMEM; + + st->base.component = &scaler->base; + drm_atomic_private_obj_init(&kms->base, + &scaler->base.obj, &st->base.obj, + &komeda_scaler_obj_funcs); + return 0; +} + +static struct drm_private_state * komeda_compiz_atomic_duplicate_state(struct drm_private_obj *obj) { struct komeda_compiz_state *st; @@ -258,6 +301,12 @@ int komeda_kms_add_private_objs(struct komeda_kms_dev *kms, return err; } + for (j = 0; j < pipe->n_scalers; j++) { + err = komeda_scaler_obj_add(kms, pipe->scalers[j]); + if (err) + return err; + } + err = komeda_compiz_obj_add(kms, pipe->compiz); if (err) return err; |