linux/drivers/gpu/drm/loongson/lsdc_plane.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2023 Loongson Technology Corporation Limited
 */

#include <linux/delay.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>

#include "lsdc_drv.h"
#include "lsdc_regs.h"
#include "lsdc_ttm.h"

static const u32 lsdc_primary_formats[] =;

static const u32 lsdc_cursor_formats[] =;

static const u64 lsdc_fb_format_modifiers[] =;

static unsigned int lsdc_get_fb_offset(struct drm_framebuffer *fb,
				       struct drm_plane_state *state)
{}

static u64 lsdc_fb_base_addr(struct drm_framebuffer *fb)
{}

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

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

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

static int lsdc_plane_prepare_fb(struct drm_plane *plane,
				 struct drm_plane_state *new_state)
{}

static void lsdc_plane_cleanup_fb(struct drm_plane *plane,
				  struct drm_plane_state *old_state)
{}

static const struct drm_plane_helper_funcs lsdc_primary_helper_funcs =;

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

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

/* ls7a1000 cursor plane helpers */

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

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

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

static const struct drm_plane_helper_funcs ls7a1000_cursor_plane_helper_funcs =;

/* ls7a2000 cursor plane helpers */

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

/* Update the format, size and location of the cursor */

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

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

static const struct drm_plane_helper_funcs ls7a2000_cursor_plane_helper_funcs =;

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

static const struct drm_plane_funcs lsdc_plane_funcs =;

/* Primary plane 0 hardware related ops  */

static void lsdc_primary0_update_fb_addr(struct lsdc_primary *primary, u64 addr)
{}

static void lsdc_primary0_update_fb_stride(struct lsdc_primary *primary, u32 stride)
{}

static void lsdc_primary0_update_fb_format(struct lsdc_primary *primary,
					   const struct drm_format_info *format)
{}

/* Primary plane 1 hardware related ops */

static void lsdc_primary1_update_fb_addr(struct lsdc_primary *primary, u64 addr)
{}

static void lsdc_primary1_update_fb_stride(struct lsdc_primary *primary, u32 stride)
{}

static void lsdc_primary1_update_fb_format(struct lsdc_primary *primary,
					   const struct drm_format_info *format)
{}

static const struct lsdc_primary_plane_ops lsdc_primary_plane_hw_ops[2] =;

/*
 * Update location, format, enable and disable state of the cursor,
 * For those who have two hardware cursor, let cursor 0 is attach to CRTC-0,
 * cursor 1 is attach to CRTC-1. Compositing the primary plane and cursor
 * plane is automatically done by hardware, the cursor is alway on the top of
 * the primary plane. In other word, z-order is fixed in hardware and cannot
 * be changed. For those old DC who has only one hardware cursor, we made it
 * shared by the two screen, this works on extend screen mode.
 */

/* cursor plane 0 (for pipe 0) related hardware ops */

static void lsdc_cursor0_update_bo_addr(struct lsdc_cursor *cursor, u64 addr)
{}

static void lsdc_cursor0_update_position(struct lsdc_cursor *cursor, int x, int y)
{}

static void lsdc_cursor0_update_cfg(struct lsdc_cursor *cursor,
				    enum lsdc_cursor_size cursor_size,
				    enum lsdc_cursor_format fmt)
{}

/* cursor plane 1 (for pipe 1) related hardware ops */

static void lsdc_cursor1_update_bo_addr(struct lsdc_cursor *cursor, u64 addr)
{}

static void lsdc_cursor1_update_position(struct lsdc_cursor *cursor, int x, int y)
{}

static void lsdc_cursor1_update_cfg(struct lsdc_cursor *cursor,
				    enum lsdc_cursor_size cursor_size,
				    enum lsdc_cursor_format fmt)
{}

/* The hardware cursors become normal since ls7a2000/ls2k2000 */

static const struct lsdc_cursor_plane_ops ls7a2000_cursor_hw_ops[2] =;

/* Quirks for cursor 1, only for old loongson display controller */

static void lsdc_cursor1_update_bo_addr_quirk(struct lsdc_cursor *cursor, u64 addr)
{}

static void lsdc_cursor1_update_position_quirk(struct lsdc_cursor *cursor, int x, int y)
{}

static void lsdc_cursor1_update_cfg_quirk(struct lsdc_cursor *cursor,
					  enum lsdc_cursor_size cursor_size,
					  enum lsdc_cursor_format fmt)
{}

/*
 * The unforgiving LS7A1000/LS2K1000 has only one hardware cursors plane
 */
static const struct lsdc_cursor_plane_ops ls7a1000_cursor_hw_ops[2] =;

int lsdc_primary_plane_init(struct drm_device *ddev,
			    struct drm_plane *plane,
			    unsigned int index)
{}

int ls7a1000_cursor_plane_init(struct drm_device *ddev,
			       struct drm_plane *plane,
			       unsigned int index)
{}

int ls7a2000_cursor_plane_init(struct drm_device *ddev,
			       struct drm_plane *plane,
			       unsigned int index)
{}