display: Use dcp iboot SetSurface instead of SwapLayer

iboot uses this and it's simpler. m1n1 doesn't need to swap surfaces
for tear free display.

Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
Janne Grunau 2023-08-28 21:45:46 +02:00 committed by Hector Martin
parent fecfa130e9
commit b72407ed23
3 changed files with 13 additions and 15 deletions

View file

@ -44,6 +44,7 @@ struct dcp_iboot_if {
};
enum IBootCmd {
IBOOT_SET_SURFACE = 1,
IBOOT_SET_POWER = 2,
IBOOT_GET_HPD = 3,
IBOOT_GET_TIMING_MODES = 4,
@ -146,6 +147,14 @@ static int dcp_ib_cmd(dcp_iboot_if_t *iboot, int op, size_t in_size)
sizeof(struct txcmd) + in_size, iboot->rxbuf, &rxsize);
}
int dcp_ib_set_surface(dcp_iboot_if_t *iboot, dcp_layer_t *layer)
{
dcp_layer_t *cmd = (void *)iboot->txcmd.payload;
*cmd = *layer;
return dcp_ib_cmd(iboot, IBOOT_SET_SURFACE, sizeof(*layer));
}
int dcp_ib_set_power(dcp_iboot_if_t *iboot, bool power)
{
u32 *pwr = (void *)iboot->txcmd.payload;

View file

@ -98,6 +98,7 @@ typedef struct {
dcp_iboot_if_t *dcp_ib_init(dcp_dev_t *dcp);
int dcp_ib_shutdown(dcp_iboot_if_t *iboot);
int dcp_ib_set_surface(dcp_iboot_if_t *iboot, dcp_layer_t *layer);
int dcp_ib_set_power(dcp_iboot_if_t *iboot, bool power);
int dcp_ib_get_hpd(dcp_iboot_if_t *iboot, int *timing_cnt, int *color_cnt);
int dcp_ib_get_timing_modes(dcp_iboot_if_t *iboot, dcp_timing_mode_t **modes);

View file

@ -250,11 +250,6 @@ int display_parse_mode(const char *config, dcp_timing_mode_t *mode, struct displ
static int display_swap(u64 iova, u32 stride, u32 width, u32 height)
{
int ret;
int swap_id = ret = dcp_ib_swap_begin(iboot);
if (swap_id < 0) {
printf("display: failed to start swap\n");
return -1;
}
dcp_layer_t layer = {
.planes = {{
@ -271,19 +266,12 @@ static int display_swap(u64 iova, u32 stride, u32 width, u32 height)
.transform = XFRM_NONE,
};
dcp_rect_t rect = {width, height, 0, 0};
if ((ret = dcp_ib_swap_set_layer(iboot, 0, &layer, &rect, &rect)) < 0) {
printf("display: failed to set layer\n");
if ((ret = dcp_ib_set_surface(iboot, &layer)) < 0) {
printf("display: failed to set surface\n");
return -1;
}
if ((ret = dcp_ib_swap_end(iboot)) < 0) {
printf("display: failed to complete swap\n");
return -1;
}
return swap_id;
return 0;
}
int display_configure(const char *config)