Commit 4cde4d1c authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz

Generalize allowed resolutions

Signed-off-by: Andrzej Pietrasiewicz's avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
parent 894bcf0a
......@@ -57,6 +57,10 @@ struct bo
/* -----------------------------------------------------------------------------
* Buffers management
*/
#define TILE_HDR_LEN 16
#define TILE_W 16
#define TILE_H 16
#define TILE_BPP 4
static struct bo *
bo_create_dumb(int fd, unsigned int width, unsigned int height, unsigned int bpp)
......@@ -87,7 +91,7 @@ bo_create_dumb(int fd, unsigned int width, unsigned int height, unsigned int bpp
bo->fd = fd;
bo->handle = arg.handle;
bo->size = arg.size;
bo->pitch = 1920;
bo->pitch = arg.pitch;
return bo;
}
......@@ -125,11 +129,6 @@ static void bo_unmap(struct bo *bo)
bo->ptr = NULL;
}
#define TILE_HDR_LEN 16
#define TILE_W 16
#define TILE_H 16
#define TILE_BPP 4
static unsigned int generate_tile_header(void *mem, unsigned int base, unsigned int i)
{
memset(mem, 0, TILE_HDR_LEN);
......@@ -152,14 +151,12 @@ static unsigned int generate_tile_body(void *mem)
return TILE_W * TILE_H * TILE_BPP;
}
static void generate_afbc_frame(void *mem)
static void generate_afbc_frame(void *mem, unsigned width, unsigned height)
{
//unsigned int width = 1280, height = 720;
unsigned int width = 1920, height = 1080;
unsigned int off = 0, tile_r, tile_c, i = 0, base, rows, cols;
rows = height / TILE_H + 1;
cols = width / TILE_W;
rows = (height + TILE_H - 1) / TILE_H;
cols = (width + TILE_W - 1) / TILE_W;
base = rows * cols * 16;
for (tile_r = 0; tile_r < rows; ++tile_r)
for (tile_c = 0; tile_c < cols; ++tile_c)
......@@ -381,7 +378,7 @@ bo_create(int fd, unsigned int format,
break;
}
generate_afbc_frame(planes[0]);
generate_afbc_frame(planes[0], width, virtual_height);
bo_unmap(bo);
return bo;
......
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