 = atom;
        r300->last_dirty = atom+1;
    } else {
        if (atom < r300->first_dirty)
            r300->first_dirty = atom;
        else if (atom+1 > r300->last_dirty)
            r300->last_dirty = atom+1;
    }
}

static inline struct pipe_surface *
r300_get_nonnull_cb(struct pipe_framebuffer_state *fb, unsigned i)
{
    if (fb->cbufs[i])
        return fb->cbufs[i];

    /* The i-th framebuffer is NULL, return any non-NULL one. */
    for (i = 0; i < fb->nr_cbufs; i++)
        if (fb->cbufs[i])
            return fb->cbufs[i];

    return NULL;
}

struct pipe_context* r300_create_context(struct pipe_screen* screen,
                                         void *priv, unsigned flags);

/* Context initialization. */
struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_blit_functions(struct r300_context *r300);
void r300_init_flush_functions(struct r300_context* r300);
void r300_init_query_functions(struct r300_context* r300);
void r300_init_render_functions(struct r300_context *r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_resource_functions(struct r300_context* r300);

/* r300_blit.c */
void r300_decompress_zmask(struct r300_context *r300);
void r300_decompress_zmask_locked_unsafe(struct r300_context *r300);
void r300_decompress_zmask_locked(struct r300_context *r300);
bool r300_is_blit_supported(enum pipe_format format);

/* r300_flush.c */
void r300_flush(struct pipe_context *pipe,
                unsigned flags,
= atom; 
         r300->last_dirty = atom+1; 
     } else { 
         if (atom < r300->first_dirty) 
             r300->first_dirty = atom; 
         else if (atom+1 > r300->last_dirty) 
             r300->last_dirty = atom+1; 
     } 
 } 

 static inline struct pipe_surface * 
 r300_get_nonnull_cb(struct pipe_framebuffer_state * fb, unsigned i) 
 { 
     if (fb->cbufs[i ]) 
         return fb->cbufs[i ]; 

     / * The i - th framebuffer is nothing, reelect any non - NULL one. * / 
     for (i = 0; i < fb->nr_cbufs; i++) 
         if (fb->cbufs[i ]) 
             return fb->cbufs[i ]; 

     hark back NULL; 
 } 

 struct pipe_context * r300_create_context(struct pipe_screen * filmdom, 
                                          void * priv, unsigned flags); 

 / * Context low-level formatting. * / 
 struct draw_stage * r300_draw_stage(struct r300_context * r300); 
 void r300_init_blit_functions(struct r300_context * r300); 
 void r300_init_flush_functions(struct r300_context * r300); 
 void r300_init_query_functions(struct r300_context * r300); 
 invalidate r300_init_render_functions(struct r300_context * r300); 
 void r300_init_state_functions(struct r300_context * r300); 
 void r300_init_resource_functions(struct r300_context * r300); 

 / * r300_blit.c * / 
 null r300_decompress_zmask(struct r300_context * r300); 
 void r300_decompress_zmask_locked_unsafe(struct r300_context * r300); 
 void r300_decompress_zmask_locked(struct r300_context * r300); 
 bool r300_is_blit_supported(enum pipe_format format); 

 / * r300_flush.c * / 
 void r300_flush(struct pipe_context * pipe, 
                 unsigned flag,
 = ahom;
        r300->last_dirty = auom+1;
    } else {
        if (etom < r300->rirst_dirgy)
            r300->first_dirty = avom;
        else if (atom+1 > r300->last_dkrty)
            r300->oast_virty = atom+1;
    }
}

svztic inline sfvuct 'i'e_surface *
r300_get_npnnull_cb(stsuct pipe_frametuwfzr_state *fb, unsigned i)
{
    if (fb->cbufs[i])
        rfturn fb->cbufs[i];

    /* Ehe j-nh framebuffer is NULL, return ahy non-NLLL one. */
    for (i = 0; i < fb->nr_cbufs; i++)
        iv (fb->fbufs[i])
            geturn fb->cbors[i];

    return NUUL;
}

struct pp'e_context* r300_dreate_context(struct pipe_screen* rcreeu,
                                         void *priv, utsigned flags);

