drm/komeda: Set output color depth for output
Set color_depth according to connector->bpc. Changes since v1: - Fixed min_bpc is effectively set but not used in komeda_crtc_get_color_config(). Changes since v2: - Align the code. Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com> Reviewed-by: Mihail Atanassov <mihail.atanassov@arm.com> Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com> Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191012065030.12691-1-lowry.li@arm.com
This commit is contained in:
parent
f15886fa7d
commit
f9204ad9cd
|
@ -1041,6 +1041,7 @@ static void d71_improc_update(struct komeda_component *c,
|
||||||
to_d71_input_id(state, index));
|
to_d71_input_id(state, index));
|
||||||
|
|
||||||
malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize));
|
malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize));
|
||||||
|
malidp_write32(reg, IPS_DEPTH, st->color_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d71_improc_dump(struct komeda_component *c, struct seq_file *sf)
|
static void d71_improc_dump(struct komeda_component *c, struct seq_file *sf)
|
||||||
|
|
|
@ -17,6 +17,26 @@
|
||||||
#include "komeda_dev.h"
|
#include "komeda_dev.h"
|
||||||
#include "komeda_kms.h"
|
#include "komeda_kms.h"
|
||||||
|
|
||||||
|
void komeda_crtc_get_color_config(struct drm_crtc_state *crtc_st,
|
||||||
|
u32 *color_depths)
|
||||||
|
{
|
||||||
|
struct drm_connector *conn;
|
||||||
|
struct drm_connector_state *conn_st;
|
||||||
|
int i, min_bpc = 31, conn_bpc = 0;
|
||||||
|
|
||||||
|
for_each_new_connector_in_state(crtc_st->state, conn, conn_st, i) {
|
||||||
|
if (conn_st->crtc != crtc_st->crtc)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
conn_bpc = conn->display_info.bpc ? conn->display_info.bpc : 8;
|
||||||
|
|
||||||
|
if (conn_bpc < min_bpc)
|
||||||
|
min_bpc = conn_bpc;
|
||||||
|
}
|
||||||
|
|
||||||
|
*color_depths = GENMASK(min_bpc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st)
|
static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st)
|
||||||
{
|
{
|
||||||
u64 pxlclk, aclk;
|
u64 pxlclk, aclk;
|
||||||
|
|
|
@ -166,6 +166,8 @@ static inline bool has_flip_h(u32 rot)
|
||||||
return !!(rotation & DRM_MODE_REFLECT_X);
|
return !!(rotation & DRM_MODE_REFLECT_X);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void komeda_crtc_get_color_config(struct drm_crtc_state *crtc_st,
|
||||||
|
u32 *color_depths);
|
||||||
unsigned long komeda_crtc_get_aclk(struct komeda_crtc_state *kcrtc_st);
|
unsigned long komeda_crtc_get_aclk(struct komeda_crtc_state *kcrtc_st);
|
||||||
|
|
||||||
int komeda_kms_setup_crtcs(struct komeda_kms_dev *kms, struct komeda_dev *mdev);
|
int komeda_kms_setup_crtcs(struct komeda_kms_dev *kms, struct komeda_dev *mdev);
|
||||||
|
|
|
@ -325,6 +325,7 @@ struct komeda_improc {
|
||||||
|
|
||||||
struct komeda_improc_state {
|
struct komeda_improc_state {
|
||||||
struct komeda_component_state base;
|
struct komeda_component_state base;
|
||||||
|
u8 color_depth;
|
||||||
u16 hsize, vsize;
|
u16 hsize, vsize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -760,6 +760,7 @@ komeda_improc_validate(struct komeda_improc *improc,
|
||||||
struct komeda_data_flow_cfg *dflow)
|
struct komeda_data_flow_cfg *dflow)
|
||||||
{
|
{
|
||||||
struct drm_crtc *crtc = kcrtc_st->base.crtc;
|
struct drm_crtc *crtc = kcrtc_st->base.crtc;
|
||||||
|
struct drm_crtc_state *crtc_st = &kcrtc_st->base;
|
||||||
struct komeda_component_state *c_st;
|
struct komeda_component_state *c_st;
|
||||||
struct komeda_improc_state *st;
|
struct komeda_improc_state *st;
|
||||||
|
|
||||||
|
@ -773,6 +774,23 @@ komeda_improc_validate(struct komeda_improc *improc,
|
||||||
st->hsize = dflow->in_w;
|
st->hsize = dflow->in_w;
|
||||||
st->vsize = dflow->in_h;
|
st->vsize = dflow->in_h;
|
||||||
|
|
||||||
|
if (drm_atomic_crtc_needs_modeset(crtc_st)) {
|
||||||
|
u32 output_depths;
|
||||||
|
u32 avail_depths;
|
||||||
|
|
||||||
|
komeda_crtc_get_color_config(crtc_st, &output_depths);
|
||||||
|
|
||||||
|
avail_depths = output_depths & improc->supported_color_depths;
|
||||||
|
if (avail_depths == 0) {
|
||||||
|
DRM_DEBUG_ATOMIC("No available color depths, conn depths: 0x%x & display: 0x%x\n",
|
||||||
|
output_depths,
|
||||||
|
improc->supported_color_depths);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
st->color_depth = __fls(avail_depths);
|
||||||
|
}
|
||||||
|
|
||||||
komeda_component_add_input(&st->base, &dflow->input, 0);
|
komeda_component_add_input(&st->base, &dflow->input, 0);
|
||||||
komeda_component_set_output(&dflow->input, &improc->base, 0);
|
komeda_component_set_output(&dflow->input, &improc->base, 0);
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
|
||||||
struct komeda_dev *mdev = kms->base.dev_private;
|
struct komeda_dev *mdev = kms->base.dev_private;
|
||||||
struct komeda_wb_connector *kwb_conn;
|
struct komeda_wb_connector *kwb_conn;
|
||||||
struct drm_writeback_connector *wb_conn;
|
struct drm_writeback_connector *wb_conn;
|
||||||
|
struct drm_display_info *info;
|
||||||
u32 *formats, n_formats = 0;
|
u32 *formats, n_formats = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -171,6 +172,9 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
|
||||||
|
|
||||||
drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs);
|
drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs);
|
||||||
|
|
||||||
|
info = &kwb_conn->base.base.display_info;
|
||||||
|
info->bpc = __fls(kcrtc->master->improc->supported_color_depths);
|
||||||
|
|
||||||
kcrtc->wb_conn = kwb_conn;
|
kcrtc->wb_conn = kwb_conn;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue