Skip to content
Permalink
Browse files
more porting
  • Loading branch information
frank-w committed Oct 14, 2021
1 parent 0c57476 commit 14a93e4b341569bdb9f0456c3934e62402a82174
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 10 deletions.
@@ -98,6 +98,9 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
{ DRM_MODE_CONNECTOR_USB, "USB" },
};

DRM_ENUM_NAME_FN(drm_get_connector_name, drm_connector_enum_list)
EXPORT_SYMBOL(drm_get_connector_name);

void drm_connector_ida_init(void)
{
int i;
@@ -349,6 +349,22 @@ drm_get_format_info(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_get_format_info);

/**
* drm_format_num_planes - get the number of planes for format
* @format: pixel format (DRM_FORMAT_*)
*
* Returns:
* The number of planes used by the specified pixel format.
*/
int drm_format_num_planes(uint32_t format)
{
const struct drm_format_info *info;

info = drm_format_info(format);
return info ? info->num_planes : 1;
}
EXPORT_SYMBOL(drm_format_num_planes);

/**
* drm_format_info_block_width - width in pixels of block.
* @info: pixel format info
@@ -25,6 +25,46 @@ struct drm_device;
struct drm_connector;
struct iommu_domain;

/*
* Rockchip drm private crtc funcs.
* @loader_protect: protect loader logo crtc's power
* @enable_vblank: enable crtc vblank irq.
* @disable_vblank: disable crtc vblank irq.
* @bandwidth: report present crtc bandwidth consume.
*/
struct rockchip_crtc_funcs {
int (*loader_protect)(struct drm_crtc *crtc, bool on);
int (*enable_vblank)(struct drm_crtc *crtc);
void (*disable_vblank)(struct drm_crtc *crtc);
size_t (*bandwidth)(struct drm_crtc *crtc,
struct drm_crtc_state *crtc_state,
unsigned int *plane_num_total);
void (*cancel_pending_vblank)(struct drm_crtc *crtc,
struct drm_file *file_priv);
int (*debugfs_init)(struct drm_minor *minor, struct drm_crtc *crtc);
int (*debugfs_dump)(struct drm_crtc *crtc, struct seq_file *s);
void (*regs_dump)(struct drm_crtc *crtc, struct seq_file *s);
enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
int output_type);
void (*crtc_close)(struct drm_crtc *crtc);
void (*crtc_send_mcu_cmd)(struct drm_crtc *crtc, u32 type, u32 value);
};

#define VOP_OUTPUT_IF_RGB BIT(0)
#define VOP_OUTPUT_IF_BT1120 BIT(1)
#define VOP_OUTPUT_IF_BT656 BIT(2)
#define VOP_OUTPUT_IF_LVDS0 BIT(3)
#define VOP_OUTPUT_IF_LVDS1 BIT(4)
#define VOP_OUTPUT_IF_MIPI0 BIT(5)
#define VOP_OUTPUT_IF_MIPI1 BIT(6)
#define VOP_OUTPUT_IF_eDP0 BIT(7)
#define VOP_OUTPUT_IF_eDP1 BIT(8)
#define VOP_OUTPUT_IF_DP0 BIT(9)
#define VOP_OUTPUT_IF_DP1 BIT(10)
#define VOP_OUTPUT_IF_HDMI0 BIT(11)
#define VOP_OUTPUT_IF_HDMI1 BIT(12)

