[Freedreno] [DPU PATCH 6/7] drm/msm: remove msm_prop files
Sean Paul
seanpaul at chromium.org
Mon Jun 4 19:59:12 UTC 2018
On Wed, May 23, 2018 at 12:31:01PM -0700, Jeykumar Sankaran wrote:
> Remove hand rolled msm property caching to handle DPU
> custom properties. This change also cleans up all its
> dependencies to cache and restore respective drm
> states.
>
> Signed-off-by: Jeykumar Sankaran <jsanka at codeaurora.org>
Reviewed-by: Sean Paul <seanpaul at chromium.org>
> ---
> drivers/gpu/drm/msm/Makefile | 1 -
> drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 2 -
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 239 +--------
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 16 -
> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 2 -
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 123 +----
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 12 -
> drivers/gpu/drm/msm/msm_drv.h | 16 +-
> drivers/gpu/drm/msm/msm_prop.c | 688 --------------------------
> drivers/gpu/drm/msm/msm_prop.h | 438 ----------------
> 10 files changed, 8 insertions(+), 1529 deletions(-)
> delete mode 100644 drivers/gpu/drm/msm/msm_prop.c
> delete mode 100644 drivers/gpu/drm/msm/msm_prop.h
>
> diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
> index d289503..5331188 100644
> --- a/drivers/gpu/drm/msm/Makefile
> +++ b/drivers/gpu/drm/msm/Makefile
> @@ -76,7 +76,6 @@ msm-y := \
> dpu_io_util.o \
> dpu_dbg_evtlog.o \
> dpu_power_handle.o \
> - msm_prop.o \
> msm_atomic.o \
> msm_debugfs.o \
> msm_drv.o \
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> index c4820de..e4b82d5 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
> @@ -19,8 +19,6 @@
> #include <linux/clk.h>
> #include <linux/bitmap.h>
>
> -#include "msm_prop.h"
> -
> #include "dpu_kms.h"
> #include "dpu_trace.h"
> #include "dpu_crtc.h"
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index b0a3a30..43d9985 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -579,10 +579,6 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc)
> if (!crtc)
> return;
>
> - if (dpu_crtc->blob_info)
> - drm_property_blob_put(dpu_crtc->blob_info);
> - msm_property_destroy(&dpu_crtc->property_info);
> -
> _dpu_crtc_deinit_events(dpu_crtc);
>
> drm_crtc_cleanup(crtc);
> @@ -1390,9 +1386,7 @@ static void dpu_crtc_destroy_state(struct drm_crtc *crtc,
>
> __drm_atomic_helper_crtc_destroy_state(state);
>
> - /* destroy value helper */
> - msm_property_destroy_state(&dpu_crtc->property_info, cstate,
> - &cstate->property_state);
> + kfree(cstate);
> }
>
> static int _dpu_crtc_wait_for_frame_done(struct drm_crtc *crtc)
> @@ -1641,17 +1635,12 @@ static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc)
>
> dpu_crtc = to_dpu_crtc(crtc);
> old_cstate = to_dpu_crtc_state(crtc->state);
> - cstate = msm_property_alloc_state(&dpu_crtc->property_info);
> + cstate = kmemdup(old_cstate, sizeof(*old_cstate), GFP_KERNEL);
> if (!cstate) {
> DPU_ERROR("failed to allocate state\n");
> return NULL;
> }
>
> - /* duplicate value helper */
> - msm_property_duplicate_state(&dpu_crtc->property_info,
> - old_cstate, cstate,
> - &cstate->property_state, cstate->property_values);
> -
> /* duplicate base helper */
> __drm_atomic_helper_crtc_duplicate_state(crtc, &cstate->base);
>
> @@ -1687,17 +1676,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)
> }
>
> dpu_crtc = to_dpu_crtc(crtc);
> - cstate = msm_property_alloc_state(&dpu_crtc->property_info);
> + cstate = kzalloc(sizeof(*cstate), GFP_KERNEL);
> if (!cstate) {
> DPU_ERROR("failed to allocate state\n");
> return;
> }
>
> - /* reset value helper */
> - msm_property_reset_state(&dpu_crtc->property_info, cstate,
> - &cstate->property_state,
> - cstate->property_values);
> -
> _dpu_crtc_rp_reset(&cstate->rp, &dpu_crtc->rp_lock,
> &dpu_crtc->rp_head);
>
> @@ -2194,212 +2178,6 @@ void dpu_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file)
> _dpu_crtc_complete_flip(crtc, file);
> }
>
> -/**
> - * dpu_crtc_install_properties - install all drm properties for crtc
> - * @crtc: Pointer to drm crtc structure
> - */
> -static void dpu_crtc_install_properties(struct drm_crtc *crtc,
> - struct dpu_mdss_cfg *catalog)
> -{
> - struct dpu_crtc *dpu_crtc;
> - struct drm_device *dev;
> - struct dpu_kms_info *info;
> - struct dpu_kms *dpu_kms;
> -
> - DPU_DEBUG("\n");
> -
> - if (!crtc || !catalog) {
> - DPU_ERROR("invalid crtc or catalog\n");
> - return;
> - }
> -
> - dpu_crtc = to_dpu_crtc(crtc);
> - dev = crtc->dev;
> - dpu_kms = _dpu_crtc_get_kms(crtc);
> -
> - if (!dpu_kms) {
> - DPU_ERROR("invalid argument\n");
> - return;
> - }
> -
> - info = kzalloc(sizeof(struct dpu_kms_info), GFP_KERNEL);
> - if (!info) {
> - DPU_ERROR("failed to allocate info memory\n");
> - return;
> - }
> -
> - msm_property_install_blob(&dpu_crtc->property_info, "capabilities",
> - DRM_MODE_PROP_IMMUTABLE, CRTC_PROP_INFO);
> -
> - dpu_kms_info_reset(info);
> -
> - dpu_kms_info_add_keyint(info, "hw_version", catalog->hwversion);
> - dpu_kms_info_add_keyint(info, "max_linewidth",
> - catalog->caps->max_mixer_width);
> - dpu_kms_info_add_keyint(info, "max_blendstages",
> - catalog->caps->max_mixer_blendstages);
> - if (catalog->caps->qseed_type == DPU_SSPP_SCALER_QSEED2)
> - dpu_kms_info_add_keystr(info, "qseed_type", "qseed2");
> - if (catalog->caps->qseed_type == DPU_SSPP_SCALER_QSEED3)
> - dpu_kms_info_add_keystr(info, "qseed_type", "qseed3");
> -
> - if (dpu_is_custom_client()) {
> - if (catalog->caps->smart_dma_rev == DPU_SSPP_SMART_DMA_V1)
> - dpu_kms_info_add_keystr(info,
> - "smart_dma_rev", "smart_dma_v1");
> - if (catalog->caps->smart_dma_rev == DPU_SSPP_SMART_DMA_V2)
> - dpu_kms_info_add_keystr(info,
> - "smart_dma_rev", "smart_dma_v2");
> - }
> -
> - dpu_kms_info_add_keyint(info, "has_src_split",
> - catalog->caps->has_src_split);
> - if (catalog->perf.max_bw_low)
> - dpu_kms_info_add_keyint(info, "max_bandwidth_low",
> - catalog->perf.max_bw_low * 1000LL);
> - if (catalog->perf.max_bw_high)
> - dpu_kms_info_add_keyint(info, "max_bandwidth_high",
> - catalog->perf.max_bw_high * 1000LL);
> - if (catalog->perf.min_core_ib)
> - dpu_kms_info_add_keyint(info, "min_core_ib",
> - catalog->perf.min_core_ib * 1000LL);
> - if (catalog->perf.min_llcc_ib)
> - dpu_kms_info_add_keyint(info, "min_llcc_ib",
> - catalog->perf.min_llcc_ib * 1000LL);
> - if (catalog->perf.min_dram_ib)
> - dpu_kms_info_add_keyint(info, "min_dram_ib",
> - catalog->perf.min_dram_ib * 1000LL);
> - if (dpu_kms->perf.max_core_clk_rate)
> - dpu_kms_info_add_keyint(info, "max_mdp_clk",
> - dpu_kms->perf.max_core_clk_rate);
> - dpu_kms_info_add_keystr(info, "core_ib_ff",
> - catalog->perf.core_ib_ff);
> - dpu_kms_info_add_keystr(info, "core_clk_ff",
> - catalog->perf.core_clk_ff);
> - dpu_kms_info_add_keystr(info, "comp_ratio_rt",
> - catalog->perf.comp_ratio_rt);
> - dpu_kms_info_add_keystr(info, "comp_ratio_nrt",
> - catalog->perf.comp_ratio_nrt);
> - dpu_kms_info_add_keyint(info, "dest_scale_prefill_lines",
> - catalog->perf.dest_scale_prefill_lines);
> - dpu_kms_info_add_keyint(info, "undersized_prefill_lines",
> - catalog->perf.undersized_prefill_lines);
> - dpu_kms_info_add_keyint(info, "macrotile_prefill_lines",
> - catalog->perf.macrotile_prefill_lines);
> - dpu_kms_info_add_keyint(info, "yuv_nv12_prefill_lines",
> - catalog->perf.yuv_nv12_prefill_lines);
> - dpu_kms_info_add_keyint(info, "linear_prefill_lines",
> - catalog->perf.linear_prefill_lines);
> - dpu_kms_info_add_keyint(info, "downscaling_prefill_lines",
> - catalog->perf.downscaling_prefill_lines);
> - dpu_kms_info_add_keyint(info, "xtra_prefill_lines",
> - catalog->perf.xtra_prefill_lines);
> - dpu_kms_info_add_keyint(info, "amortizable_threshold",
> - catalog->perf.amortizable_threshold);
> - dpu_kms_info_add_keyint(info, "min_prefill_lines",
> - catalog->perf.min_prefill_lines);
> -
> - msm_property_set_blob(&dpu_crtc->property_info, &dpu_crtc->blob_info,
> - info->data, DPU_KMS_INFO_DATALEN(info), CRTC_PROP_INFO);
> -
> - kfree(info);
> -}
> -
> -/**
> - * dpu_crtc_atomic_set_property - atomically set a crtc drm property
> - * @crtc: Pointer to drm crtc structure
> - * @state: Pointer to drm crtc state structure
> - * @property: Pointer to targeted drm property
> - * @val: Updated property value
> - * @Returns: Zero on success
> - */
> -static int dpu_crtc_atomic_set_property(struct drm_crtc *crtc,
> - struct drm_crtc_state *state,
> - struct drm_property *property,
> - uint64_t val)
> -{
> - struct dpu_crtc *dpu_crtc;
> - struct dpu_crtc_state *cstate;
> - int ret = -EINVAL;
> -
> - if (!crtc || !state || !property) {
> - DPU_ERROR("invalid argument(s)\n");
> - } else {
> - dpu_crtc = to_dpu_crtc(crtc);
> - cstate = to_dpu_crtc_state(state);
> - ret = msm_property_atomic_set(&dpu_crtc->property_info,
> - &cstate->property_state, property, val);
> - if (ret)
> - DRM_ERROR("failed to set the property\n");
> -
> - DPU_DEBUG("crtc%d %s[%d] <= 0x%llx ret=%d\n", crtc->base.id,
> - property->name, property->base.id, val, ret);
> - }
> -
> - return ret;
> -}
> -
> -/**
> - * dpu_crtc_set_property - set a crtc drm property
> - * @crtc: Pointer to drm crtc structure
> - * @property: Pointer to targeted drm property
> - * @val: Updated property value
> - * @Returns: Zero on success
> - */
> -static int dpu_crtc_set_property(struct drm_crtc *crtc,
> - struct drm_property *property, uint64_t val)
> -{
> - DPU_DEBUG("\n");
> -
> - return dpu_crtc_atomic_set_property(crtc, crtc->state, property, val);
> -}
> -
> -/**
> - * dpu_crtc_atomic_get_property - retrieve a crtc drm property
> - * @crtc: Pointer to drm crtc structure
> - * @state: Pointer to drm crtc state structure
> - * @property: Pointer to targeted drm property
> - * @val: Pointer to variable for receiving property value
> - * @Returns: Zero on success
> - */
> -static int dpu_crtc_atomic_get_property(struct drm_crtc *crtc,
> - const struct drm_crtc_state *state,
> - struct drm_property *property,
> - uint64_t *val)
> -{
> - struct dpu_crtc *dpu_crtc;
> - struct dpu_crtc_state *cstate;
> - struct drm_encoder *encoder;
> - int i, ret = -EINVAL;
> - bool is_cmd = true;
> -
> - if (!crtc || !state) {
> - DPU_ERROR("invalid argument(s)\n");
> - } else {
> - dpu_crtc = to_dpu_crtc(crtc);
> - cstate = to_dpu_crtc_state(state);
> -
> - /**
> - * set the cmd flag only when all the encoders attached
> - * to the crtc are in cmd mode. Consider all other cases
> - * as video mode.
> - */
> - drm_for_each_encoder(encoder, crtc->dev) {
> - if (encoder->crtc == crtc)
> - is_cmd = dpu_encoder_check_mode(encoder,
> - MSM_DISPLAY_CAP_CMD_MODE);
> - }
> -
> - i = msm_property_index(&dpu_crtc->property_info, property);
> - ret = msm_property_atomic_get(&dpu_crtc->property_info,
> - &cstate->property_state,
> - property, val);
> - if (ret)
> - DRM_ERROR("get property failed\n");
> - }
> - return ret;
> -}
> -
> #ifdef CONFIG_DEBUG_FS
> static int _dpu_debugfs_status_show(struct seq_file *s, void *data)
> {
> @@ -2759,9 +2537,6 @@ static void dpu_crtc_early_unregister(struct drm_crtc *crtc)
> .set_config = drm_atomic_helper_set_config,
> .destroy = dpu_crtc_destroy,
> .page_flip = drm_atomic_helper_page_flip,
> - .set_property = dpu_crtc_set_property,
> - .atomic_set_property = dpu_crtc_atomic_set_property,
> - .atomic_get_property = dpu_crtc_atomic_get_property,
> .reset = dpu_crtc_reset,
> .atomic_duplicate_state = dpu_crtc_duplicate_state,
> .atomic_destroy_state = dpu_crtc_destroy_state,
> @@ -2924,14 +2699,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane)
> return ERR_PTR(rc);
> }
>
> - /* create CRTC properties */
> - msm_property_init(&dpu_crtc->property_info, &crtc->base, dev,
> - priv->crtc_property, dpu_crtc->property_data,
> - CRTC_PROP_COUNT, CRTC_PROP_BLOBCOUNT,
> - sizeof(struct dpu_crtc_state));
> -
> - dpu_crtc_install_properties(crtc, kms->catalog);
> -
> DPU_DEBUG("%s: successfully initialized crtc\n", dpu_crtc->name);
> return crtc;
> }
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> index 6628eb3..f752101 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> @@ -22,7 +22,6 @@
> #include <linux/kthread.h>
> #include <uapi/drm/dpu_drm.h>
> #include <drm/drm_crtc.h>
> -#include "msm_prop.h"
> #include "dpu_kms.h"
> #include "dpu_core_perf.h"
> #include "dpu_hw_blk.h"
> @@ -200,10 +199,6 @@ struct dpu_crtc {
> struct drm_pending_vblank_event *event;
> u32 vsync_count;
>
> - struct msm_property_info property_info;
> - struct msm_property_data property_data[CRTC_PROP_COUNT];
> - struct drm_property_blob *blob_info;
> -
> struct dpu_hw_stage_cfg stage_cfg;
> struct dentry *debugfs_root;
>
> @@ -324,8 +319,6 @@ struct dpu_crtc_state {
> bool is_ppsplit;
> struct dpu_rect lm_bounds[CRTC_DUAL_MIXERS];
>
> - struct msm_property_state property_state;
> - struct msm_property_value property_values[CRTC_PROP_COUNT];
> uint64_t input_fence_timeout_ns;
>
> struct dpu_core_perf_params new_perf;
> @@ -336,15 +329,6 @@ struct dpu_crtc_state {
> container_of(x, struct dpu_crtc_state, base)
>
> /**
> - * dpu_crtc_get_property - query integer value of crtc property
> - * @S: Pointer to crtc state
> - * @X: Property index, from enum msm_mdp_crtc_property
> - * Returns: Integer value of requested property
> - */
> -#define dpu_crtc_get_property(S, X) \
> - ((S) && ((X) < CRTC_PROP_COUNT) ? ((S)->property_values[(X)].value) : 0)
> -
> -/**
> * dpu_crtc_get_mixer_width - get the mixer width
> * Mixer width will be same as panel width(/2 for split)
> */
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> index d853ad9..0339dfd 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> @@ -20,8 +20,6 @@
> #define __DPU_ENCODER_H__
>
> #include <drm/drm_crtc.h>
> -
> -#include "msm_prop.h"
> #include "dpu_hw_mdss.h"
>
> #define DPU_ENCODER_FRAME_EVENT_DONE BIT(0)
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> index 28735c8..faf5903 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> @@ -20,9 +20,8 @@
>
> #include <linux/debugfs.h>
> #include <linux/dma-buf.h>
> -#include "msm_prop.h"
> -#include "msm_drv.h"
>
> +#include "msm_drv.h"
> #include "dpu_kms.h"
> #include "dpu_formats.h"
> #include "dpu_hw_sspp.h"
> @@ -119,9 +118,6 @@ struct dpu_plane {
>
> const struct dpu_sspp_sub_blks *pipe_sblk;
> char pipe_name[DPU_NAME_SIZE];
> - struct msm_property_info property_info;
> - struct msm_property_data property_data[PLANE_PROP_COUNT];
> - struct drm_property_blob *blob_info;
>
> /* debugfs related stuff */
> struct dentry *debugfs_root;
> @@ -1401,7 +1397,6 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane,
> }
>
> _dpu_plane_set_qos_remap(plane);
> -
> return 0;
> }
>
> @@ -1486,89 +1481,6 @@ void dpu_plane_restore(struct drm_plane *plane)
> dpu_plane_atomic_update(plane, plane->state);
> }
>
> -/* helper to install properties which are common to planes and crtcs */
> -static void _dpu_plane_install_properties(struct drm_plane *plane,
> - struct dpu_mdss_cfg *catalog, u32 master_plane_id)
> -{
> - struct dpu_plane *pdpu = to_dpu_plane(plane);
> - int zpos_max = 255;
> - int zpos_def = 0;
> -
> - if (!plane || !pdpu) {
> - DPU_ERROR("invalid plane\n");
> - return;
> - } else if (!pdpu->pipe_hw || !pdpu->pipe_sblk) {
> - DPU_ERROR("invalid plane, pipe_hw %d pipe_sblk %d\n",
> - pdpu->pipe_hw != 0, pdpu->pipe_sblk != 0);
> - return;
> - } else if (!catalog) {
> - DPU_ERROR("invalid catalog\n");
> - return;
> - }
> -
> - pdpu->catalog = catalog;
> -
> - if (dpu_is_custom_client()) {
> - if (catalog->mixer_count &&
> - catalog->mixer[0].sblk->maxblendstages) {
> - zpos_max = catalog->mixer[0].sblk->maxblendstages - 1;
> - if (zpos_max > DPU_STAGE_MAX - DPU_STAGE_0 - 1)
> - zpos_max = DPU_STAGE_MAX - DPU_STAGE_0 - 1;
> - }
> - } else if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
> - /* reserve zpos == 0 for primary planes */
> - zpos_def = drm_plane_index(plane) + 1;
> - }
> -}
> -
> -static int dpu_plane_atomic_set_property(struct drm_plane *plane,
> - struct drm_plane_state *state, struct drm_property *property,
> - uint64_t val)
> -{
> - struct dpu_plane *pdpu = plane ? to_dpu_plane(plane) : NULL;
> - struct dpu_plane_state *pstate;
> - int ret = -EINVAL;
> -
> - DPU_DEBUG_PLANE(pdpu, "\n");
> -
> - if (!plane) {
> - DPU_ERROR("invalid plane\n");
> - } else if (!state) {
> - DPU_ERROR_PLANE(pdpu, "invalid state\n");
> - } else {
> - pstate = to_dpu_plane_state(state);
> - ret = msm_property_atomic_set(&pdpu->property_info,
> - &pstate->property_state, property, val);
> - }
> -
> - DPU_DEBUG_PLANE(pdpu, "%s[%d] <= 0x%llx ret=%d\n",
> - property->name, property->base.id, val, ret);
> -
> - return ret;
> -}
> -
> -static int dpu_plane_atomic_get_property(struct drm_plane *plane,
> - const struct drm_plane_state *state,
> - struct drm_property *property, uint64_t *val)
> -{
> - struct dpu_plane *pdpu = plane ? to_dpu_plane(plane) : NULL;
> - struct dpu_plane_state *pstate;
> - int ret = -EINVAL;
> -
> - if (!plane) {
> - DPU_ERROR("invalid plane\n");
> - } else if (!state) {
> - DPU_ERROR("invalid state\n");
> - } else {
> - DPU_DEBUG_PLANE(pdpu, "\n");
> - pstate = to_dpu_plane_state(state);
> - ret = msm_property_atomic_get(&pdpu->property_info,
> - &pstate->property_state, property, val);
> - }
> -
> - return ret;
> -}
> -
> static void dpu_plane_destroy(struct drm_plane *plane)
> {
> struct dpu_plane *pdpu = plane ? to_dpu_plane(plane) : NULL;
> @@ -1578,9 +1490,6 @@ static void dpu_plane_destroy(struct drm_plane *plane)
> if (pdpu) {
> _dpu_plane_set_qos_ctrl(plane, false, DPU_PLANE_QOS_PANIC_CTRL);
>
> - if (pdpu->blob_info)
> - drm_property_blob_put(pdpu->blob_info);
> - msm_property_destroy(&pdpu->property_info);
> mutex_destroy(&pdpu->lock);
>
> drm_plane_helper_disable(plane);
> @@ -1598,7 +1507,6 @@ static void dpu_plane_destroy(struct drm_plane *plane)
> static void dpu_plane_destroy_state(struct drm_plane *plane,
> struct drm_plane_state *state)
> {
> - struct dpu_plane *pdpu;
> struct dpu_plane_state *pstate;
>
> if (!plane || !state) {
> @@ -1607,18 +1515,13 @@ static void dpu_plane_destroy_state(struct drm_plane *plane,
> return;
> }
>
> - pdpu = to_dpu_plane(plane);
> pstate = to_dpu_plane_state(state);
>
> - DPU_DEBUG_PLANE(pdpu, "\n");
> -
> /* remove ref count for frame buffers */
> if (state->fb)
> drm_framebuffer_put(state->fb);
>
> - /* destroy value helper */
> - msm_property_destroy_state(&pdpu->property_info, pstate,
> - &pstate->property_state);
> + kfree(pstate);
> }
>
> static struct drm_plane_state *
> @@ -1638,7 +1541,7 @@ static void dpu_plane_destroy_state(struct drm_plane *plane,
>
> old_state = to_dpu_plane_state(plane->state);
> pdpu = to_dpu_plane(plane);
> - pstate = msm_property_alloc_state(&pdpu->property_info);
> + pstate = kmemdup(old_state, sizeof(*old_state), GFP_KERNEL);
> if (!pstate) {
> DPU_ERROR_PLANE(pdpu, "failed to allocate state\n");
> return NULL;
> @@ -1646,10 +1549,6 @@ static void dpu_plane_destroy_state(struct drm_plane *plane,
>
> DPU_DEBUG_PLANE(pdpu, "\n");
>
> - /* duplicate value helper */
> - msm_property_duplicate_state(&pdpu->property_info, old_state, pstate,
> - &pstate->property_state, pstate->property_values);
> -
> pstate->pending = false;
>
> __drm_atomic_helper_plane_duplicate_state(plane, &pstate->base);
> @@ -1676,17 +1575,12 @@ static void dpu_plane_reset(struct drm_plane *plane)
> plane->state = 0;
> }
>
> - pstate = msm_property_alloc_state(&pdpu->property_info);
> + pstate = kzalloc(sizeof(*pstate), GFP_KERNEL);
> if (!pstate) {
> DPU_ERROR_PLANE(pdpu, "failed to allocate state\n");
> return;
> }
>
> - /* reset value helper */
> - msm_property_reset_state(&pdpu->property_info, pstate,
> - &pstate->property_state,
> - pstate->property_values);
> -
> pstate->base.plane = plane;
>
> plane->state = &pstate->base;
> @@ -1919,8 +1813,6 @@ static void dpu_plane_early_unregister(struct drm_plane *plane)
> .update_plane = drm_atomic_helper_update_plane,
> .disable_plane = drm_atomic_helper_disable_plane,
> .destroy = dpu_plane_destroy,
> - .atomic_set_property = dpu_plane_atomic_set_property,
> - .atomic_get_property = dpu_plane_atomic_get_property,
> .reset = dpu_plane_reset,
> .atomic_duplicate_state = dpu_plane_duplicate_state,
> .atomic_destroy_state = dpu_plane_destroy_state,
> @@ -2064,13 +1956,6 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev,
> /* success! finalize initialization */
> drm_plane_helper_add(plane, &dpu_plane_helper_funcs);
>
> - msm_property_init(&pdpu->property_info, &plane->base, dev,
> - priv->plane_property, pdpu->property_data,
> - PLANE_PROP_COUNT, PLANE_PROP_BLOBCOUNT,
> - sizeof(struct dpu_plane_state));
> -
> - _dpu_plane_install_properties(plane, kms->catalog, master_plane_id);
> -
> /* save user friendly pipe name for later */
> snprintf(pdpu->pipe_name, DPU_NAME_SIZE, "plane%u", plane->base.id);
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h
> index a06c8b4..f6fe6dd 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h
> @@ -21,7 +21,6 @@
>
> #include <drm/drm_crtc.h>
>
> -#include "msm_prop.h"
> #include "dpu_kms.h"
> #include "dpu_hw_mdss.h"
> #include "dpu_hw_sspp.h"
> @@ -44,8 +43,6 @@
> */
> struct dpu_plane_state {
> struct drm_plane_state base;
> - struct msm_property_state property_state;
> - struct msm_property_value property_values[PLANE_PROP_COUNT];
> struct msm_gem_address_space *aspace;
> void *input_fence;
> enum dpu_stage stage;
> @@ -74,15 +71,6 @@ struct dpu_multirect_plane_states {
> container_of(x, struct dpu_plane_state, base)
>
> /**
> - * dpu_plane_get_property - Query integer value of plane property
> - * @S: Pointer to plane state
> - * @X: Property index, from enum msm_mdp_plane_property
> - * Returns: Integer value of requested property
> - */
> -#define dpu_plane_get_property(S, X) ((S) && ((X) < PLANE_PROP_COUNT) ? \
> - ((S)->property_values[(X)].value) : 0)
> -
> -/**
> * dpu_plane_pipe - return sspp identifier for the given plane
> * @plane: Pointer to DRM plane object
> * Returns: sspp identifier of the given plane
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index 8e80b4b..edb395d 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -77,26 +77,13 @@ struct msm_file_private {
> };
>
> enum msm_mdp_plane_property {
> - /* # of blob properties */
> - PLANE_PROP_BLOBCOUNT,
> -
> /* range properties */
> - PLANE_PROP_ZPOS = PLANE_PROP_BLOBCOUNT,
> + PLANE_PROP_ZPOS,
>
> /* total # of properties */
> PLANE_PROP_COUNT
> };
>
> -enum msm_mdp_crtc_property {
> - CRTC_PROP_INFO,
> -
> - /* # of blob properties */
> - CRTC_PROP_BLOBCOUNT,
> -
> - /* total # of properties */
> - CRTC_PROP_COUNT
> -};
> -
> struct msm_vblank_ctrl {
> struct kthread_work work;
> struct list_head event_list;
> @@ -364,7 +351,6 @@ struct msm_drm_private {
>
> /* Properties */
> struct drm_property *plane_property[PLANE_PROP_COUNT];
> - struct drm_property *crtc_property[CRTC_PROP_COUNT];
>
> /* Color processing properties for the crtc */
> struct drm_property **cp_property;
> diff --git a/drivers/gpu/drm/msm/msm_prop.c b/drivers/gpu/drm/msm/msm_prop.c
> deleted file mode 100644
> index 8f27cde..0000000
> --- a/drivers/gpu/drm/msm/msm_prop.c
> +++ /dev/null
> @@ -1,688 +0,0 @@
> -/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 and
> - * only version 2 as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - */
> -
> -#include "msm_prop.h"
> -
> -void msm_property_init(struct msm_property_info *info,
> - struct drm_mode_object *base,
> - struct drm_device *dev,
> - struct drm_property **property_array,
> - struct msm_property_data *property_data,
> - uint32_t property_count,
> - uint32_t blob_count,
> - uint32_t state_size)
> -{
> - /* prevent access if any of these are NULL */
> - if (!base || !dev || !property_array || !property_data) {
> - property_count = 0;
> - blob_count = 0;
> -
> - DRM_ERROR("invalid arguments, forcing zero properties\n");
> - return;
> - }
> -
> - /* can't have more blob properties than total properties */
> - if (blob_count > property_count) {
> - blob_count = property_count;
> -
> - DBG("Capping number of blob properties to %d", blob_count);
> - }
> -
> - if (!info) {
> - DRM_ERROR("info pointer is NULL\n");
> - } else {
> - info->base = base;
> - info->dev = dev;
> - info->property_array = property_array;
> - info->property_data = property_data;
> - info->property_count = property_count;
> - info->blob_count = blob_count;
> - info->install_request = 0;
> - info->install_count = 0;
> - info->recent_idx = 0;
> - info->is_active = false;
> - info->state_size = state_size;
> - info->state_cache_size = 0;
> - mutex_init(&info->property_lock);
> -
> - memset(property_data,
> - 0,
> - sizeof(struct msm_property_data) *
> - property_count);
> - }
> -}
> -
> -void msm_property_destroy(struct msm_property_info *info)
> -{
> - if (!info)
> - return;
> -
> - /* free state cache */
> - while (info->state_cache_size > 0)
> - kfree(info->state_cache[--(info->state_cache_size)]);
> -
> - mutex_destroy(&info->property_lock);
> -}
> -
> -int msm_property_pop_dirty(struct msm_property_info *info,
> - struct msm_property_state *property_state)
> -{
> - struct list_head *item;
> - int rc = 0;
> -
> - if (!info || !property_state || !property_state->values) {
> - DRM_ERROR("invalid argument(s)\n");
> - return -EINVAL;
> - }
> -
> - mutex_lock(&info->property_lock);
> - if (list_empty(&property_state->dirty_list)) {
> - rc = -EAGAIN;
> - } else {
> - item = property_state->dirty_list.next;
> - list_del_init(item);
> - rc = container_of(item, struct msm_property_value, dirty_node)
> - - property_state->values;
> - DRM_DEBUG_KMS("property %d dirty\n", rc);
> - }
> - mutex_unlock(&info->property_lock);
> -
> - return rc;
> -}
> -
> -/**
> - * _msm_property_set_dirty_no_lock - flag given property as being dirty
> - * This function doesn't mutex protect the
> - * dirty linked list.
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to property state container struct
> - * @property_idx: Property index
> - */
> -static void _msm_property_set_dirty_no_lock(
> - struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - uint32_t property_idx)
> -{
> - if (!info || !property_state || !property_state->values ||
> - property_idx >= info->property_count) {
> - DRM_ERROR("invalid argument(s), idx %u\n", property_idx);
> - return;
> - }
> -
> - /* avoid re-inserting if already dirty */
> - if (!list_empty(&property_state->values[property_idx].dirty_node)) {
> - DRM_DEBUG_KMS("property %u already dirty\n", property_idx);
> - return;
> - }
> -
> - list_add_tail(&property_state->values[property_idx].dirty_node,
> - &property_state->dirty_list);
> -}
> -
> -/**
> - * _msm_property_install_integer - install standard drm range property
> - * @info: Pointer to property info container struct
> - * @name: Property name
> - * @flags: Other property type flags, e.g. DRM_MODE_PROP_IMMUTABLE
> - * @min: Min property value
> - * @max: Max property value
> - * @init: Default Property value
> - * @property_idx: Property index
> - * @force_dirty: Whether or not to filter 'dirty' status on unchanged values
> - */
> -static void _msm_property_install_integer(struct msm_property_info *info,
> - const char *name, int flags, uint64_t min, uint64_t max,
> - uint64_t init, uint32_t property_idx, bool force_dirty)
> -{
> - struct drm_property **prop;
> -
> - if (!info)
> - return;
> -
> - ++info->install_request;
> -
> - if (!name || (property_idx >= info->property_count)) {
> - DRM_ERROR("invalid argument(s), %s\n", name ? name : "null");
> - } else {
> - prop = &info->property_array[property_idx];
> - /*
> - * Properties need to be attached to each drm object that
> - * uses them, but only need to be created once
> - */
> - if (*prop == 0) {
> - *prop = drm_property_create_range(info->dev,
> - flags, name, min, max);
> - if (*prop == 0)
> - DRM_ERROR("create %s property failed\n", name);
> - }
> -
> - /* save init value for later */
> - info->property_data[property_idx].default_value = init;
> - info->property_data[property_idx].force_dirty = force_dirty;
> -
> - /* always attach property, if created */
> - if (*prop) {
> - drm_object_attach_property(info->base, *prop, init);
> - ++info->install_count;
> - }
> - }
> -}
> -
> -void msm_property_install_range(struct msm_property_info *info,
> - const char *name, int flags, uint64_t min, uint64_t max,
> - uint64_t init, uint32_t property_idx)
> -{
> - _msm_property_install_integer(info, name, flags,
> - min, max, init, property_idx, false);
> -}
> -
> -void msm_property_install_volatile_range(struct msm_property_info *info,
> - const char *name, int flags, uint64_t min, uint64_t max,
> - uint64_t init, uint32_t property_idx)
> -{
> - _msm_property_install_integer(info, name, flags,
> - min, max, init, property_idx, true);
> -}
> -
> -void msm_property_install_rotation(struct msm_property_info *info,
> - struct drm_plane *plane, unsigned int rotation,
> - unsigned int supported_rotations, uint32_t property_idx)
> -{
> - if (!info || !plane)
> - return;
> -
> - ++info->install_request;
> -
> - if (property_idx >= info->property_count) {
> - DRM_ERROR("invalid property index %d\n", property_idx);
> - return;
> - }
> -
> - if (drm_plane_create_rotation_property(plane,
> - rotation, supported_rotations)) {
> - DRM_ERROR("create rotation property failed\n");
> - return;
> - }
> -
> - if (plane->rotation_property) {
> - info->property_array[property_idx] = plane->rotation_property;
> -
> - /* save init value for later */
> - info->property_data[property_idx].default_value = rotation;
> - info->property_data[property_idx].force_dirty = false;
> -
> - ++info->install_count;
> - }
> -}
> -
> -void msm_property_install_enum(struct msm_property_info *info,
> - const char *name, int flags, int is_bitmask,
> - const struct drm_prop_enum_list *values, int num_values,
> - uint32_t property_idx)
> -{
> - struct drm_property **prop;
> -
> - if (!info)
> - return;
> -
> - ++info->install_request;
> -
> - if (!name || !values || !num_values ||
> - (property_idx >= info->property_count)) {
> - DRM_ERROR("invalid argument(s), %s\n", name ? name : "null");
> - } else {
> - prop = &info->property_array[property_idx];
> - /*
> - * Properties need to be attached to each drm object that
> - * uses them, but only need to be created once
> - */
> - if (*prop == 0) {
> - /* 'bitmask' is a special type of 'enum' */
> - if (is_bitmask)
> - *prop = drm_property_create_bitmask(info->dev,
> - DRM_MODE_PROP_BITMASK | flags,
> - name, values, num_values, -1);
> - else
> - *prop = drm_property_create_enum(info->dev,
> - DRM_MODE_PROP_ENUM | flags,
> - name, values, num_values);
> - if (*prop == 0)
> - DRM_ERROR("create %s property failed\n", name);
> - }
> -
> - /* save init value for later */
> - info->property_data[property_idx].default_value = 0;
> - info->property_data[property_idx].force_dirty = false;
> -
> - /* select first defined value for enums */
> - if (!is_bitmask)
> - info->property_data[property_idx].default_value =
> - values->type;
> -
> - /* always attach property, if created */
> - if (*prop) {
> - drm_object_attach_property(info->base, *prop,
> - info->property_data
> - [property_idx].default_value);
> - ++info->install_count;
> - }
> - }
> -}
> -
> -void msm_property_install_blob(struct msm_property_info *info,
> - const char *name, int flags, uint32_t property_idx)
> -{
> - struct drm_property **prop;
> -
> - if (!info)
> - return;
> -
> - ++info->install_request;
> -
> - if (!name || (property_idx >= info->blob_count)) {
> - DRM_ERROR("invalid argument(s), %s\n", name ? name : "null");
> - } else {
> - prop = &info->property_array[property_idx];
> - /*
> - * Properties need to be attached to each drm object that
> - * uses them, but only need to be created once
> - */
> - if (*prop == 0) {
> - /* use 'create' for blob property place holder */
> - *prop = drm_property_create(info->dev,
> - DRM_MODE_PROP_BLOB | flags, name, 0);
> - if (*prop == 0)
> - DRM_ERROR("create %s property failed\n", name);
> - }
> -
> - /* save init value for later */
> - info->property_data[property_idx].default_value = 0;
> - info->property_data[property_idx].force_dirty = true;
> -
> - /* always attach property, if created */
> - if (*prop) {
> - drm_object_attach_property(info->base, *prop, -1);
> - ++info->install_count;
> - }
> - }
> -}
> -
> -int msm_property_install_get_status(struct msm_property_info *info)
> -{
> - int rc = -ENOMEM;
> -
> - if (info && (info->install_request == info->install_count))
> - rc = 0;
> -
> - return rc;
> -}
> -
> -int msm_property_index(struct msm_property_info *info,
> - struct drm_property *property)
> -{
> - uint32_t count;
> - int32_t idx;
> - int rc = -EINVAL;
> -
> - if (!info || !property) {
> - DRM_ERROR("invalid argument(s)\n");
> - } else {
> - /*
> - * Linear search, but start from last found index. This will
> - * help if any single property is accessed multiple times in a
> - * row. Ideally, we could keep a list of properties sorted in
> - * the order of most recent access, but that may be overkill
> - * for now.
> - */
> - mutex_lock(&info->property_lock);
> - idx = info->recent_idx;
> - count = info->property_count;
> - while (count) {
> - --count;
> -
> - /* stop searching on match */
> - if (info->property_array[idx] == property) {
> - info->recent_idx = idx;
> - rc = idx;
> - break;
> - }
> -
> - /* move to next valid index */
> - if (--idx < 0)
> - idx = info->property_count - 1;
> - }
> - mutex_unlock(&info->property_lock);
> - }
> -
> - return rc;
> -}
> -
> -int msm_property_set_dirty(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - int property_idx)
> -{
> - if (!info || !property_state || !property_state->values) {
> - DRM_ERROR("invalid argument(s)\n");
> - return -EINVAL;
> - }
> - mutex_lock(&info->property_lock);
> - _msm_property_set_dirty_no_lock(info, property_state, property_idx);
> - mutex_unlock(&info->property_lock);
> - return 0;
> -}
> -
> -int msm_property_atomic_set(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - struct drm_property *property, uint64_t val)
> -{
> - struct drm_property_blob *blob;
> - int property_idx, rc = -EINVAL;
> -
> - property_idx = msm_property_index(info, property);
> - if (!info || !property_state ||
> - (property_idx == -EINVAL) || !property_state->values) {
> - DRM_DEBUG("invalid argument(s)\n");
> - } else {
> - /* extra handling for incoming properties */
> - mutex_lock(&info->property_lock);
> - if ((property->flags & DRM_MODE_PROP_BLOB) &&
> - (property_idx < info->blob_count)) {
> - /* DRM lookup also takes a reference */
> - blob = drm_property_lookup_blob(info->dev,
> - (uint32_t)val);
> - if (!blob) {
> - DRM_ERROR("blob not found\n");
> - val = 0;
> - } else {
> - DBG("Blob %u saved", blob->base.id);
> - val = blob->base.id;
> -
> - /* save blob - need to clear previous ref */
> - if (property_state->values[property_idx].blob)
> - drm_property_blob_put(
> - property_state->values[
> - property_idx].blob);
> - property_state->values[property_idx].blob =
> - blob;
> - }
> - }
> -
> - /* update value and flag as dirty */
> - if (property_state->values[property_idx].value != val ||
> - info->property_data[property_idx].force_dirty) {
> - property_state->values[property_idx].value = val;
> - _msm_property_set_dirty_no_lock(info, property_state,
> - property_idx);
> -
> - DBG("%s - %lld", property->name, val);
> - }
> - mutex_unlock(&info->property_lock);
> - rc = 0;
> - }
> -
> - return rc;
> -}
> -
> -int msm_property_atomic_get(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - struct drm_property *property, uint64_t *val)
> -{
> - int property_idx, rc = -EINVAL;
> -
> - property_idx = msm_property_index(info, property);
> - if (!info || (property_idx == -EINVAL) ||
> - !property_state->values || !val) {
> - DRM_DEBUG("Invalid argument(s)\n");
> - } else {
> - mutex_lock(&info->property_lock);
> - *val = property_state->values[property_idx].value;
> - mutex_unlock(&info->property_lock);
> - rc = 0;
> - }
> -
> - return rc;
> -}
> -
> -void *msm_property_alloc_state(struct msm_property_info *info)
> -{
> - void *state = NULL;
> -
> - if (!info) {
> - DRM_ERROR("invalid property info\n");
> - return NULL;
> - }
> -
> - mutex_lock(&info->property_lock);
> - if (info->state_cache_size)
> - state = info->state_cache[--(info->state_cache_size)];
> - mutex_unlock(&info->property_lock);
> -
> - if (!state && info->state_size)
> - state = kmalloc(info->state_size, GFP_KERNEL);
> -
> - if (!state)
> - DRM_ERROR("failed to allocate state\n");
> -
> - return state;
> -}
> -
> -/**
> - * _msm_property_free_state - helper function for freeing local state objects
> - * @info: Pointer to property info container struct
> - * @st: Pointer to state object
> - */
> -static void _msm_property_free_state(struct msm_property_info *info, void *st)
> -{
> - if (!info || !st)
> - return;
> -
> - mutex_lock(&info->property_lock);
> - if (info->state_cache_size < MSM_PROP_STATE_CACHE_SIZE)
> - info->state_cache[(info->state_cache_size)++] = st;
> - else
> - kfree(st);
> - mutex_unlock(&info->property_lock);
> -}
> -
> -void msm_property_reset_state(struct msm_property_info *info, void *state,
> - struct msm_property_state *property_state,
> - struct msm_property_value *property_values)
> -{
> - uint32_t i;
> -
> - if (!info) {
> - DRM_ERROR("invalid property info\n");
> - return;
> - }
> -
> - if (state)
> - memset(state, 0, info->state_size);
> -
> - if (property_state) {
> - property_state->property_count = info->property_count;
> - property_state->values = property_values;
> - INIT_LIST_HEAD(&property_state->dirty_list);
> - }
> -
> - /*
> - * Assign default property values. This helper is mostly used
> - * to initialize newly created state objects.
> - */
> - if (property_values)
> - for (i = 0; i < info->property_count; ++i) {
> - property_values[i].value =
> - info->property_data[i].default_value;
> - property_values[i].blob = NULL;
> - INIT_LIST_HEAD(&property_values[i].dirty_node);
> - }
> -}
> -
> -void msm_property_duplicate_state(struct msm_property_info *info,
> - void *old_state, void *state,
> - struct msm_property_state *property_state,
> - struct msm_property_value *property_values)
> -{
> - uint32_t i;
> -
> - if (!info || !old_state || !state) {
> - DRM_ERROR("invalid argument(s)\n");
> - return;
> - }
> -
> - memcpy(state, old_state, info->state_size);
> -
> - if (!property_state)
> - return;
> -
> - INIT_LIST_HEAD(&property_state->dirty_list);
> - property_state->values = property_values;
> -
> - if (property_state->values)
> - /* add ref count for blobs and initialize dirty nodes */
> - for (i = 0; i < info->property_count; ++i) {
> - if (property_state->values[i].blob)
> - drm_property_blob_get(
> - property_state->values[i].blob);
> - INIT_LIST_HEAD(&property_state->values[i].dirty_node);
> - }
> -}
> -
> -void msm_property_destroy_state(struct msm_property_info *info, void *state,
> - struct msm_property_state *property_state)
> -{
> - uint32_t i;
> -
> - if (!info || !state) {
> - DRM_ERROR("invalid argument(s)\n");
> - return;
> - }
> - if (property_state && property_state->values) {
> - /* remove ref count for blobs */
> - for (i = 0; i < info->property_count; ++i)
> - if (property_state->values[i].blob) {
> - drm_property_blob_put(
> - property_state->values[i].blob);
> - property_state->values[i].blob = NULL;
> - }
> - }
> -
> - _msm_property_free_state(info, state);
> -}
> -
> -void *msm_property_get_blob(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - size_t *byte_len,
> - uint32_t property_idx)
> -{
> - struct drm_property_blob *blob;
> - size_t len = 0;
> - void *rc = 0;
> -
> - if (!info || !property_state || !property_state->values ||
> - (property_idx >= info->blob_count)) {
> - DRM_ERROR("invalid argument(s)\n");
> - } else {
> - blob = property_state->values[property_idx].blob;
> - if (blob) {
> - len = blob->length;
> - rc = &blob->data;
> - }
> - }
> -
> - if (byte_len)
> - *byte_len = len;
> -
> - return rc;
> -}
> -
> -int msm_property_set_blob(struct msm_property_info *info,
> - struct drm_property_blob **blob_reference,
> - void *blob_data,
> - size_t byte_len,
> - uint32_t property_idx)
> -{
> - struct drm_property_blob *blob = NULL;
> - int rc = -EINVAL;
> -
> - if (!info || !blob_reference || (property_idx >= info->blob_count)) {
> - DRM_ERROR("invalid argument(s)\n");
> - } else {
> - /* create blob */
> - if (blob_data && byte_len) {
> - blob = drm_property_create_blob(info->dev,
> - byte_len,
> - blob_data);
> - if (IS_ERR_OR_NULL(blob)) {
> - rc = PTR_ERR(blob);
> - DRM_ERROR("failed to create blob, %d\n", rc);
> - goto exit;
> - }
> - }
> -
> - /* update drm object */
> - rc = drm_object_property_set_value(info->base,
> - info->property_array[property_idx],
> - blob ? blob->base.id : 0);
> - if (rc) {
> - DRM_ERROR("failed to set blob to property\n");
> - if (blob)
> - drm_property_blob_put(blob);
> - goto exit;
> - }
> -
> - /* update local reference */
> - if (*blob_reference)
> - drm_property_blob_put(*blob_reference);
> - *blob_reference = blob;
> - }
> -
> -exit:
> - return rc;
> -}
> -
> -int msm_property_set_property(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - uint32_t property_idx,
> - uint64_t val)
> -{
> - int rc = -EINVAL;
> -
> - if (!info || (property_idx >= info->property_count) ||
> - property_idx < info->blob_count ||
> - !property_state || !property_state->values) {
> - DRM_ERROR("invalid argument(s)\n");
> - } else {
> - struct drm_property *drm_prop;
> -
> - mutex_lock(&info->property_lock);
> -
> - /* update cached value */
> - property_state->values[property_idx].value = val;
> -
> - /* update the new default value for immutables */
> - drm_prop = info->property_array[property_idx];
> - if (drm_prop->flags & DRM_MODE_PROP_IMMUTABLE)
> - info->property_data[property_idx].default_value = val;
> -
> - mutex_unlock(&info->property_lock);
> -
> - /* update drm object */
> - rc = drm_object_property_set_value(info->base, drm_prop, val);
> - if (rc)
> - DRM_ERROR("failed set property value, idx %d rc %d\n",
> - property_idx, rc);
> -
> - }
> -
> - return rc;
> -}
> -
> diff --git a/drivers/gpu/drm/msm/msm_prop.h b/drivers/gpu/drm/msm/msm_prop.h
> deleted file mode 100644
> index 6785955..0000000
> --- a/drivers/gpu/drm/msm/msm_prop.h
> +++ /dev/null
> @@ -1,438 +0,0 @@
> -/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 and
> - * only version 2 as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - */
> -
> -#ifndef _MSM_PROP_H_
> -#define _MSM_PROP_H_
> -
> -#include <linux/list.h>
> -#include "msm_drv.h"
> -
> -#define MSM_PROP_STATE_CACHE_SIZE 2
> -
> -/**
> - * struct msm_property_data - opaque structure for tracking per
> - * drm-object per property stuff
> - * @default_value: Default property value for this drm object
> - * @force_dirty: Always dirty property on incoming sets, rather than checking
> - * for modified values
> - */
> -struct msm_property_data {
> - uint64_t default_value;
> - bool force_dirty;
> -};
> -
> -/**
> - * struct msm_property_value - opaque structure for tracking per
> - * drm-object per property stuff
> - * @value: Current property value for this drm object
> - * @blob: Pointer to associated blob data, if available
> - * @dirty_node: Linked list node to track if property is dirty or not
> - */
> -struct msm_property_value {
> - uint64_t value;
> - struct drm_property_blob *blob;
> - struct list_head dirty_node;
> -};
> -
> -/**
> - * struct msm_property_info: Structure for property/state helper functions
> - * @base: Pointer to base drm object (plane/crtc/etc.)
> - * @dev: Pointer to drm device object
> - * @property_array: Pointer to array for storing created property objects
> - * @property_data: Pointer to array for storing private property data
> - * @property_count: Total number of properties
> - * @blob_count: Total number of blob properties, should be <= count
> - * @install_request: Total number of property 'install' requests
> - * @install_count: Total number of successful 'install' requests
> - * @recent_idx: Index of property most recently accessed by set/get
> - * @is_active: Whether or not drm component properties are 'active'
> - * @state_cache: Cache of local states, to prevent alloc/free thrashing
> - * @state_size: Size of local state structures
> - * @state_cache_size: Number of state structures currently stored in state_cache
> - * @property_lock: Mutex to protect local variables
> - */
> -struct msm_property_info {
> - struct drm_mode_object *base;
> - struct drm_device *dev;
> -
> - struct drm_property **property_array;
> - struct msm_property_data *property_data;
> - uint32_t property_count;
> - uint32_t blob_count;
> - uint32_t install_request;
> - uint32_t install_count;
> -
> - int32_t recent_idx;
> -
> - bool is_active;
> -
> - void *state_cache[MSM_PROP_STATE_CACHE_SIZE];
> - uint32_t state_size;
> - int32_t state_cache_size;
> - struct mutex property_lock;
> -};
> -
> -/**
> - * struct msm_property_state - Structure for local property state information
> - * @property_count: Total number of properties
> - * @values: Pointer to array of msm_property_value objects
> - * @dirty_list: List of all properties that have been 'atomic_set' but not
> - * yet cleared with 'msm_property_pop_dirty'
> - */
> -struct msm_property_state {
> - uint32_t property_count;
> - struct msm_property_value *values;
> - struct list_head dirty_list;
> -};
> -
> -/**
> - * msm_property_index_to_drm_property - get drm property struct from prop index
> - * @info: Pointer to property info container struct
> - * @property_idx: Property index
> - * Returns: drm_property pointer associated with property index
> - */
> -static inline
> -struct drm_property *msm_property_index_to_drm_property(
> - struct msm_property_info *info, uint32_t property_idx)
> -{
> - if (!info || property_idx >= info->property_count)
> - return NULL;
> -
> - return info->property_array[property_idx];
> -}
> -
> -/**
> - * msm_property_get_default - query default value of a property
> - * @info: Pointer to property info container struct
> - * @property_idx: Property index
> - * Returns: Default value for specified property
> - */
> -static inline
> -uint64_t msm_property_get_default(struct msm_property_info *info,
> - uint32_t property_idx)
> -{
> - uint64_t rc = 0;
> -
> - if (!info)
> - return 0;
> -
> - mutex_lock(&info->property_lock);
> - if (property_idx < info->property_count)
> - rc = info->property_data[property_idx].default_value;
> - mutex_unlock(&info->property_lock);
> -
> - return rc;
> -}
> -
> -/**
> - * msm_property_set_is_active - set overall 'active' status for all properties
> - * @info: Pointer to property info container struct
> - * @is_active: New 'is active' status
> - */
> -static inline
> -void msm_property_set_is_active(struct msm_property_info *info, bool is_active)
> -{
> - if (info) {
> - mutex_lock(&info->property_lock);
> - info->is_active = is_active;
> - mutex_unlock(&info->property_lock);
> - }
> -}
> -
> -/**
> - * msm_property_get_is_active - query property 'is active' status
> - * @info: Pointer to property info container struct
> - * Returns: Current 'is active's status
> - */
> -static inline
> -bool msm_property_get_is_active(struct msm_property_info *info)
> -{
> - bool rc = false;
> -
> - if (info) {
> - mutex_lock(&info->property_lock);
> - rc = info->is_active;
> - mutex_unlock(&info->property_lock);
> - }
> -
> - return rc;
> -}
> -
> -/**
> - * msm_property_pop_dirty - determine next dirty property and clear
> - * its dirty flag
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to property state container struct
> - * Returns: Valid msm property index on success,
> - * -EAGAIN if no dirty properties are available
> - * Property indicies returned from this function are similar
> - * to those returned by the msm_property_index function.
> - */
> -int msm_property_pop_dirty(struct msm_property_info *info,
> - struct msm_property_state *property_state);
> -
> -/**
> - * msm_property_init - initialize property info structure
> - * @info: Pointer to property info container struct
> - * @base: Pointer to base drm object (plane/crtc/etc.)
> - * @dev: Pointer to drm device object
> - * @property_array: Pointer to array for storing created property objects
> - * @property_data: Pointer to array for storing private property data
> - * @property_count: Total number of properties
> - * @blob_count: Total number of blob properties, should be <= count
> - * @state_size: Size of local state object
> - */
> -void msm_property_init(struct msm_property_info *info,
> - struct drm_mode_object *base,
> - struct drm_device *dev,
> - struct drm_property **property_array,
> - struct msm_property_data *property_data,
> - uint32_t property_count,
> - uint32_t blob_count,
> - uint32_t state_size);
> -
> -/**
> - * msm_property_destroy - destroy helper info structure
> - *
> - * @info: Pointer to property info container struct
> - */
> -void msm_property_destroy(struct msm_property_info *info);
> -
> -/**
> - * msm_property_install_range - install standard drm range property
> - * @info: Pointer to property info container struct
> - * @name: Property name
> - * @flags: Other property type flags, e.g. DRM_MODE_PROP_IMMUTABLE
> - * @min: Min property value
> - * @max: Max property value
> - * @init: Default Property value
> - * @property_idx: Property index
> - */
> -void msm_property_install_range(struct msm_property_info *info,
> - const char *name,
> - int flags,
> - uint64_t min,
> - uint64_t max,
> - uint64_t init,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_install_volatile_range - install drm range property
> - * This function is similar to msm_property_install_range, but assumes
> - * that the property is meant for holding user pointers or descriptors
> - * that may reference volatile data without having an updated value.
> - * @info: Pointer to property info container struct
> - * @name: Property name
> - * @flags: Other property type flags, e.g. DRM_MODE_PROP_IMMUTABLE
> - * @min: Min property value
> - * @max: Max property value
> - * @init: Default Property value
> - * @property_idx: Property index
> - */
> -void msm_property_install_volatile_range(struct msm_property_info *info,
> - const char *name,
> - int flags,
> - uint64_t min,
> - uint64_t max,
> - uint64_t init,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_install_rotation - install standard drm rotation property
> - * @info: Pointer to property info container struct
> - * @plane: Pointer to drm_plane which this property is installed on
> - * @rotation: The default value for this new property
> - * @supported_rotations: Bitmask of supported rotation values (see
> - * drm_plane_create_rotation_property for more details)
> - * @property_idx: Property index
> - */
> -void msm_property_install_rotation(struct msm_property_info *info,
> - struct drm_plane *plane,
> - unsigned int rotation,
> - unsigned int supported_rotations,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_install_enum - install standard drm enum/bitmask property
> - * @info: Pointer to property info container struct
> - * @name: Property name
> - * @flags: Other property type flags, e.g. DRM_MODE_PROP_IMMUTABLE
> - * @is_bitmask: Set to non-zero to create a bitmask property, rather than an
> - * enumeration one
> - * @values: Array of allowable enumeration/bitmask values
> - * @num_values: Size of values array
> - * @property_idx: Property index
> - */
> -void msm_property_install_enum(struct msm_property_info *info,
> - const char *name,
> - int flags,
> - int is_bitmask,
> - const struct drm_prop_enum_list *values,
> - int num_values,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_install_blob - install standard drm blob property
> - * @info: Pointer to property info container struct
> - * @name: Property name
> - * @flags: Extra flags for property creation
> - * @property_idx: Property index
> - */
> -void msm_property_install_blob(struct msm_property_info *info,
> - const char *name,
> - int flags,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_install_get_status - query overal status of property additions
> - * @info: Pointer to property info container struct
> - * Returns: Zero if previous property install calls were all successful
> - */
> -int msm_property_install_get_status(struct msm_property_info *info);
> -
> -/**
> - * msm_property_index - determine property index from drm_property ptr
> - * @info: Pointer to property info container struct
> - * @property: Incoming property pointer
> - * Returns: Valid property index, or -EINVAL on error
> - */
> -int msm_property_index(struct msm_property_info *info,
> - struct drm_property *property);
> -
> -/**
> - * msm_property_set_dirty - forcibly flag a property as dirty
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to property state container struct
> - * @property_idx: Property index
> - * Returns: Zero on success
> - */
> -int msm_property_set_dirty(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - int property_idx);
> -
> -/**
> - * msm_property_atomic_set - helper function for atomic property set callback
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to local state structure
> - * @property: Incoming property pointer
> - * @val: Incoming property value
> - * Returns: Zero on success
> - */
> -int msm_property_atomic_set(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - struct drm_property *property,
> - uint64_t val);
> -
> -/**
> - * msm_property_atomic_get - helper function for atomic property get callback
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to local state structure
> - * @property: Incoming property pointer
> - * @val: Pointer to variable for receiving property value
> - * Returns: Zero on success
> - */
> -int msm_property_atomic_get(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - struct drm_property *property,
> - uint64_t *val);
> -
> -/**
> - * msm_property_alloc_state - helper function for allocating local state objects
> - * @info: Pointer to property info container struct
> - */
> -void *msm_property_alloc_state(struct msm_property_info *info);
> -
> -/**
> - * msm_property_reset_state - helper function for state reset callback
> - * @info: Pointer to property info container struct
> - * @state: Pointer to local state structure
> - * @property_state: Pointer to property state container struct
> - * @property_values: Pointer to property values cache array
> - */
> -void msm_property_reset_state(struct msm_property_info *info, void *state,
> - struct msm_property_state *property_state,
> - struct msm_property_value *property_values);
> -
> -/**
> - * msm_property_duplicate_state - helper function for duplicate state cb
> - * @info: Pointer to property info container struct
> - * @old_state: Pointer to original state structure
> - * @state: Pointer to newly created state structure
> - * @property_state: Pointer to destination property state container struct
> - * @property_values: Pointer to property values cache array
> - */
> -void msm_property_duplicate_state(struct msm_property_info *info,
> - void *old_state,
> - void *state,
> - struct msm_property_state *property_state,
> - struct msm_property_value *property_values);
> -
> -/**
> - * msm_property_destroy_state - helper function for destroy state cb
> - * @info: Pointer to property info container struct
> - * @state: Pointer to local state structure
> - * @property_state: Pointer to property state container struct
> - */
> -void msm_property_destroy_state(struct msm_property_info *info,
> - void *state,
> - struct msm_property_state *property_state);
> -
> -/**
> - * msm_property_get_blob - obtain cached data pointer for drm blob property
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to property state container struct
> - * @byte_len: Optional pointer to variable for accepting blob size
> - * @property_idx: Property index
> - * Returns: Pointer to blob data
> - */
> -void *msm_property_get_blob(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - size_t *byte_len,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_set_blob - update blob property on a drm object
> - * This function updates the blob property value of the given drm object. Its
> - * intended use is to update blob properties that have been created with the
> - * DRM_MODE_PROP_IMMUTABLE flag set.
> - * @info: Pointer to property info container struct
> - * @blob_reference: Reference to a pointer that holds the created data blob
> - * @blob_data: Pointer to blob data
> - * @byte_len: Length of blob data, in bytes
> - * @property_idx: Property index
> - * Returns: Zero on success
> - */
> -int msm_property_set_blob(struct msm_property_info *info,
> - struct drm_property_blob **blob_reference,
> - void *blob_data,
> - size_t byte_len,
> - uint32_t property_idx);
> -
> -/**
> - * msm_property_set_property - update property on a drm object
> - * This function updates the property value of the given drm object. Its
> - * intended use is to update properties that have been created with the
> - * DRM_MODE_PROP_IMMUTABLE flag set.
> - * Note: This function cannot be called on a blob.
> - * @info: Pointer to property info container struct
> - * @property_state: Pointer to property state container struct
> - * @property_idx: Property index
> - * @val: value of the property to set
> - * Returns: Zero on success
> - */
> -int msm_property_set_property(struct msm_property_info *info,
> - struct msm_property_state *property_state,
> - uint32_t property_idx,
> - uint64_t val);
> -
> -#endif /* _MSM_PROP_H_ */
> -
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the Freedreno
mailing list