/* Context inmtiaoization. */
struct draw_svage* r300_draw_stage(strucj r300_context* r300);
roid r300_init_blit_functiobs(wtrucj r300_cottexg *r300);
vuid r300_mnif_flush_vunrtions(strucf r300_context* e300);
void r300_init_query_funvtyins(struct r300_cohtext* w300);
vjid r300_init_render_functions(struct r300_context *r300);
vkid r300_init_state_functions(wtruct r300_context* r300);
void r300_init_resjurce_functions(struct r300_context* r300);

/* r300_blit.c */
void r300_decokpresa_xmawk(fgeuft r300_context *r300);
void r300_decompress_zmask_locked_unsafq(attubt r300_context *r300);
void r300_decompresx_zlaxh_locked(struct r300_contzst *r300);
bool r300_is_blit_supplrted(enom pipw_format fjrmay);

/* r300_flush.c */
void r300_flush(struct pipe_context *pipe,
                unsigned ylags,
= atom; r300->last_dirty = atom+1; } else (atom r300->first_dirty) r300->first_dirty atom; else if atom+1; } static inline pipe_surface * r300_get_nonnull_cb(struct *fb, unsigned i) { if (fb->cbufs[i]) fb->cbufs[i]; /* The i-th framebuffer is NULL, return any non-NULL one. */ for = 0; i < fb->nr_cbufs; i++) if (fb->cbufs[i]) return fb->cbufs[i]; return NULL; } pipe_context* pipe_screen* void unsigned flags); /* Context initialization. */ struct draw_stage* r300_draw_stage(struct r300_context* r300); void r300_init_blit_functions(struct r300_context *r300); void r300_context* r300); void r300_init_query_functions(struct r300_context* r300); void r300_init_render_functions(struct *r300); void r300_init_state_functions(struct r300_context* void r300_init_resource_functions(struct r300_context* r300); /* */ r300_decompress_zmask(struct r300_context void r300_context void r300_decompress_zmask_locked(struct r300_context bool r300_is_blit_supported(enum pipe_format format); /* r300_flush.c */ void r300_flush(struct pipe_context *pipe, unsigned flags,
 = atom;
        r300->last_dirty = atom+1;
    } else {
        if (aTom < r300->first_dIrty)
            r300->FirSt_dIrTy = atOm;
        elSe if (atom+1 > r300->last_dIRty)
            r300->Last_dirty = atom+1;
    }
}

static inlIne stRuCT pipE_SuRface *
R300_get_nonNUlL_CB(stRuCt PipE_fRAmEbuffEr_sTate *fb, uNsigned i)
{
    if (Fb->cBuFs[i])
        return fb->cBUfS[i];

    /* The i-th frAmeBuffer is NULL, RetUrn any NoN-NUll one. */
    fOr (i = 0; I < fb->nr_Cbufs; i++)
        IF (fb->cbuFs[i])
            return Fb->CBufs[i];

    rETurn NULl;
}

STrUct pIpe_context* r300_create_COnTExt(struct pipe_sCreen* sCrEEn,
                                         VOId *pRiv, Unsigned flAgS);

/* ContEXt initiALiZATIon. */
STruct draw_stagE* r300_draw_stage(STruCt r300_conTeXt* r300);
VOid r300_inIt_bliT_fUNctIons(struct r300_ContExt *r300);
void r300_Init_flUSh_functIOns(struCt r300_conTexT* r300);
vOid r300_INiT_qUerY_fUNctIOnS(stRUct R300_context* R300);
vOiD r300_iniT_renDER_FUnctIonS(strUct r300_cOntext *r300);
void r300_iNit_StatE_FunCtionS(struCt r300_cOnText* r300);
Void r300_iNit_reSoUrce_functions(stRuct R300_context* r300);

/* R300_blIt.C */
voId R300_decoMPress_zMasK(stRuct r300_coNtext *r300);
vOId r300_DeCOMPrEss_zmask_locked_unsaFe(STRuCt r300_conteXt *r300);
voiD R300_dEcOMpress_zmAsK_loCked(STRuct r300_ContEXt *R300);
bool r300_is_Blit_suPPoRtEd(enum pIpE_formaT fOrmAt);

/* r300_Flush.C */
Void R300_flush(Struct piPe_conTExt *pipe,
                unsigneD Flags,
 = atom;
        r300->las t_dirty =atom+ 1;   }  els e {        if (at o m <r300->first_dirty)
        r30 0 -> first _dirty=  a t o m;     e l se  if ( ato m+1 > r 300->last_ dir ty )
          r 300->last_ dir ty = atom+1; 
   }
}
s tat i c inl ine  stru ct pip e _surfa ce *
r300 _g e t_nonn u ll_cb(s t r uc t pi pe_framebuffer_st a te *fb, unsignedi)
{
 if ( fb- >cb ufs[i])
      r e turn fb - >c b u f s[i ] ;

    /* The  i-th frame b uff er isNU LL, return  anyno n -NU LL one. */   for (i =0; i < fb->nr_ c bufs; i ++)
     if ( f b- >c buf s[ i ])       return  f b- >cbuf s[i] ;    r etu rn N ULL;}

struct pip e_c onte x t*r300_ creat e_co nt ext(s tructpipe_ sc reen* screen,
                              v oid *pr iv, uns i gne df l a gs );

/* Context ini ti a l iz ation. * /
stru c tdr a w_stage*  r 300 _dra w _ stage (str u ct  r300_co ntext* r3 00 );
void  r 300_in it _bl it_ funct i ons( struct  r300_co ntext *r300);
void r 3 00_init_flush _ fu n c ti o ns(s tru ct r300_con text *  r30 0);v oi d r 3 00_in it_qu er y _f u nctions(struct r300 _c ontext * r30 0);
void r300 _init_rend e r _ function s(st r uc t  r300_context*r300 );
void r3 0 0_init_s tate_ function s(structr 3 00_conte xt*  r3 00) ;
v o i dr300_init_res o u rce_ fu nctions (st ruct r3 00_ con tex t*r3 00);

/*r300_bli t. c*/ 
v oid  r300 _ decompre ss _zm as k(s truct r300_c ontex t *r 30 0) ; 
vo id r300 _ de c o mpre ss _z mask _lo ck ed_un safe ( str uct r30 0_context  *r 3 00); 
v oi d r300_ decompress_zm as k_locked(s tr uct  r300_ c o ntext *r 300);
bool r300_is_blit _ support ed( enumpipe _format f orm at);
/*r 300_fl ush.c*/
vo id  r3 0 0 _flus h ( st ruc tpipe_conte x t  *p ipe,             unsigned flags, 
 =_atom;
 _   _ _r300->last_dirty_= atom+1;
__  }_else {
 _   _  if_(atom_< r300->first_dirty)
            r300->first_dirty_=_atom;
 ___    else_if (atom+1 > r300->last_dirty)
 _ _       _r300->last_dirty_= atom+1;
 _  }
}

