linux/drivers/gpu/drm/exynos/exynos_drm_g2d.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2012 Samsung Electronics Co.Ltd
 * Authors: Joonyoung Shim <[email protected]>
 */

#include <linux/refcount.h>
#include <linux/clk.h>
#include <linux/component.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/workqueue.h>

#include <drm/drm_file.h>
#include <drm/exynos_drm.h>

#include "exynos_drm_drv.h"
#include "exynos_drm_g2d.h"
#include "exynos_drm_gem.h"

#define G2D_HW_MAJOR_VER
#define G2D_HW_MINOR_VER

/* vaild register range set from user: 0x0104 ~ 0x0880 */
#define G2D_VALID_START
#define G2D_VALID_END

/* general registers */
#define G2D_SOFT_RESET
#define G2D_INTEN
#define G2D_INTC_PEND
#define G2D_DMA_SFR_BASE_ADDR
#define G2D_DMA_COMMAND
#define G2D_DMA_STATUS
#define G2D_DMA_HOLD_CMD

/* command registers */
#define G2D_BITBLT_START

/* registers for base address */
#define G2D_SRC_BASE_ADDR
#define G2D_SRC_STRIDE
#define G2D_SRC_COLOR_MODE
#define G2D_SRC_LEFT_TOP
#define G2D_SRC_RIGHT_BOTTOM
#define G2D_SRC_PLANE2_BASE_ADDR
#define G2D_DST_BASE_ADDR
#define G2D_DST_STRIDE
#define G2D_DST_COLOR_MODE
#define G2D_DST_LEFT_TOP
#define G2D_DST_RIGHT_BOTTOM
#define G2D_DST_PLANE2_BASE_ADDR
#define G2D_PAT_BASE_ADDR
#define G2D_MSK_BASE_ADDR

/* G2D_SOFT_RESET */
#define G2D_SFRCLEAR
#define G2D_R

/* G2D_INTEN */
#define G2D_INTEN_ACF
#define G2D_INTEN_UCF
#define G2D_INTEN_GCF
#define G2D_INTEN_SCF

/* G2D_INTC_PEND */
#define G2D_INTP_ACMD_FIN
#define G2D_INTP_UCMD_FIN
#define G2D_INTP_GCMD_FIN
#define G2D_INTP_SCMD_FIN

/* G2D_DMA_COMMAND */
#define G2D_DMA_HALT
#define G2D_DMA_CONTINUE
#define G2D_DMA_START

/* G2D_DMA_STATUS */
#define G2D_DMA_LIST_DONE_COUNT
#define G2D_DMA_BITBLT_DONE_COUNT
#define G2D_DMA_DONE
#define G2D_DMA_LIST_DONE_COUNT_OFFSET

/* G2D_DMA_HOLD_CMD */
#define G2D_USER_HOLD
#define G2D_LIST_HOLD
#define G2D_BITBLT_HOLD

/* G2D_BITBLT_START */
#define G2D_START_CASESEL
#define G2D_START_NHOLT
#define G2D_START_BITBLT

/* buffer color format */
#define G2D_FMT_XRGB8888
#define G2D_FMT_ARGB8888
#define G2D_FMT_RGB565
#define G2D_FMT_XRGB1555
#define G2D_FMT_ARGB1555
#define G2D_FMT_XRGB4444
#define G2D_FMT_ARGB4444
#define G2D_FMT_PACKED_RGB888
#define G2D_FMT_A8
#define G2D_FMT_L8

/* buffer valid length */
#define G2D_LEN_MIN
#define G2D_LEN_MAX

#define G2D_CMDLIST_SIZE
#define G2D_CMDLIST_NUM
#define G2D_CMDLIST_POOL_SIZE
#define G2D_CMDLIST_DATA_NUM

/* maximum buffer pool size of userptr is 64MB as default */
#define MAX_POOL

enum {};

enum g2d_reg_type {};

enum g2d_flag_bits {};

/* cmdlist data structure */
struct g2d_cmdlist {};

/*
 * A structure of buffer description
 *
 * @format: color format
 * @stride: buffer stride/pitch in bytes
 * @left_x: the x coordinates of left top corner
 * @top_y: the y coordinates of left top corner
 * @right_x: the x coordinates of right bottom corner
 * @bottom_y: the y coordinates of right bottom corner
 *
 */
struct g2d_buf_desc {};

/*
 * A structure of buffer information
 *
 * @map_nr: manages the number of mapped buffers
 * @reg_types: stores regitster type in the order of requested command
 * @handles: stores buffer handle in its reg_type position
 * @types: stores buffer type in its reg_type position
 * @descs: stores buffer description in its reg_type position
 *
 */