struct rockchip_crtc_state {
struct drm_crtc_state base;
struct drm_tv_connector_state *tv_state;
@@ -61,6 +101,10 @@ struct rockchip_crtc_state {
* @mm_lock: protect drm_mm on multi-threads.
*/
struct rockchip_drm_private {
struct drm_property *eotf_prop;
struct drm_property *color_space_prop;
struct drm_property *async_commit_prop;
struct drm_property *share_id_prop;
struct drm_fb_helper fbdev_helper;
struct drm_gem_object *fbdev_bo;
struct iommu_domain *domain;
@@ -15,6 +15,10 @@
#define VOP_MAJOR(version) ((version) >> 8)
#define VOP_MINOR(version) ((version) & 0xff)

#define ROCKCHIP_OUTPUT_DUAL_CHANNEL_LEFT_RIGHT_MODE BIT(0)
#define ROCKCHIP_OUTPUT_DUAL_CHANNEL_ODD_EVEN_MODE BIT(1)
#define ROCKCHIP_OUTPUT_DATA_SWAP BIT(2)

#define AFBDC_FMT_RGB565 0x0
#define AFBDC_FMT_U8U8U8U8 0x5
#define AFBDC_FMT_U8U8U8 0x4
@@ -37,6 +41,11 @@ enum win_dly_mode {
VOP2_DLY_MODE_MAX,
};

#define DSP_BG_SWAP 0x1
#define DSP_RB_SWAP 0x2
#define DSP_RG_SWAP 0x4
#define DSP_DELTA_SWAP 0x8

/* AFBC supports a number of configurable modes. Relevant to us is block size
* (16x16 or 32x8), storage modifiers (SPARSE, SPLIT), and the YUV-like
* colourspace transform (YTR). 16x16 SPARSE mode is always used. SPLIT mode
@@ -13,6 +13,8 @@
#include <drm/drm_atomic_uapi.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_writeback.h>
#include <drm/drm_connector.h>
#include <drm/drm_debugfs.h>
#ifdef CONFIG_DRM_ANALOGIX_DP
#include <drm/bridge/analogix_dp.h>
#endif
@@ -2706,7 +2708,7 @@ rockchip_atomic_helper_disable_plane(struct drm_plane *plane,
vpstate->async_commit)
pstate->state->legacy_cursor_update = true;

ret = drm_atomic_helper_disable_plane(plane, pstate);
ret = drm_atomic_helper_disable_plane(plane, ctx);
if (ret != 0)
goto fail;

@@ -2727,7 +2729,7 @@ static void vop2_atomic_plane_reset(struct drm_plane *plane)
struct vop2_win *win = to_vop2_win(plane);

if (plane->state && plane->state->fb)
drm_atomic_helper_plane_destroy_state(plane->state);
drm_atomic_helper_plane_destroy_state(plane,plane->state);
kfree(vpstate);
vpstate = kzalloc(sizeof(*vpstate), GFP_KERNEL);
if (!vpstate)
@@ -3117,19 +3119,21 @@ static int vop2_crtc_debugfs_init(struct drm_minor *minor, struct drm_crtc *crtc
for (i = 0; i < ARRAY_SIZE(vop2_debugfs_files); i++)
vop2->debugfs_files[i].data = vop2;

ret = drm_debugfs_create_files(vop2->debugfs_files,
//drm_debugfs_create_files returns void
//ret =
drm_debugfs_create_files(vop2->debugfs_files,
ARRAY_SIZE(vop2_debugfs_files),
vop2->debugfs,
minor);
if (ret) {
/*if (ret) {
dev_err(vop2->dev, "could not install rockchip_debugfs_list\n");
goto free;
}
}*/

return 0;
free:
/*free:
kfree(vop2->debugfs_files);
vop2->debugfs_files = NULL;
vop2->debugfs_files = NULL;*/
remove:
debugfs_remove(vop2->debugfs);
vop2->debugfs = NULL;
@@ -3198,7 +3202,7 @@ static size_t vop2_plane_line_bandwidth(struct drm_plane_state *pstate)
dst_height <= 0)
return 0;

bandwidth = src_width * cpp;
bandwidth = src_width * bpp;

bandwidth = bandwidth * src_width / dst_width;
bandwidth = bandwidth * src_height / dst_height;
@@ -3511,7 +3515,7 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state
vop2_lock(vop2);
DRM_DEV_INFO(vop2->dev, "Update mode to %dx%d%s%d, type: %d for vp%d\n",
hdisplay, vdisplay, interlaced ? "i" : "p",
adjusted_mode->vrefresh, vcstate->output_type, vp->id);
drm_mode_vrefresh(adjusted_mode), vcstate->output_type, vp->id);
vop2_initial(crtc);
VOP_MODULE_SET(vop2, vp, standby, 0);
vcstate->vdisplay = vdisplay;
@@ -1650,7 +1650,6 @@ drm_connector_is_unregistered(struct drm_connector *connector)
DRM_CONNECTOR_UNREGISTERED;
}

const char *drm_get_connector_type_name(unsigned int connector_type);
const char *drm_get_connector_status_name(enum drm_connector_status status);
const char *drm_get_subpixel_order_name(enum subpixel_order order);
const char *drm_get_dpms_name(int val);
@@ -1661,6 +1660,7 @@ const char *drm_get_tv_select_name(int val);
const char *drm_get_dp_subconnector_name(int val);
const char *drm_get_content_protection_name(int val);
const char *drm_get_hdcp_content_type_name(int val);
const char *drm_get_connector_name(int val);

int drm_mode_create_dvi_i_properties(struct drm_device *dev);
void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector);
@@ -314,6 +314,9 @@ const struct drm_format_info *drm_format_info(u32 format);
const struct drm_format_info *
drm_get_format_info(struct drm_device *dev,
const struct drm_mode_fb_cmd2 *mode_cmd);

int drm_format_num_planes(uint32_t format);

uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
uint32_t drm_driver_legacy_fb_format(struct drm_device *dev,
uint32_t bpp, uint32_t depth);

0 comments on commit 14a93e4

Please sign in to comment.