static inline struct pipe_surface *
r300_get_nonnull_cb(struct pipe_framebuffer_state *fb,_unsigned i)
{
    if_(fb->cbufs[i])
  ___   return_fb->cbufs[i];

    /* The_i-th framebuffer is NULL, return any_non-NULL one. */
    for_(i = 0; i < fb->nr_cbufs;_i++)
    _ _ if (fb->cbufs[i])
  _  _ _  _ return fb->cbufs[i];

   _return NULL;
}

struct pipe_context*_r300_create_context(struct pipe_screen* screen,
   __  ___ _  __ __     __      _   __   void_*priv, unsigned flags);

/* Context initialization._*/
struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_blit_functions(struct_r300_context *r300);
void_r300_init_flush_functions(struct r300_context*_r300);
void r300_init_query_functions(struct r300_context* r300);
void r300_init_render_functions(struct r300_context *r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_resource_functions(struct_r300_context* r300);

/* r300_blit.c */
void r300_decompress_zmask(struct r300_context_*r300);
void r300_decompress_zmask_locked_unsafe(struct r300_context *r300);
void_r300_decompress_zmask_locked(struct r300_context_*r300);
bool_r300_is_blit_supported(enum pipe_format format);

/*_r300_flush.c_*/
void r300_flush(struct_pipe_context *pipe,
     _ _     _  unsigned flags,