struct pipe_resource *resource,
const struct pipe_surface *templ)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_surface *surf;
struct virgl_resource *res = virgl_resource(resource);
uint32_t handle;
static void virgl_surface_destroy(struct pipe_context *ctx,
struct pipe_surface *psurf)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_surface *surf = (struct virgl_surface *)psurf;
pipe_resource_reference(&surf->base.texture, NULL);
static void *virgl_create_blend_state(struct pipe_context *ctx,
const struct pipe_blend_state *blend_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle;
handle = virgl_object_assign_handle();
static void virgl_bind_blend_state(struct pipe_context *ctx,
void *blend_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)blend_state;
virgl_encode_bind_object(vctx, handle, VIRGL_OBJECT_BLEND);
}
static void virgl_delete_blend_state(struct pipe_context *ctx,
void *blend_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)blend_state;
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_BLEND);
}
static void *virgl_create_depth_stencil_alpha_state(struct pipe_context *ctx,
const struct pipe_depth_stencil_alpha_state *blend_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle;
handle = virgl_object_assign_handle();
static void virgl_bind_depth_stencil_alpha_state(struct pipe_context *ctx,
void *blend_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)blend_state;
virgl_encode_bind_object(vctx, handle, VIRGL_OBJECT_DSA);
}
static void virgl_delete_depth_stencil_alpha_state(struct pipe_context *ctx,
void *dsa_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)dsa_state;
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_DSA);
}
static void *virgl_create_rasterizer_state(struct pipe_context *ctx,
const struct pipe_rasterizer_state *rs_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle;
handle = virgl_object_assign_handle();
static void virgl_bind_rasterizer_state(struct pipe_context *ctx,
void *rs_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)rs_state;
virgl_encode_bind_object(vctx, handle, VIRGL_OBJECT_RASTERIZER);
static void virgl_delete_rasterizer_state(struct pipe_context *ctx,
void *rs_state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)rs_state;
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_RASTERIZER);
}
static void virgl_set_framebuffer_state(struct pipe_context *ctx,
const struct pipe_framebuffer_state *state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
vctx->framebuffer = *state;
virgl_encoder_set_framebuffer_state(vctx, state);
unsigned num_viewports,
const struct pipe_viewport_state *state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_viewport_states(vctx, start_slot, num_viewports, state);
}
unsigned num_elements,
const struct pipe_vertex_element *elements)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = virgl_object_assign_handle();
virgl_encoder_create_vertex_elements(vctx, handle,
num_elements, elements);
static void virgl_delete_vertex_elements_state(struct pipe_context *ctx,
void *ve)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)ve;
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_VERTEX_ELEMENTS);
static void virgl_bind_vertex_elements_state(struct pipe_context *ctx,
void *ve)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)ve;
virgl_encode_bind_object(vctx, handle, VIRGL_OBJECT_VERTEX_ELEMENTS);
}
unsigned num_buffers,
const struct pipe_vertex_buffer *buffers)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
util_set_vertex_buffers_count(vctx->vertex_buffer,
&vctx->num_vertex_buffers,
static void virgl_hw_set_vertex_buffers(struct pipe_context *ctx)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
if (vctx->vertex_array_dirty) {
virgl_encoder_set_vertex_buffers(vctx, vctx->num_vertex_buffers, vctx->vertex_buffer);
static void virgl_set_stencil_ref(struct pipe_context *ctx,
const struct pipe_stencil_ref *ref)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_stencil_ref(vctx, ref);
}
static void virgl_set_blend_color(struct pipe_context *ctx,
const struct pipe_blend_color *color)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_blend_color(vctx, color);
}
static void virgl_set_index_buffer(struct pipe_context *ctx,
const struct pipe_index_buffer *ib)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
if (ib) {
pipe_resource_reference(&vctx->index_buffer.buffer, ib->buffer);
static void virgl_hw_set_index_buffer(struct pipe_context *ctx,
struct pipe_index_buffer *ib)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_index_buffer(vctx, ib);
virgl_attach_res_index_buffer(vctx);
}
uint shader, uint index,
struct pipe_constant_buffer *buf)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
if (buf) {
if (!buf->user_buffer){
unsigned stride,
unsigned layer_stride)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_screen *vs = virgl_screen(ctx->screen);
struct virgl_resource *grres = (struct virgl_resource *)res;
struct virgl_buffer *vbuf = virgl_buffer(res);
const struct pipe_shader_state *shader,
unsigned type)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle;
struct tgsi_token *new_tokens;
int ret;
void *fs)
{
uint32_t handle = (unsigned long)fs;
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
}
void *gs)
{
uint32_t handle = (unsigned long)gs;
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
}
void *vs)
{
uint32_t handle = (unsigned long)vs;
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
}
void *vss)
{
uint32_t handle = (unsigned long)vss;
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_VERTEX);
}
void *vss)
{
uint32_t handle = (unsigned long)vss;
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_GEOMETRY);
}
void *vss)
{
uint32_t handle = (unsigned long)vss;
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_FRAGMENT);
}
const union pipe_color_union *color,
double depth, unsigned stencil)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encode_clear(vctx, buffers, color, depth, stencil);
}
static void virgl_draw_vbo(struct pipe_context *ctx,
const struct pipe_draw_info *dinfo)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_screen *rs = virgl_screen(ctx->screen);
struct pipe_index_buffer ib = {};
struct pipe_draw_info info = *dinfo;
struct pipe_fence_handle **fence,
enum pipe_flush_flags flags)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_screen *rs = virgl_screen(ctx->screen);
struct virgl_buffer *buf, *tmp;
struct pipe_resource *texture,
const struct pipe_sampler_view *state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_sampler_view *grview = CALLOC_STRUCT(virgl_sampler_view);
uint32_t handle;
struct virgl_resource *res;
unsigned num_views,
struct pipe_sampler_view **views)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
int i;
uint32_t disable_mask = ~((1ull << num_views) - 1);
struct virgl_textures_info *tinfo = &vctx->samplers[shader_type];
}
for (i = 0; i < num_views; i++) {
- struct virgl_sampler_view *grview = (struct virgl_sampler_view *)views[i];
+ struct virgl_sampler_view *grview = virgl_sampler_view(views[i]);
if (views[i] == (struct pipe_sampler_view *)tinfo->views[i])
continue;
static void virgl_destroy_sampler_view(struct pipe_context *ctx,
struct pipe_sampler_view *view)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
- struct virgl_sampler_view *grview = (struct virgl_sampler_view *)view;
+ struct virgl_context *vctx = virgl_context(ctx);
+ struct virgl_sampler_view *grview = virgl_sampler_view(view);
virgl_encode_delete_object(vctx, grview->handle, VIRGL_OBJECT_SAMPLER_VIEW);
pipe_resource_reference(&view->texture, NULL);
static void *virgl_create_sampler_state(struct pipe_context *ctx,
const struct pipe_sampler_state *state)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle;
handle = virgl_object_assign_handle();
static void virgl_delete_sampler_state(struct pipe_context *ctx,
void *ss)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handle = (unsigned long)ss;
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SAMPLER_STATE);
unsigned num_samplers,
void **samplers)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
uint32_t handles[32];
int i;
for (i = 0; i < num_samplers; i++) {
static void virgl_set_polygon_stipple(struct pipe_context *ctx,
const struct pipe_poly_stipple *ps)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_polygon_stipple(vctx, ps);
}
unsigned num_scissor,
const struct pipe_scissor_state *ss)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_scissor_state(vctx, start_slot, num_scissor, ss);
}
static void virgl_set_sample_mask(struct pipe_context *ctx,
unsigned sample_mask)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_sample_mask(vctx, sample_mask);
}
static void virgl_set_clip_state(struct pipe_context *ctx,
const struct pipe_clip_state *clip)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
virgl_encoder_set_clip_state(vctx, clip);
}
unsigned src_level,
const struct pipe_box *src_box)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_resource *dres = (struct virgl_resource *)dst;
struct virgl_resource *sres = (struct virgl_resource *)src;
static void virgl_blit(struct pipe_context *ctx,
const struct pipe_blit_info *blit)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_resource *dres = (struct virgl_resource *)blit->dst.resource;
struct virgl_resource *sres = (struct virgl_resource *)blit->src.resource;
static void
virgl_context_destroy( struct pipe_context *ctx )
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
struct virgl_screen *rs = virgl_screen(ctx->screen);
vctx->framebuffer.zsbuf = NULL;