struct g2d_buf_info {};

struct drm_exynos_pending_g2d_event {};

struct g2d_cmdlist_userptr {};
struct g2d_cmdlist_node {};

struct g2d_runqueue_node {};

struct g2d_data {};

static inline void g2d_hw_reset(struct g2d_data *g2d)
{}

static int g2d_init_cmdlist(struct g2d_data *g2d)
{}

static void g2d_fini_cmdlist(struct g2d_data *g2d)
{}

static struct g2d_cmdlist_node *g2d_get_cmdlist(struct g2d_data *g2d)
{}

static void g2d_put_cmdlist(struct g2d_data *g2d, struct g2d_cmdlist_node *node)
{}

static void g2d_add_cmdlist_to_inuse(struct drm_exynos_file_private *file_priv,
				     struct g2d_cmdlist_node *node)
{}

static void g2d_userptr_put_dma_addr(struct g2d_data *g2d,
					void *obj,
					bool force)
{}

static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
					unsigned long userptr,
					unsigned long size,
					struct drm_file *filp,
					void **obj)
{}

static void g2d_userptr_free_all(struct g2d_data *g2d, struct drm_file *filp)
{}

static enum g2d_reg_type g2d_get_reg_type(struct g2d_data *g2d, int reg_offset)
{}

static unsigned long g2d_get_buf_bpp(unsigned int format)
{}

static bool g2d_check_buf_desc_is_valid(struct g2d_data *g2d,
					struct g2d_buf_desc *buf_desc,
					enum g2d_reg_type reg_type,
					unsigned long size)
{}

static int g2d_map_cmdlist_gem(struct g2d_data *g2d,
				struct g2d_cmdlist_node *node,
				struct drm_device *drm_dev,
				struct drm_file *file)
{}

static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d,
				  struct g2d_cmdlist_node *node,
				  struct drm_file *filp)
{}

static void g2d_dma_start(struct g2d_data *g2d,
			  struct g2d_runqueue_node *runqueue_node)
{}

static struct g2d_runqueue_node *g2d_get_runqueue_node(struct g2d_data *g2d)
{}

static void g2d_free_runqueue_node(struct g2d_data *g2d,
				   struct g2d_runqueue_node *runqueue_node)
{}

/**
 * g2d_remove_runqueue_nodes - remove items from the list of runqueue nodes
 * @g2d: G2D state object
 * @file: if not zero, only remove items with this DRM file
 *
 * Has to be called under runqueue lock.
 */
static void g2d_remove_runqueue_nodes(struct g2d_data *g2d, struct drm_file *file)
{}

static void g2d_runqueue_worker(struct work_struct *work)
{}

static void g2d_finish_event(struct g2d_data *g2d, u32 cmdlist_no)
{}

static irqreturn_t g2d_irq_handler(int irq, void *dev_id)
{}

/**
 * g2d_wait_finish - wait for the G2D engine to finish the current runqueue node
 * @g2d: G2D state object
 * @file: if not zero, only wait if the current runqueue node belongs
 *        to the DRM file
 *
 * Should the engine not become idle after a 100ms timeout, a hardware
 * reset is issued.
 */
static void g2d_wait_finish(struct g2d_data *g2d, struct drm_file *file)
{}

static int g2d_check_reg_offset(struct g2d_data *g2d,
				struct g2d_cmdlist_node *node,
				int nr, bool for_addr)
{}

/* ioctl functions */
int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, void *data,
			     struct drm_file *file)
{}

int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
				 struct drm_file *file)
{}

int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
			  struct drm_file *file)
{}

int g2d_open(struct drm_device *drm_dev, struct drm_file *file)
{}

void g2d_close(struct drm_device *drm_dev, struct drm_file *file)
{}

static int g2d_bind(struct device *dev, struct device *master, void *data)
{}

static void g2d_unbind(struct device *dev, struct device *master, void *data)
{}

static const struct component_ops g2d_component_ops =;

static int g2d_probe(struct platform_device *pdev)
{}

static void g2d_remove(struct platform_device *pdev)
{}

static int g2d_suspend(struct device *dev)
{}

static int g2d_resume(struct device *dev)
{}

static int g2d_runtime_suspend(struct device *dev)
{}

static int g2d_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops g2d_pm_ops =;

static const struct of_device_id exynos_g2d_match[] =;
MODULE_DEVICE_TABLE(of, exynos_g2d_match);

struct platform_driver g2d_driver =;