nv50: rework nv50_compute_validate_program()

Reduce the amount of duplicated code by re-using
nv50_program_validate(). While we are at it, change the prototype to
return void. We don't check anymore if the translation fails but
improving the state validation is a long process.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
This commit is contained in:
Samuel Pitoiset 2016-03-15 14:58:20 +01:00
parent a07ebc1993
commit 5ed387675d
3 changed files with 17 additions and 31 deletions

View File

@ -155,34 +155,6 @@ nv50_screen_compute_setup(struct nv50_screen *screen,
return 0;
}
static bool
nv50_compute_validate_program(struct nv50_context *nv50)
{
struct nv50_program *prog = nv50->compprog;
if (prog->mem)
return true;
if (!prog->translated) {
prog->translated = nv50_program_translate(
prog, nv50->screen->base.device->chipset, &nv50->base.debug);
if (!prog->translated)
return false;
}
if (unlikely(!prog->code_size))
return false;
if (likely(prog->code_size)) {
if (nv50_program_upload_code(nv50, prog)) {
struct nouveau_pushbuf *push = nv50->base.pushbuf;
BEGIN_NV04(push, NV50_CP(CODE_CB_FLUSH), 1);
PUSH_DATA (push, 0);
return true;
}
}
return false;
}
static void
nv50_compute_validate_globals(struct nv50_context *nv50)
{
@ -201,9 +173,7 @@ nv50_compute_validate_globals(struct nv50_context *nv50)
static bool
nv50_compute_state_validate(struct nv50_context *nv50)
{
if (!nv50_compute_validate_program(nv50))
return false;
nv50_compprog_validate(nv50);
if (nv50->dirty_cp & NV50_NEW_CP_GLOBALS)
nv50_compute_validate_globals(nv50);

View File

@ -221,6 +221,7 @@ extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *);
void nv50_vertprog_validate(struct nv50_context *);
void nv50_gmtyprog_validate(struct nv50_context *);
void nv50_fragprog_validate(struct nv50_context *);
void nv50_compprog_validate(struct nv50_context *);
void nv50_fp_linkage_validate(struct nv50_context *);
void nv50_gp_linkage_validate(struct nv50_context *);
void nv50_constbufs_validate(struct nv50_context *);

View File

@ -29,6 +29,8 @@
#include "nv50/nv50_context.h"
#include "nv50/nv50_query_hw.h"
#include "nv50/nv50_compute.xml.h"
void
nv50_constbufs_validate(struct nv50_context *nv50)
{
@ -238,6 +240,19 @@ nv50_gmtyprog_validate(struct nv50_context *nv50)
/* GP_ENABLE is updated in linkage validation */
}
void
nv50_compprog_validate(struct nv50_context *nv50)
{
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct nv50_program *cp = nv50->compprog;
if (cp && !nv50_program_validate(nv50, cp))
return;
BEGIN_NV04(push, NV50_CP(CODE_CB_FLUSH), 1);
PUSH_DATA (push, 0);
}
static void
nv50_sprite_coords_validate(struct nv50_context *nv50)
{