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,11 +357,12 @@ int sunxi_layer_release(sunxi_disp_t *ctx) ...@@ -357,11 +357,12 @@ int sunxi_layer_release(sunxi_disp_t *ctx)
return 0; return 0;
} }
int sunxi_layer_set_x8r8g8b8_input_buffer(sunxi_disp_t *ctx, int sunxi_layer_set_rgb_input_buffer(sunxi_disp_t *ctx,
uint32_t offset_in_framebuffer, int bpp,
int width, uint32_t offset_in_framebuffer,
int height, int width,
int stride) int height,
int stride)
{ {
__disp_fb_t fb; __disp_fb_t fb;
__disp_rect_t rect = { 0, 0, width, height }; __disp_rect_t rect = { 0, 0, width, height };
...@@ -379,11 +380,20 @@ int sunxi_layer_set_x8r8g8b8_input_buffer(sunxi_disp_t *ctx, ...@@ -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.addr[0] = ctx->framebuffer_paddr + offset_in_framebuffer;
fb.size.width = stride;
fb.size.height = height; fb.size.height = height;
fb.format = DISP_FORMAT_ARGB8888; if (bpp == 32) {
fb.seq = DISP_SEQ_ARGB; fb.format = DISP_FORMAT_ARGB8888;
fb.mode = DISP_MOD_INTERLEAVED; 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[0] = ctx->fb_id;
tmp[1] = ctx->layer_id; tmp[1] = ctx->layer_id;
......
...@@ -89,11 +89,12 @@ int sunxi_hw_cursor_hide(sunxi_disp_t *ctx); ...@@ -89,11 +89,12 @@ int sunxi_hw_cursor_hide(sunxi_disp_t *ctx);
int sunxi_layer_reserve(sunxi_disp_t *ctx); int sunxi_layer_reserve(sunxi_disp_t *ctx);
int sunxi_layer_release(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,
uint32_t offset_in_framebuffer, int bpp,
int width, uint32_t offset_in_framebuffer,
int height, int width,
int stride); int height,
int stride);
int sunxi_layer_set_yuv420_input_buffer(sunxi_disp_t *ctx, int sunxi_layer_set_yuv420_input_buffer(sunxi_disp_t *ctx,
uint32_t y_offset_in_framebuffer, uint32_t y_offset_in_framebuffer,
......
...@@ -344,7 +344,7 @@ static DRI2Buffer2Ptr MaliDRI2CreateBuffer(DrawablePtr pDraw, ...@@ -344,7 +344,7 @@ static DRI2Buffer2Ptr MaliDRI2CreateBuffer(DrawablePtr pDraw,
can_use_overlay = FALSE; can_use_overlay = FALSE;
/* TODO: try to support other color depths later */ /* TODO: try to support other color depths later */
if (pDraw->bitsPerPixel != 32) if (pDraw->bitsPerPixel != 32 && pDraw->bitsPerPixel != 16)
can_use_overlay = FALSE; can_use_overlay = FALSE;
if (disp && disp->framebuffer_size - disp->gfx_layer_size < privates->size * 2) { if (disp && disp->framebuffer_size - disp->gfx_layer_size < privates->size * 2) {
...@@ -688,8 +688,8 @@ static void MaliDRI2CopyRegion(DrawablePtr pDraw, ...@@ -688,8 +688,8 @@ static void MaliDRI2CopyRegion(DrawablePtr pDraw,
/* Activate the overlay */ /* Activate the overlay */
sunxi_layer_set_output_window(disp, pDraw->x, pDraw->y, pDraw->width, pDraw->height); 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, sunxi_layer_set_rgb_input_buffer(disp, umpbuf->cpp * 8, umpbuf->offs,
umpbuf->height, umpbuf->pitch / 4); umpbuf->width, umpbuf->height, umpbuf->pitch / 4);
sunxi_layer_show(disp); sunxi_layer_show(disp);
if (mali->bSwapbuffersWait) { if (mali->bSwapbuffersWait) {
......
...@@ -121,7 +121,8 @@ int main(int argc, char *argv[]) ...@@ -121,7 +121,8 @@ int main(int argc, char *argv[])
/* setup layer window to cover the whole screen */ /* setup layer window to cover the whole screen */
sunxi_layer_set_output_window(disp, 0, 0, disp->xres, disp->yres); sunxi_layer_set_output_window(disp, 0, 0, disp->xres, disp->yres);
/* setup the layer scanout buffer to the first page in the framebuffer */ /* 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 */ /* make the layer visible */
sunxi_layer_show(disp); sunxi_layer_show(disp);
...@@ -148,8 +149,9 @@ int main(int argc, char *argv[]) ...@@ -148,8 +149,9 @@ int main(int argc, char *argv[])
color); color);
/* schedule the change of layer scanout buffer on next vsync */ /* 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,
disp->xres, disp->yres, disp->xres); yoffs * disp->xres * 4,
disp->xres, disp->yres, disp->xres);
/* wait for the vsync itself */ /* wait for the vsync itself */
sunxi_wait_for_vsync(disp); 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