#include "common/gen_device_info.h"
#include "blorp/blorp.h"
-#include "brw_compiler.h"
+#include "compiler/brw_compiler.h"
#include "util/macros.h"
#include "util/list.h"
#include "util/u_vector.h"
#include <vulkan/vk_icd.h>
#include "anv_entrypoints.h"
-#include "brw_context.h"
#include "isl/isl.h"
+#include "common/gen_debug.h"
#include "wsi_common.h"
/* Allowing different clear colors requires us to perform a depth resolve at
void __anv_finishme(const char *file, int line, const char *format, ...)
anv_printflike(3, 4);
+void __anv_perf_warn(const char *file, int line, const char *format, ...)
+ anv_printflike(3, 4);
void anv_loge(const char *format, ...) anv_printflike(1, 2);
void anv_loge_v(const char *format, va_list va);
} \
} while (0)
+/**
+ * Print a perf warning message. Set INTEL_DEBUG=perf to see these.
+ */
+#define anv_perf_warn(format, ...) \
+ do { \
+ static bool reported = false; \
+ if (!reported && unlikely(INTEL_DEBUG & DEBUG_PERF)) { \
+ __anv_perf_warn(__FILE__, __LINE__, format, ##__VA_ARGS__); \
+ reported = true; \
+ } \
+ } while (0)
+
/* A non-fatal assert. Useful for debugging. */
#ifdef DEBUG
#define anv_assert(x) ({ \
#define anv_assert(x)
#endif
-/**
- * If a block of code is annotated with anv_validate, then the block runs only
- * in debug builds.
- */
-#ifdef DEBUG
-#define anv_validate if (1)
-#else
-#define anv_validate if (0)
-#endif
-
-#define stub_return(v) \
- do { \
- anv_finishme("stub %s", __func__); \
- return (v); \
- } while (0)
-
-#define stub() \
- do { \
- anv_finishme("stub %s", __func__); \
- return; \
- } while (0)
-
/**
* A dynamically growable, circular buffer. Elements are added at head and
* removed from tail. head and tail are free-running uint32_t indices and we
};
/* Block pools are backed by a fixed-size 2GB memfd */
-#define BLOCK_POOL_MEMFD_SIZE (1ull << 32)
+#define BLOCK_POOL_MEMFD_SIZE (1ul << 31)
/* The center of the block pool is also the middle of the memfd. This may
* change in the future if we decide differently for some reason.
struct {
struct anv_image_view *image_view;
struct anv_sampler *sampler;
+
+ /* Used to determine whether or not we need the surface state to have
+ * the auxiliary buffer enabled.
+ */
+ enum isl_aux_usage aux_usage;
};
struct anv_buffer_view *buffer_view;
void
anv_descriptor_set_write_image_view(struct anv_descriptor_set *set,
+ const struct gen_device_info * const devinfo,
+ const VkDescriptorImageInfo * const info,
VkDescriptorType type,
- VkImageView _image_view,
- VkSampler _sampler,
uint32_t binding,
uint32_t element);
/* Returns true if a HiZ-enabled depth buffer can be sampled from. */
static inline bool
-anv_can_sample_with_hiz(uint8_t gen, uint32_t samples)
+anv_can_sample_with_hiz(const struct gen_device_info * const devinfo,
+ const VkImageAspectFlags aspect_mask,
+ const uint32_t samples)
{
- return gen >= 8 && samples == 1;
+ /* Validate the inputs. */
+ assert(devinfo && aspect_mask && samples);
+ return devinfo->gen >= 8 && (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) &&
+ samples == 1;
}
void
const struct anv_image *image,
enum blorp_hiz_op op);
+enum isl_aux_usage
+anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
+ const struct anv_image *image,
+ const VkImageAspectFlags aspects,
+ const VkImageLayout layout);
static inline uint32_t
anv_get_layerCount(const struct anv_image *image,
const VkImageSubresourceRange *range)
/** RENDER_SURFACE_STATE when using image as a sampler surface. */
struct anv_state sampler_surface_state;
+ /**
+ * RENDER_SURFACE_STATE when using image as a sampler surface with the
+ * auxiliary buffer disabled.
+ */
+ struct anv_state no_aux_sampler_surface_state;
+
/**
* RENDER_SURFACE_STATE when using image as a storage image. Separate states
* for write-only and readable, using the real format for write-only and the
};
struct anv_subpass {
+ uint32_t attachment_count;
+
+ /**
+ * A pointer to all attachment references used in this subpass.
+ * Only valid if ::attachment_count > 0.
+ */
+ VkAttachmentReference * attachments;
uint32_t input_count;
- uint32_t * input_attachments;
+ VkAttachmentReference * input_attachments;
uint32_t color_count;
- uint32_t * color_attachments;
- uint32_t * resolve_attachments;
+ VkAttachmentReference * color_attachments;
+ VkAttachmentReference * resolve_attachments;
- /* TODO: Consider storing the depth/stencil VkAttachmentReference
- * instead of its two structure members (below) individually.
- */
- uint32_t depth_stencil_attachment;
- VkImageLayout depth_stencil_layout;
+ VkAttachmentReference depth_stencil_attachment;
/** Subpass has a depth/stencil self-dependency */
bool has_ds_self_dep;
struct anv_render_pass {
uint32_t attachment_count;
uint32_t subpass_count;
- uint32_t * subpass_attachments;
+ VkAttachmentReference * subpass_attachments;
enum anv_subpass_usage * subpass_usages;
struct anv_render_pass_attachment * attachments;
struct anv_subpass subpasses[0];
void anv_dump_add_framebuffer(struct anv_cmd_buffer *cmd_buffer,
struct anv_framebuffer *fb);
+static inline uint32_t
+anv_get_subpass_id(const struct anv_cmd_state * const cmd_state)
+{
+ /* This function must be called from within a subpass. */
+ assert(cmd_state->pass && cmd_state->subpass);
+
+ const uint32_t subpass_id = cmd_state->subpass - cmd_state->pass->subpasses;
+
+ /* The id of this subpass shouldn't exceed the number of subpasses in this
+ * render pass minus 1.
+ */
+ assert(subpass_id < cmd_state->pass->subpass_count);
+ return subpass_id;
+}
+
#define ANV_DEFINE_HANDLE_CASTS(__anv_type, __VkType) \
\
static inline struct __anv_type * \