OSDN Git Service

ilo: add ilo_builder_{dynamic,surface}_used()
authorChia-I Wu <olvaffe@gmail.com>
Thu, 25 Sep 2014 06:53:34 +0000 (14:53 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 26 Sep 2014 13:15:55 +0000 (21:15 +0800)
Return how many DWords are used in dynamic and surface buffers respectively.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/ilo/ilo_builder.h

index 8203f66..259487e 100644 (file)
@@ -311,6 +311,15 @@ ilo_builder_dynamic_write(struct ilo_builder *builder,
    return offset;
 }
 
+static inline unsigned
+ilo_builder_dynamic_used(const struct ilo_builder *builder)
+{
+   const enum ilo_builder_writer_type which = ILO_BUILDER_WRITER_BATCH;
+   const struct ilo_builder_writer *writer = &builder->writers[which];
+
+   return writer->stolen >> 2;
+}
+
 /**
  * Write a surface state to the surface buffer.  The offset, in bytes, of the
  * state is returned.
@@ -344,6 +353,12 @@ ilo_builder_surface_reloc(struct ilo_builder *builder,
          bo, bo_offset, reloc_flags);
 }
 
+static inline unsigned
+ilo_builder_surface_used(const struct ilo_builder *builder)
+{
+   return ilo_builder_dynamic_used(builder);
+}
+
 /**
  * Write a kernel to the instruction buffer.  The offset, in bytes, of the
  * kernel is returned.