android: gallium/radeon: attempt to fix the android build
[mesa.git] / src / gallium / drivers / r300 / r300_context.c
index c744fea10cf85aed4807c0c01ef34820e1217d12..4e06fc49d2257b49678b2c564b436a6a25667d3c 100644 (file)
@@ -37,6 +37,8 @@
 #include "r300_screen_buffer.h"
 #include "compiler/radeon_regalloc.h"
 
+#include <inttypes.h>
+
 static void r300_release_referenced_objects(struct r300_context *r300)
 {
     struct pipe_framebuffer_state *fb =
@@ -75,6 +77,9 @@ static void r300_destroy_context(struct pipe_context* context)
     if (r300->cs && r300->hyperz_enabled) {
         r300->rws->cs_request_feature(r300->cs, RADEON_FID_R300_HYPERZ_ACCESS, FALSE);
     }
+    if (r300->cs && r300->cmask_access) {
+        r300->rws->cs_request_feature(r300->cs, RADEON_FID_R300_CMASK_ACCESS, FALSE);
+    }
 
     if (r300->blitter)
         util_blitter_destroy(r300->blitter);
@@ -120,11 +125,12 @@ static void r300_destroy_context(struct pipe_context* context)
     FREE(r300);
 }
 
-static void r300_flush_callback(void *data, unsigned flags)
+static void r300_flush_callback(void *data, unsigned flags,
+                               struct pipe_fence_handle **fence)
 {
     struct r300_context* const cs_context_copy = data;
 
-    r300_flush(&cs_context_copy->context, flags, NULL);
+    r300_flush(&cs_context_copy->context, flags, fence);
 }
 
 #define R300_INIT_ATOM(atomname, atomsize) \
@@ -201,8 +207,9 @@ static boolean r300_setup_atoms(struct r300_context* r300)
     R300_INIT_ATOM(texture_cache_inval, 2);
     R300_INIT_ATOM(textures_state, 0);
     /* Clear commands */
-    R300_INIT_ATOM(hiz_clear, r300->screen->caps.hiz_ram > 0 ? 6 : 0);
-    R300_INIT_ATOM(zmask_clear, r300->screen->caps.zmask_ram > 0 ? 6 : 0);
+    R300_INIT_ATOM(hiz_clear, r300->screen->caps.hiz_ram > 0 ? 4 : 0);
+    R300_INIT_ATOM(zmask_clear, r300->screen->caps.zmask_ram > 0 ? 4 : 0);
+    R300_INIT_ATOM(cmask_clear, 4);
     /* ZB (unpipelined), SU. */
     R300_INIT_ATOM(query_start, 4);
 
@@ -271,7 +278,7 @@ static void r300_init_states(struct pipe_context *pipe)
 
     pipe->set_blend_color(pipe, &bc);
     pipe->set_clip_state(pipe, &cs);
-    pipe->set_scissor_state(pipe, &ss);
+    pipe->set_scissor_states(pipe, 0, 1, &ss);
     pipe->set_sample_mask(pipe, ~0);
 
     /* Initialize the GPU flush. */
@@ -375,7 +382,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
                      sizeof(struct pipe_transfer), 64,
                      UTIL_SLAB_SINGLETHREADED);
 
-    r300->cs = rws->cs_create(rws);
+    r300->cs = rws->cs_create(rws, RING_GFX, r300_flush_callback, r300, NULL);
     if (r300->cs == NULL)
         goto fail;
 
@@ -405,21 +412,17 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300_init_render_functions(r300);
     r300_init_states(&r300->context);
 
-    r300->context.create_video_decoder = vl_create_decoder;
+    r300->context.create_video_codec = vl_create_decoder;
     r300->context.create_video_buffer = vl_video_buffer_create;
 
-    if (r300screen->caps.has_tcl) {
-        r300->uploader = u_upload_create(&r300->context, 256 * 1024, 4,
-                                         PIPE_BIND_INDEX_BUFFER);
-    }
+    r300->uploader = u_upload_create(&r300->context, 256 * 1024, 4,
+                                     PIPE_BIND_CUSTOM);
 
     r300->blitter = util_blitter_create(&r300->context);
     if (r300->blitter == NULL)
         goto fail;
     r300->blitter->draw_rectangle = r300_blitter_draw_rectangle;
 
-    rws->cs_set_flush_callback(r300->cs, r300_flush_callback, r300);
-
     /* The KIL opcode needs the first texture unit to be enabled
      * on r3xx-r4xx. In order to calm down the CS checker, we bind this
      * dummy texture there. */
@@ -449,7 +452,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         memset(&vb, 0, sizeof(vb));
         vb.target = PIPE_BUFFER;
         vb.format = PIPE_FORMAT_R8_UNORM;
-        vb.usage = PIPE_USAGE_STATIC;
+        vb.usage = PIPE_USAGE_DEFAULT;
         vb.width0 = sizeof(float) * 16;
         vb.height0 = 1;
         vb.depth0 = 1;
@@ -481,7 +484,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 #endif
         fprintf(stderr,
                 "r300: DRM version: %d.%d.%d, Name: %s, ID: 0x%04x, GB: %d, Z: %d\n"
-                "r300: GART size: %d MB, VRAM size: %d MB\n"
+                "r300: GART size: %"PRIu64" MB, VRAM size: %"PRIu64" MB\n"
                 "r300: AA compression RAM: %s, Z compression RAM: %s, HiZ RAM: %s\n",
                 r300->screen->info.drm_major,
                 r300->screen->info.drm_minor,