linux/drivers/gpu/drm/arm/malidp_planes.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
 * Author: Liviu Dudau <[email protected]>
 *
 * ARM Mali DP plane manipulation routines.
 */

#include <linux/iommu.h>
#include <linux/platform_device.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_blend.h>
#include <drm/drm_drv.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_print.h>

#include "malidp_hw.h"
#include "malidp_drv.h"

/* Layer specific register offsets */
#define MALIDP_LAYER_FORMAT
#define LAYER_FORMAT_MASK
#define MALIDP_LAYER_CONTROL
#define LAYER_ENABLE
#define LAYER_FLOWCFG_MASK
#define LAYER_FLOWCFG(x)
#define LAYER_FLOWCFG_SCALE_SE
#define LAYER_ROT_OFFSET
#define LAYER_H_FLIP
#define LAYER_V_FLIP
#define LAYER_ROT_MASK
#define LAYER_COMP_MASK
#define LAYER_COMP_PIXEL
#define LAYER_COMP_PLANE
#define LAYER_PMUL_ENABLE
#define LAYER_ALPHA_OFFSET
#define LAYER_ALPHA_MASK
#define LAYER_ALPHA(x)
#define MALIDP_LAYER_COMPOSE
#define MALIDP_LAYER_SIZE
#define LAYER_H_VAL(x)
#define LAYER_V_VAL(x)
#define MALIDP_LAYER_COMP_SIZE
#define MALIDP_LAYER_OFFSET
#define MALIDP550_LS_ENABLE
#define MALIDP550_LS_R1_IN_SIZE

#define MODIFIERS_COUNT_MAX

/*
 * This 4-entry look-up-table is used to determine the full 8-bit alpha value
 * for formats with 1- or 2-bit alpha channels.
 * We set it to give 100%/0% opacity for 1-bit formats and 100%/66%/33%/0%
 * opacity for 2-bit formats.
 */
#define MALIDP_ALPHA_LUT

/* page sizes the MMU prefetcher can support */
#define MALIDP_MMU_PREFETCH_PARTIAL_PGSIZES
#define MALIDP_MMU_PREFETCH_FULL_PGSIZES

/* readahead for partial-frame prefetch */
#define MALIDP_MMU_PREFETCH_READAHEAD

/*
 * Replicate what the default ->reset hook does: free the state pointer and
 * allocate a new empty object. We just need enough space to store
 * a malidp_plane_state instead of a drm_plane_state.
 */
static void malidp_plane_reset(struct drm_plane *plane)
{}

static struct
drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane)
{}

static void malidp_destroy_plane_state(struct drm_plane *plane,
				       struct drm_plane_state *state)
{}

static const char * const prefetch_mode_names[] =;

static void malidp_plane_atomic_print_state(struct drm_printer *p,
					    const struct drm_plane_state *state)
{}

bool malidp_format_mod_supported(struct drm_device *drm,
				 u32 format, u64 modifier)
{}

static bool malidp_format_mod_supported_per_plane(struct drm_plane *plane,
						  u32 format, u64 modifier)
{}

static const struct drm_plane_funcs malidp_de_plane_funcs =;

static int malidp_se_check_scaling(struct malidp_plane *mp,
				   struct drm_plane_state *state)
{}

static u32 malidp_get_pgsize_bitmap(struct malidp_plane *mp)
{}

/*
 * Check if the framebuffer is entirely made up of pages at least pgsize in
 * size. Only a heuristic: assumes that each scatterlist entry has been aligned
 * to the largest page size smaller than its length and that the MMU maps to
 * the largest page size possible.
 */
static bool malidp_check_pages_threshold(struct malidp_plane_state *ms,
					 u32 pgsize)
{}

/*
 * Check if it is possible to enable partial-frame MMU prefetch given the
 * current format, AFBC state and rotation.
 */
static bool malidp_partial_prefetch_supported(u32 format, u64 modifier,
					      unsigned int rotation)
{}

/*
 * Select the preferred MMU prefetch mode. Full-frame prefetch is preferred as
 * long as the framebuffer is all large pages. Otherwise partial-frame prefetch
 * is selected as long as it is supported for the current format. The selected
 * page size for prefetch is returned in pgsize_bitmap.
 */
static enum mmu_prefetch_mode malidp_mmu_prefetch_select_mode
		(struct malidp_plane_state *ms,	u32 *pgsize_bitmap)
{}

static u32 malidp_calc_mmu_control_value(enum mmu_prefetch_mode mode,
					 u8 readahead, u8 n_planes, u32 pgsize)
{}

static void malidp_de_prefetch_settings(struct malidp_plane *mp,
					struct malidp_plane_state *ms)
{}

static int malidp_de_plane_check(struct drm_plane *plane,
				 struct drm_atomic_state *state)
{}

static void malidp_de_set_plane_pitches(struct malidp_plane *mp,
					int num_planes, unsigned int pitches[3])
{}

static const s16
malidp_yuv2rgb_coeffs[][DRM_COLOR_RANGE_MAX][MALIDP_COLORADJ_NUM_COEFFS] =;

static void malidp_de_set_color_encoding(struct malidp_plane *plane,
					 enum drm_color_encoding enc,
					 enum drm_color_range range)
{}

static void malidp_de_set_mmu_control(struct malidp_plane *mp,
				      struct malidp_plane_state *ms)
{}

static void malidp_set_plane_base_addr(struct drm_framebuffer *fb,
				       struct malidp_plane *mp,
				       int plane_index)
{}

static void malidp_de_set_plane_afbc(struct drm_plane *plane)
{}

static void malidp_de_plane_update(struct drm_plane *plane,
				   struct drm_atomic_state *state)
{}

static void malidp_de_plane_disable(struct drm_plane *plane,
				    struct drm_atomic_state *state)
{}

static const struct drm_plane_helper_funcs malidp_de_plane_helper_funcs =;

static const uint64_t linear_only_modifiers[] =;

int malidp_de_planes_init(struct drm_device *drm)
{}