Commit 37d5e05d authored by Siarhei Siamashka's avatar Siarhei Siamashka
Browse files

mali: support sunxi hardware overlay also with r5g6b5 format



Now zero copy and tear free buffer swapping is also supported
for 16bpp desktop.
Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent 64a0d642
......@@ -357,7 +357,8 @@ int sunxi_layer_release(sunxi_disp_t *ctx)
return 0;
}
int sunxi_layer_set_x8r8g8b8_input_buffer(sunxi_disp_t *ctx,
int sunxi_layer_set_rgb_input_buffer(sunxi_disp_t *ctx,
int bpp,
uint32_t offset_in_framebuffer,
int width,
int height,
......@@ -379,11 +380,20 @@ int sunxi_layer_set_x8r8g8b8_input_buffer(sunxi_disp_t *ctx,
}
fb.addr[0] = ctx->framebuffer_paddr + offset_in_framebuffer;
fb.size.width = stride;
fb.size.height = height;
if (bpp == 32) {
fb.format = DISP_FORMAT_ARGB8888;
fb.seq = DISP_SEQ_ARGB;
fb.mode = DISP_MOD_INTERLEAVED;
fb.size.width = stride;
} else if (bpp == 16) {
fb.format = DISP_FORMAT_RGB565;
fb.seq = DISP_SEQ_P10;
fb.mode = DISP_MOD_INTERLEAVED;
fb.size.width = stride * 2;
} else {
return -1;
}
tmp[0] = ctx->fb_id;
tmp[1] = ctx->layer_id;
......
......@@ -89,7 +89,8 @@ int sunxi_hw_cursor_hide(sunxi_disp_t *ctx);
int sunxi_layer_reserve(sunxi_disp_t *ctx);
int sunxi_layer_release(sunxi_disp_t *ctx);
int sunxi_layer_set_x8r8g8b8_input_buffer(sunxi_disp_t *ctx,
int sunxi_layer_set_rgb_input_buffer(sunxi_disp_t *ctx,
int bpp,
uint32_t offset_in_framebuffer,
int width,
int height,
......
......@@ -344,7 +344,7 @@ static DRI2Buffer2Ptr MaliDRI2CreateBuffer(DrawablePtr pDraw,
can_use_overlay = FALSE;
/* TODO: try to support other color depths later */
if (pDraw->bitsPerPixel != 32)
if (pDraw->bitsPerPixel != 32 && pDraw->bitsPerPixel != 16)
can_use_overlay = FALSE;
if (disp && disp->framebuffer_size - disp->gfx_layer_size < privates->size * 2) {
......@@ -688,8 +688,8 @@ static void MaliDRI2CopyRegion(DrawablePtr pDraw,
/* Activate the overlay */
sunxi_layer_set_output_window(disp, pDraw->x, pDraw->y, pDraw->width, pDraw->height);
sunxi_layer_set_x8r8g8b8_input_buffer(disp, umpbuf->offs, umpbuf->width,
umpbuf->height, umpbuf->pitch / 4);
sunxi_layer_set_rgb_input_buffer(disp, umpbuf->cpp * 8, umpbuf->offs,
umpbuf->width, umpbuf->height, umpbuf->pitch / 4);
sunxi_layer_show(disp);
if (mali->bSwapbuffersWait) {
......
......@@ -121,7 +121,8 @@ int main(int argc, char *argv[])
/* setup layer window to cover the whole screen */
sunxi_layer_set_output_window(disp, 0, 0, disp->xres, disp->yres);
/* setup the layer scanout buffer to the first page in the framebuffer */
sunxi_layer_set_x8r8g8b8_input_buffer(disp, 0, disp->xres, disp->yres, disp->xres);
sunxi_layer_set_rgb_input_buffer(disp, disp->bits_per_pixel,
0, disp->xres, disp->yres, disp->xres);
/* make the layer visible */
sunxi_layer_show(disp);
......@@ -148,7 +149,8 @@ int main(int argc, char *argv[])
color);
/* schedule the change of layer scanout buffer on next vsync */
sunxi_layer_set_x8r8g8b8_input_buffer(disp, yoffs * disp->xres * 4,
sunxi_layer_set_rgb_input_buffer(disp, disp->bits_per_pixel,
yoffs * disp->xres * 4,
disp->xres, disp->yres, disp->xres);
/* wait for the vsync itself */
sunxi_wait_for_vsync(disp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment