diff --git a/src/dcp_iboot.c b/src/dcp_iboot.c index a3ede720..b76f2127 100644 --- a/src/dcp_iboot.c +++ b/src/dcp_iboot.c @@ -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; diff --git a/src/dcp_iboot.h b/src/dcp_iboot.h index adb449e3..c0fc5225 100644 --- a/src/dcp_iboot.h +++ b/src/dcp_iboot.h @@ -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); diff --git a/src/display.c b/src/display.c index 70864a3f..73d4d4da 100644 --- a/src/display.c +++ b/src/display.c @@ -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)