mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
lima: fix half float render
Format 0x26 is invalid, formats are in a 4 bit field so they repeat in increments of 16. Frame reg flags needs to set 0x01 to actually enable fp16. The clear color setup is also a bit different for fp16, need to use the 16 bit values in the first two clear color registers. Signed-off-by: Erico Nunes <nunes.erico@gmail.com> Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9916>
This commit is contained in:
parent
ba8737bb86
commit
8393fad0de
3 changed files with 26 additions and 10 deletions
|
|
@ -61,9 +61,9 @@
|
|||
#define LIMA_PIXEL_FORMAT_B8G8R8A8 0x03
|
||||
#define LIMA_PIXEL_FORMAT_B8 0x04
|
||||
#define LIMA_PIXEL_FORMAT_G8B8 0x05
|
||||
#define LIMA_PIXEL_FORMAT_B16G16R16A16_FLOAT 0x06
|
||||
#define LIMA_PIXEL_FORMAT_Z16 0x0e
|
||||
#define LIMA_PIXEL_FORMAT_Z24S8 0x0f
|
||||
#define LIMA_PIXEL_FORMAT_R16G16B16A16_FLOAT 0x26
|
||||
|
||||
struct lima_format {
|
||||
bool present;
|
||||
|
|
@ -138,7 +138,7 @@ static const struct lima_format lima_pixel_formats[] = {
|
|||
LIMA_PIXEL_FORMAT(R8G8_UNORM, G8B8, true, 0x8888),
|
||||
LIMA_PIXEL_FORMAT(Z24_UNORM_S8_UINT, Z24S8, false, 0x0000),
|
||||
LIMA_PIXEL_FORMAT(Z24X8_UNORM, Z24S8, false, 0x0000),
|
||||
LIMA_PIXEL_FORMAT(R16G16B16A16_FLOAT, R16G16B16A16_FLOAT, true, 0x0000),
|
||||
LIMA_PIXEL_FORMAT(R16G16B16A16_FLOAT, B16G16R16A16_FLOAT, true, 0x0000),
|
||||
};
|
||||
|
||||
static const struct lima_format *
|
||||
|
|
|
|||
|
|
@ -835,18 +835,29 @@ lima_pack_pp_frame_reg(struct lima_job *job, uint32_t *frame_reg,
|
|||
{
|
||||
struct lima_context *ctx = job->ctx;
|
||||
struct lima_job_fb_info *fb = &job->fb;
|
||||
struct pipe_surface *cbuf = job->key.cbuf;
|
||||
struct lima_pp_frame_reg *frame = (void *)frame_reg;
|
||||
struct lima_screen *screen = lima_screen(ctx->base.screen);
|
||||
int wb_idx = 0;
|
||||
|
||||
frame->render_address = screen->pp_buffer->va + pp_frame_rsw_offset;
|
||||
frame->flags = 0x02;
|
||||
if (cbuf && util_format_is_float(cbuf->format)) {
|
||||
frame->flags |= 0x01; /* enable fp16 */
|
||||
frame->clear_value_color = (uint32_t)(job->clear.color_16pc & 0xffffffffUL);
|
||||
frame->clear_value_color_1 = (uint32_t)(job->clear.color_16pc >> 32);
|
||||
frame->clear_value_color_2 = 0;
|
||||
frame->clear_value_color_3 = 0;
|
||||
}
|
||||
else {
|
||||
frame->clear_value_color = job->clear.color_8pc;
|
||||
frame->clear_value_color_1 = job->clear.color_8pc;
|
||||
frame->clear_value_color_2 = job->clear.color_8pc;
|
||||
frame->clear_value_color_3 = job->clear.color_8pc;
|
||||
}
|
||||
|
||||
frame->clear_value_depth = job->clear.depth;
|
||||
frame->clear_value_stencil = job->clear.stencil;
|
||||
frame->clear_value_color = job->clear.color_8pc;
|
||||
frame->clear_value_color_1 = job->clear.color_8pc;
|
||||
frame->clear_value_color_2 = job->clear.color_8pc;
|
||||
frame->clear_value_color_3 = job->clear.color_8pc;
|
||||
frame->one = 1;
|
||||
|
||||
frame->width = fb->width - 1;
|
||||
|
|
@ -870,7 +881,7 @@ lima_pack_pp_frame_reg(struct lima_job *job, uint32_t *frame_reg,
|
|||
/* Set default layout to 8888 */
|
||||
frame->channel_layout = 0x8888;
|
||||
|
||||
if (job->key.cbuf && (job->resolve & PIPE_CLEAR_COLOR0))
|
||||
if (cbuf && (job->resolve & PIPE_CLEAR_COLOR0))
|
||||
lima_pack_wb_cbuf_reg(job, frame_reg, wb_reg, wb_idx++);
|
||||
|
||||
if (job->key.zsbuf &&
|
||||
|
|
|
|||
|
|
@ -320,9 +320,14 @@ lima_screen_is_format_supported(struct pipe_screen *pscreen,
|
|||
if (sample_count > 1 && sample_count != 4)
|
||||
return false;
|
||||
|
||||
if (usage & PIPE_BIND_RENDER_TARGET &&
|
||||
!lima_format_pixel_supported(format))
|
||||
return false;
|
||||
if (usage & PIPE_BIND_RENDER_TARGET) {
|
||||
if (!lima_format_pixel_supported(format))
|
||||
return false;
|
||||
|
||||
/* multisample unsupported with half float target */
|
||||
if (sample_count > 1 && util_format_is_float(format))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (usage & PIPE_BIND_DEPTH_STENCIL) {
|
||||
switch (format) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue