From 92b00c978bb6da3e741c41450c229e4074669e43 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 23 Oct 2015 11:28:56 +1000 Subject: [PATCH] renderer: CLEANUP - remove TABs I didn't do a good enough job last time at purging these. --- src/virglrenderer.c | 4 +- src/virglrenderer.h | 20 +-- src/vrend_decode.c | 12 +- src/vrend_formats.c | 24 ++-- src/vrend_iov.h | 4 +- src/vrend_renderer.c | 292 +++++++++++++++++++++---------------------- src/vrend_renderer.h | 18 +-- src/vrend_shader.c | 36 +++--- src/vrend_shader.h | 6 +- 9 files changed, 208 insertions(+), 208 deletions(-) diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 7c1d397..ea382db 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -75,8 +75,8 @@ void virgl_renderer_context_destroy(uint32_t handle) } int virgl_renderer_submit_cmd(void *buffer, - int ctx_id, - int ndw) + int ctx_id, + int ndw) { return vrend_decode_block(ctx_id, buffer, ndw); } diff --git a/src/virglrenderer.h b/src/virglrenderer.h index e3a4a2e..8794dd6 100644 --- a/src/virglrenderer.h +++ b/src/virglrenderer.h @@ -105,8 +105,8 @@ VIRGL_EXPORT int virgl_renderer_context_create(uint32_t handle, uint32_t nlen, c VIRGL_EXPORT void virgl_renderer_context_destroy(uint32_t handle); VIRGL_EXPORT int virgl_renderer_submit_cmd(void *buffer, - int ctx_id, - int ndw); + int ctx_id, + int ndw); VIRGL_EXPORT int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_id, uint32_t level, uint32_t stride, @@ -116,14 +116,14 @@ VIRGL_EXPORT int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_ int iovec_cnt); VIRGL_EXPORT int virgl_renderer_transfer_write_iov(uint32_t handle, - uint32_t ctx_id, - int level, - uint32_t stride, - uint32_t layer_stride, - struct virgl_box *box, - uint64_t offset, - struct iovec *iovec, - unsigned int iovec_cnt); + uint32_t ctx_id, + int level, + uint32_t stride, + uint32_t layer_stride, + struct virgl_box *box, + uint64_t offset, + struct iovec *iovec, + unsigned int iovec_cnt); VIRGL_EXPORT void virgl_renderer_get_cap_set(uint32_t set, uint32_t *max_ver, uint32_t *max_size); diff --git a/src/vrend_decode.c b/src/vrend_decode.c index 0fef313..256f16e 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -56,7 +56,7 @@ static inline uint32_t get_buf_entry(struct vrend_decode_ctx *ctx, uint32_t offs } static inline void *get_buf_ptr(struct vrend_decode_ctx *ctx, - uint32_t offset) + uint32_t offset) { return &ctx->ds->buf[ctx->ds->buf_offset + offset]; } @@ -183,9 +183,9 @@ static int vrend_decode_set_viewport_state(struct vrend_decode_ctx *ctx, int len start_slot = get_buf_entry(ctx, VIRGL_SET_VIEWPORT_START_SLOT); for (v = 0; v < num_viewports; v++) { for (i = 0; i < 3; i++) - vps[v].scale[i] = uif(get_buf_entry(ctx, VIRGL_SET_VIEWPORT_STATE_SCALE_0(v) + i)); + vps[v].scale[i] = uif(get_buf_entry(ctx, VIRGL_SET_VIEWPORT_STATE_SCALE_0(v) + i)); for (i = 0; i < 3; i++) - vps[v].translate[i] = uif(get_buf_entry(ctx, VIRGL_SET_VIEWPORT_STATE_TRANSLATE_0(v) + i)); + vps[v].translate[i] = uif(get_buf_entry(ctx, VIRGL_SET_VIEWPORT_STATE_TRANSLATE_0(v) + i)); } vrend_set_viewport_states(ctx->grctx, start_slot, num_viewports, vps); @@ -891,7 +891,7 @@ static int vrend_decode_bind_sampler_states(struct vrend_decode_ctx *ctx, int le return EINVAL; vrend_bind_sampler_states(ctx->grctx, shader_type, start_slot, num_states, - get_buf_ptr(ctx, VIRGL_BIND_SAMPLER_STATES_S0_HANDLE)); + get_buf_ptr(ctx, VIRGL_BIND_SAMPLER_STATES_S0_HANDLE)); return 0; } @@ -1162,8 +1162,8 @@ int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw) ret = vrend_decode_set_streamout_targets(gdctx, len); break; case VIRGL_CCMD_SET_RENDER_CONDITION: - ret = vrend_decode_set_render_condition(gdctx, len); - break; + ret = vrend_decode_set_render_condition(gdctx, len); + break; case VIRGL_CCMD_SET_UNIFORM_BUFFER: ret = vrend_decode_set_uniform_buffer(gdctx, len); break; diff --git a/src/vrend_formats.c b/src/vrend_formats.c index fc2bf8d..655c9fe 100644 --- a/src/vrend_formats.c +++ b/src/vrend_formats.c @@ -265,21 +265,21 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries) switch (table[i].format) { case PIPE_FORMAT_A8_UNORM: - entry = &rg_base_formats[0]; - swizzle[0] = swizzle[1] = swizzle[2] = PIPE_SWIZZLE_ZERO; - swizzle[3] = PIPE_SWIZZLE_RED; - break; + entry = &rg_base_formats[0]; + swizzle[0] = swizzle[1] = swizzle[2] = PIPE_SWIZZLE_ZERO; + swizzle[3] = PIPE_SWIZZLE_RED; + break; case PIPE_FORMAT_A16_UNORM: - entry = &rg_base_formats[2]; - swizzle[0] = swizzle[1] = swizzle[2] = PIPE_SWIZZLE_ZERO; - swizzle[3] = PIPE_SWIZZLE_RED; - break; + entry = &rg_base_formats[2]; + swizzle[0] = swizzle[1] = swizzle[2] = PIPE_SWIZZLE_ZERO; + swizzle[3] = PIPE_SWIZZLE_RED; + break; default: - break; + break; } if (entry) { - vrend_insert_format_swizzle(table[i].format, entry, binding, swizzle); + vrend_insert_format_swizzle(table[i].format, entry, binding, swizzle); } glDeleteTextures(1, &tex_id); glDeleteFramebuffers(1, &fb_id); @@ -290,9 +290,9 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries) GLenum attachment; if (table[i].format == VIRGL_FORMAT_Z24X8_UNORM || table[i].format == VIRGL_FORMAT_Z32_UNORM || table[i].format == VIRGL_FORMAT_Z16_UNORM || table[i].format == VIRGL_FORMAT_Z32_FLOAT) - attachment = GL_DEPTH_ATTACHMENT; + attachment = GL_DEPTH_ATTACHMENT; else - attachment = GL_DEPTH_STENCIL_ATTACHMENT; + attachment = GL_DEPTH_STENCIL_ATTACHMENT; glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, tex_id, 0); is_depth = true; diff --git a/src/vrend_iov.h b/src/vrend_iov.h index 209c251..377eb43 100644 --- a/src/vrend_iov.h +++ b/src/vrend_iov.h @@ -30,9 +30,9 @@ typedef void (*iov_cb)(void *cookie, unsigned int doff, void *src, int len); size_t vrend_get_iovec_size(const struct iovec *iov, int iovlen); size_t vrend_read_from_iovec(const struct iovec *iov, int iov_cnt, - size_t offset, char *buf, size_t bytes); + size_t offset, char *buf, size_t bytes); size_t vrend_write_to_iovec(const struct iovec *iov, int iov_cnt, - size_t offset, const char *buf, size_t bytes); + size_t offset, const char *buf, size_t bytes); size_t vrend_read_from_iovec_cb(const struct iovec *iov, int iov_cnt, size_t offset, size_t bytes, iov_cb iocb, void *cookie); diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 4200d15..37e7748 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -735,7 +735,7 @@ static void set_stream_out_varyings(int prog_id, struct vrend_shader_info *sinfo } for (j = last_buffer; j < so->output[i].output_buffer; j++) varyings[n_outputs++] = strdup("gl_NextBuffer"); - last_buffer = so->output[i].output_buffer; + last_buffer = so->output[i].output_buffer; buf_offset = 0; } @@ -749,7 +749,7 @@ static void set_stream_out_varyings(int prog_id, struct vrend_shader_info *sinfo buf_offset += so->output[i].num_components; if (sinfo->so_names[i]) - varyings[n_outputs++] = strdup(sinfo->so_names[i]); + varyings[n_outputs++] = strdup(sinfo->so_names[i]); } skip = so->stride[last_buffer] - buf_offset; @@ -1080,22 +1080,22 @@ static void vrend_destroy_so_target_object(void *obj_ptr) LIST_FOR_EACH_ENTRY_SAFE(obj, tmp, &sub_ctx->streamout_list, head) { found = false; for (i = 0; i < obj->num_targets; i++) { - if (obj->so_targets[i] == target) { - found = true; - break; - } + if (obj->so_targets[i] == target) { + found = true; + break; + } } if (found) { - if (obj == sub_ctx->current_so) - sub_ctx->current_so = NULL; - if (obj->xfb_state == XFB_STATE_PAUSED) { - if (vrend_state.have_tf2) - glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, obj->id); - glEndTransformFeedback(); - if (sub_ctx->current_so && vrend_state.have_tf2) - glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, sub_ctx->current_so->id); - } - vrend_destroy_streamout_object(obj); + if (obj == sub_ctx->current_so) + sub_ctx->current_so = NULL; + if (obj->xfb_state == XFB_STATE_PAUSED) { + if (vrend_state.have_tf2) + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, obj->id); + glEndTransformFeedback(); + if (sub_ctx->current_so && vrend_state.have_tf2) + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, sub_ctx->current_so->id); + } + vrend_destroy_streamout_object(obj); } } @@ -1358,7 +1358,7 @@ static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx) last_layer = (ctx->sub->zsurf->val1 >> 16) & 0xffff; vrend_fb_bind_texture(tex, 0, ctx->sub->zsurf->val0, - first_layer != last_layer ? 0xffffffff : first_layer); + first_layer != last_layer ? 0xffffffff : first_layer); } static void vrend_hw_set_color_surface(struct vrend_context *ctx, int index) @@ -1404,14 +1404,14 @@ static void vrend_hw_emit_framebuffer_state(struct vrend_context *ctx) struct vrend_surface *surf = NULL; int i; for (i = 0; i < ctx->sub->nr_cbufs; i++) { - if (ctx->sub->surf[i]) { - surf = ctx->sub->surf[i]; - } + if (ctx->sub->surf[i]) { + surf = ctx->sub->surf[i]; + } } if (util_format_is_srgb(surf->format)) { - glEnable(GL_FRAMEBUFFER_SRGB_EXT); + glEnable(GL_FRAMEBUFFER_SRGB_EXT); } else { - glDisable(GL_FRAMEBUFFER_SRGB_EXT); + glDisable(GL_FRAMEBUFFER_SRGB_EXT); } } glDrawBuffers(ctx->sub->nr_cbufs, buffers); @@ -1515,9 +1515,9 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx, * an FBO already so don't need to invert rendering? */ void vrend_set_viewport_states(struct vrend_context *ctx, - int start_slot, - int num_viewports, - const struct pipe_viewport_state *state) + int start_slot, + int num_viewports, + const struct pipe_viewport_state *state) { /* convert back to glViewport */ GLint x, y; @@ -1540,32 +1540,32 @@ void vrend_set_viewport_states(struct vrend_context *ctx, far_val = near_val + (state[i].scale[2] * 2.0); if (ctx->sub->vps[idx].cur_x != x || - ctx->sub->vps[idx].cur_y != y || - ctx->sub->vps[idx].width != width || - ctx->sub->vps[idx].height != height) { - ctx->sub->viewport_state_dirty |= (1 << idx); - ctx->sub->vps[idx].cur_x = x; - ctx->sub->vps[idx].cur_y = y; - ctx->sub->vps[idx].width = width; - ctx->sub->vps[idx].height = height; + ctx->sub->vps[idx].cur_y != y || + ctx->sub->vps[idx].width != width || + ctx->sub->vps[idx].height != height) { + ctx->sub->viewport_state_dirty |= (1 << idx); + ctx->sub->vps[idx].cur_x = x; + ctx->sub->vps[idx].cur_y = y; + ctx->sub->vps[idx].width = width; + ctx->sub->vps[idx].height = height; } if (idx == 0) { - if (ctx->sub->viewport_is_negative != viewport_is_negative) - ctx->sub->viewport_is_negative = viewport_is_negative; + if (ctx->sub->viewport_is_negative != viewport_is_negative) + ctx->sub->viewport_is_negative = viewport_is_negative; - ctx->sub->depth_scale = fabsf(far_val - near_val); - ctx->sub->depth_transform = near_val; + ctx->sub->depth_scale = fabsf(far_val - near_val); + ctx->sub->depth_transform = near_val; } if (ctx->sub->vps[idx].near_val != near_val || - ctx->sub->vps[idx].far_val != far_val) { - ctx->sub->vps[idx].near_val = near_val; - ctx->sub->vps[idx].far_val = far_val; - if (idx) - glDepthRangeIndexed(idx, ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val); - else - glDepthRange(ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val); + ctx->sub->vps[idx].far_val != far_val) { + ctx->sub->vps[idx].near_val = near_val; + ctx->sub->vps[idx].far_val = far_val; + if (idx) + glDepthRangeIndexed(idx, ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val); + else + glDepthRange(ctx->sub->vps[idx].near_val, ctx->sub->vps[idx].far_val); } } } @@ -1592,10 +1592,10 @@ int vrend_create_vertex_elements_state(struct vrend_context *ctx, type = GL_FALSE; if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) { - if (desc->channel[0].size == 32) - type = GL_FLOAT; - else if (desc->channel[0].size == 64) - type = GL_DOUBLE; + if (desc->channel[0].size == 32) + type = GL_FLOAT; + else if (desc->channel[0].size == 64) + type = GL_DOUBLE; else if (desc->channel[0].size == 16) type = GL_HALF_FLOAT; } else if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED && @@ -1625,7 +1625,7 @@ int vrend_create_vertex_elements_state(struct vrend_context *ctx, elements[i].src_format == PIPE_FORMAT_B10G10R10A2_UNORM) type = GL_UNSIGNED_INT_2_10_10_10_REV; else if (elements[i].src_format == PIPE_FORMAT_R11G11B10_FLOAT) - type = GL_UNSIGNED_INT_10F_11F_11F_REV; + type = GL_UNSIGNED_INT_10F_11F_11F_REV; if (type == GL_FALSE) { report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_VERTEX_FORMAT, elements[i].src_format); @@ -1639,7 +1639,7 @@ int vrend_create_vertex_elements_state(struct vrend_context *ctx, if (desc->nr_channels == 4 && desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_Z) v->elements[i].nr_chan = GL_BGRA; else if (elements[i].src_format == PIPE_FORMAT_R11G11B10_FLOAT) - v->elements[i].nr_chan = 3; + v->elements[i].nr_chan = 3; else v->elements[i].nr_chan = desc->nr_channels; } @@ -1654,9 +1654,9 @@ int vrend_create_vertex_elements_state(struct vrend_context *ctx, glVertexAttribIFormat(i, ve->nr_chan, ve->type, ve->base.src_offset); else glVertexAttribFormat(i, ve->nr_chan, ve->type, ve->norm, ve->base.src_offset); - glVertexAttribBinding(i, ve->base.vertex_buffer_index); - glVertexBindingDivisor(i, ve->base.instance_divisor); - glEnableVertexAttribArray(i); + glVertexAttribBinding(i, ve->base.vertex_buffer_index); + glVertexBindingDivisor(i, ve->base.instance_divisor); + glEnableVertexAttribArray(i); } } ret_handle = vrend_renderer_object_insert(ctx, v, sizeof(struct vrend_vertex_element), handle, @@ -1874,13 +1874,13 @@ void vrend_set_single_sampler_view(struct vrend_context *ctx, tex->cur_swizzle_a = view->gl_swizzle_a; } if (tex->srgb_decode != view->srgb_decode && util_format_is_srgb(tex->base.base.format)) { - if (vrend_state.have_samplers) - ctx->sub->sampler_state_dirty = true; - else { - glTexParameteri(view->texture->target, GL_TEXTURE_SRGB_DECODE_EXT, - view->srgb_decode); - tex->srgb_decode = view->srgb_decode; - } + if (vrend_state.have_samplers) + ctx->sub->sampler_state_dirty = true; + else { + glTexParameteri(view->texture->target, GL_TEXTURE_SRGB_DECODE_EXT, + view->srgb_decode); + tex->srgb_decode = view->srgb_decode; + } } } else { GLenum internalformat; @@ -2245,14 +2245,14 @@ static void vrend_update_scissor_state(struct vrend_context *ctx) idx = u_bit_scan(&mask); ss = &ctx->sub->ss[idx]; if (ctx->sub->viewport_is_negative) - y = ss->miny; + y = ss->miny; else - y = ss->miny; + y = ss->miny; if (idx > 0) - glScissorIndexed(idx, ss->minx, y, ss->maxx - ss->minx, ss->maxy - ss->miny); + glScissorIndexed(idx, ss->minx, y, ss->maxx - ss->minx, ss->maxy - ss->miny); else - glScissor(ss->minx, y, ss->maxx - ss->minx, ss->maxy - ss->miny); + glScissor(ss->minx, y, ss->maxx - ss->minx, ss->maxy - ss->miny); } ctx->sub->scissor_state_dirty = 0; } @@ -2266,13 +2266,13 @@ static void vrend_update_viewport_state(struct vrend_context *ctx) idx = u_bit_scan(&mask); if (ctx->sub->viewport_is_negative) - cy = ctx->sub->vps[idx].cur_y - ctx->sub->vps[idx].height; + cy = ctx->sub->vps[idx].cur_y - ctx->sub->vps[idx].height; else - cy = ctx->sub->vps[idx].cur_y; + cy = ctx->sub->vps[idx].cur_y; if (idx > 0) - glViewportIndexedf(idx, ctx->sub->vps[idx].cur_x, cy, ctx->sub->vps[idx].width, ctx->sub->vps[idx].height); + glViewportIndexedf(idx, ctx->sub->vps[idx].cur_x, cy, ctx->sub->vps[idx].width, ctx->sub->vps[idx].height); else - glViewport(ctx->sub->vps[idx].cur_x, cy, ctx->sub->vps[idx].width, ctx->sub->vps[idx].height); + glViewport(ctx->sub->vps[idx].cur_x, cy, ctx->sub->vps[idx].width, ctx->sub->vps[idx].height); } ctx->sub->viewport_state_dirty = 0; @@ -2420,7 +2420,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx, } static void vrend_draw_bind_vertex_binding(struct vrend_context *ctx, - struct vrend_vertex_element_array *va) + struct vrend_vertex_element_array *va) { int i; @@ -2428,17 +2428,17 @@ static void vrend_draw_bind_vertex_binding(struct vrend_context *ctx, if (ctx->sub->vbo_dirty) { for (i = 0; i < ctx->sub->num_vbos; i++) { - struct vrend_resource *res = (struct vrend_resource *)ctx->sub->vbo[i].buffer; - if (!res) - glBindVertexBuffer(i, 0, 0, 0); - else - glBindVertexBuffer(i, - res->id, - ctx->sub->vbo[i].buffer_offset, - ctx->sub->vbo[i].stride); + struct vrend_resource *res = (struct vrend_resource *)ctx->sub->vbo[i].buffer; + if (!res) + glBindVertexBuffer(i, 0, 0, 0); + else + glBindVertexBuffer(i, + res->id, + ctx->sub->vbo[i].buffer_offset, + ctx->sub->vbo[i].stride); } for (i = ctx->sub->num_vbos; i < ctx->sub->old_num_vbos; i++) { - glBindVertexBuffer(i, 0, 0, 0); + glBindVertexBuffer(i, 0, 0, 0); } ctx->sub->vbo_dirty = false; } @@ -2615,7 +2615,7 @@ void vrend_draw_vbo(struct vrend_context *ctx, for (shader_type = PIPE_SHADER_VERTEX; shader_type <= (ctx->sub->shaders[PIPE_SHADER_GEOMETRY] ? PIPE_SHADER_GEOMETRY : PIPE_SHADER_FRAGMENT); shader_type++) { if (ctx->sub->prog->const_locs[shader_type] && (ctx->sub->const_dirty[shader_type] || new_program)) { - int nc; + int nc; nc = ctx->sub->shaders[shader_type]->sinfo.num_consts; for (i = 0; i < nc; i++) { if (ctx->sub->prog->const_locs[shader_type][i] != -1 && ctx->sub->consts[shader_type].consts) @@ -2702,16 +2702,16 @@ void vrend_draw_vbo(struct vrend_context *ctx, } if (info->index_bias) { - if (info->instance_count > 1) + if (info->instance_count > 1) glDrawElementsInstancedBaseVertex(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->instance_count, info->index_bias); - else if (info->min_index != 0 || info->max_index != -1) + else if (info->min_index != 0 || info->max_index != -1) glDrawRangeElementsBaseVertex(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->index_bias); else glDrawElementsBaseVertex(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->index_bias); } else if (info->instance_count > 1) { glDrawElementsInstancedARB(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset, info->instance_count); } else if (info->min_index != 0 || info->max_index != -1) - glDrawRangeElements(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset); + glDrawRangeElements(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset); else glDrawElements(mode, info->count, elsz, (void *)(unsigned long)ctx->sub->ib.offset); } @@ -2947,7 +2947,7 @@ static void vrend_hw_emit_blend(struct vrend_context *ctx) vrend_blend_enable(ctx, true); } else - vrend_blend_enable(ctx, false); + vrend_blend_enable(ctx, false); if (state->rt[0].colormask != ctx->sub->hw_blend_state.rt[0].colormask) { int i; @@ -3523,9 +3523,9 @@ static void vrend_destroy_sub_context(struct vrend_sub_context *sub) if (!vrend_state.have_vertex_attrib_binding) { while (sub->enabled_attribs_bitmask) { - i = u_bit_scan(&sub->enabled_attribs_bitmask); + i = u_bit_scan(&sub->enabled_attribs_bitmask); - glDisableVertexAttribArray(i); + glDisableVertexAttribArray(i); } glDeleteVertexArrays(1, &sub->vaoid); } @@ -3980,17 +3980,17 @@ static void read_transfer_data(struct pipe_resource *res, vrend_read_from_iovec(iov, num_iovs, offset, data, send_size); else { if (invert) { - for (h = bh - 1; h >= 0; h--) { - void *ptr = data + (h * bwx); - vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx); - myoffset += src_stride; - } + for (h = bh - 1; h >= 0; h--) { + void *ptr = data + (h * bwx); + vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx); + myoffset += src_stride; + } } else { - for (h = 0; h < bh; h++) { - void *ptr = data + (h * bwx); - vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx); - myoffset += src_stride; - } + for (h = 0; h < bh; h++) { + void *ptr = data + (h * bwx); + vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx); + myoffset += src_stride; + } } } } @@ -4033,7 +4033,7 @@ static void write_transfer_data(struct pipe_resource *res, } static bool check_transfer_bounds(struct vrend_resource *res, - const struct vrend_transfer_info *info) + const struct vrend_transfer_info *info) { int lwidth, lheight; @@ -4061,26 +4061,26 @@ static bool check_transfer_bounds(struct vrend_resource *res, if (res->base.target == PIPE_TEXTURE_3D) { int ldepth = u_minify(res->base.depth0, info->level); if (info->box->depth > ldepth) - return false; + return false; if (info->box->z > ldepth) - return false; + return false; if (info->box->z + info->box->depth > ldepth) - return false; + return false; } else { if (info->box->depth > res->base.array_size) - return false; + return false; if (info->box->z > res->base.array_size) - return false; + return false; if (info->box->z + info->box->depth > res->base.array_size) - return false; + return false; } return true; } static bool check_iov_bounds(struct vrend_resource *res, - const struct vrend_transfer_info *info, - struct iovec *iov, int num_iovs) + const struct vrend_transfer_info *info, + struct iovec *iov, int num_iovs) { GLuint send_size; GLuint iovsize = vrend_get_iovec_size(iov, num_iovs); @@ -4184,7 +4184,7 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx, } if (vrend_state.use_core_profile == true && (res->y_0_top || (res->base.format == (enum pipe_format)VIRGL_FORMAT_Z24X8_UNORM))) { - need_temp = true; + need_temp = true; if (res->y_0_top) invert = true; } @@ -4333,9 +4333,9 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx, } static int vrend_transfer_send_getteximage(struct vrend_context *ctx, - struct vrend_resource *res, - struct iovec *iov, int num_iovs, - const struct vrend_transfer_info *info) + struct vrend_resource *res, + struct iovec *iov, int num_iovs, + const struct vrend_transfer_info *info) { GLenum format, type; uint32_t tex_size; @@ -4410,9 +4410,9 @@ static int vrend_transfer_send_getteximage(struct vrend_context *ctx, } static int vrend_transfer_send_readpixels(struct vrend_context *ctx, - struct vrend_resource *res, - struct iovec *iov, int num_iovs, - const struct vrend_transfer_info *info) + struct vrend_resource *res, + struct iovec *iov, int num_iovs, + const struct vrend_transfer_info *info) { void *myptr = iov[0].iov_base + info->offset; int need_temp = 0; @@ -4530,9 +4530,9 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx, } static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx, - struct vrend_resource *res, - struct iovec *iov, int num_iovs, - const struct vrend_transfer_info *info) + struct vrend_resource *res, + struct iovec *iov, int num_iovs, + const struct vrend_transfer_info *info) { if (res->target == 0 && res->ptr) { uint32_t send_size = info->box->width * util_format_get_blocksize(res->base.format); @@ -4562,18 +4562,18 @@ static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx, if (can_readpixels) { return vrend_transfer_send_readpixels(ctx, res, - iov, num_iovs, info); + iov, num_iovs, info); } return vrend_transfer_send_getteximage(ctx, res, - iov, num_iovs, info); + iov, num_iovs, info); } return 0; } int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info, - int transfer_mode) + int transfer_mode) { struct vrend_resource *res; struct vrend_context *ctx; @@ -4594,7 +4594,7 @@ int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info, if (!res) { if (info->ctx_id) - report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, info->handle); + report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, info->handle); return EINVAL; } @@ -4608,7 +4608,7 @@ int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info, if (!iov) { if (info->ctx_id) - report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, info->handle); + report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, info->handle); return EINVAL; } @@ -4622,15 +4622,15 @@ int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info, if (transfer_mode == VREND_TRANSFER_WRITE) return vrend_renderer_transfer_write_iov(ctx, res, iov, num_iovs, - info); + info); else return vrend_renderer_transfer_send_iov(ctx, res, iov, num_iovs, - info); + info); } int vrend_transfer_inline_write(struct vrend_context *ctx, - struct vrend_transfer_info *info, - unsigned usage) + struct vrend_transfer_info *info, + unsigned usage) { struct vrend_resource *res; @@ -4673,8 +4673,8 @@ void vrend_set_blend_color(struct vrend_context *ctx, } void vrend_set_scissor_state(struct vrend_context *ctx, - int start_slot, - int num_scissor, + int start_slot, + int num_scissor, struct pipe_scissor_state *ss) { int i, idx; @@ -4763,17 +4763,17 @@ void vrend_set_streamout_targets(struct vrend_context *ctx, bool found = false; struct vrend_streamout_object *obj; LIST_FOR_EACH_ENTRY(obj, &ctx->sub->streamout_list, head) { - if (obj->num_targets == num_targets) { - if (!memcmp(handles, obj->handles, num_targets * 4)) { - found = true; - break; - } - } + if (obj->num_targets == num_targets) { + if (!memcmp(handles, obj->handles, num_targets * 4)) { + found = true; + break; + } + } } if (found) { ctx->sub->current_so = obj; - glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, obj->id); - return; + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, obj->id); + return; } obj = CALLOC_STRUCT(vrend_streamout_object); @@ -4783,13 +4783,13 @@ void vrend_set_streamout_targets(struct vrend_context *ctx, } obj->num_targets = num_targets; for (i = 0; i < num_targets; i++) { - obj->handles[i] = handles[i]; - target = vrend_object_lookup(ctx->sub->object_hash, handles[i], VIRGL_OBJECT_STREAMOUT_TARGET); - if (!target) { - report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_HANDLE, handles[i]); - return; - } - vrend_so_target_reference(&obj->so_targets[i], target); + obj->handles[i] = handles[i]; + target = vrend_object_lookup(ctx->sub->object_hash, handles[i], VIRGL_OBJECT_STREAMOUT_TARGET); + if (!target) { + report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_HANDLE, handles[i]); + return; + } + vrend_so_target_reference(&obj->so_targets[i], target); } vrend_hw_emit_streamout_targets(ctx, obj); list_addtail(&obj->head, &ctx->sub->streamout_list); @@ -5877,7 +5877,7 @@ void vrend_renderer_create_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) LIST_FOR_EACH_ENTRY(sub, &ctx->sub_ctxs, head) { if (sub->sub_ctx_id == sub_ctx_id) { - return; + return; } } @@ -5922,14 +5922,14 @@ void vrend_renderer_destroy_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) LIST_FOR_EACH_ENTRY(sub, &ctx->sub_ctxs, head) { if (sub->sub_ctx_id == sub_ctx_id) { - tofree = sub; + tofree = sub; } } if (tofree) { if (ctx->sub == tofree) { ctx->sub = ctx->sub0; - vrend_clicbs->make_current(0, ctx->sub->gl_context); + vrend_clicbs->make_current(0, ctx->sub->gl_context); } vrend_destroy_sub_context(tofree); } @@ -5945,9 +5945,9 @@ void vrend_renderer_set_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) LIST_FOR_EACH_ENTRY(sub, &ctx->sub_ctxs, head) { if (sub->sub_ctx_id == sub_ctx_id) { - ctx->sub = sub; - vrend_clicbs->make_current(0, sub->gl_context); - break; + ctx->sub = sub; + vrend_clicbs->make_current(0, sub->gl_context); + break; } } } diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index e4973ae..6efa05e 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -202,12 +202,12 @@ void vrend_set_num_vbo(struct vrend_context *ctx, int num_vbo); int vrend_transfer_inline_write(struct vrend_context *ctx, - struct vrend_transfer_info *info, - unsigned usage); + struct vrend_transfer_info *info, + unsigned usage); void vrend_set_viewport_states(struct vrend_context *ctx, - int start_slot, int num_viewports, - const struct pipe_viewport_state *state); + int start_slot, int num_viewports, + const struct pipe_viewport_state *state); void vrend_set_num_sampler_views(struct vrend_context *ctx, uint32_t shader_type, uint32_t start_slot, @@ -251,9 +251,9 @@ void vrend_renderer_blit(struct vrend_context *ctx, void vrend_set_stencil_ref(struct vrend_context *ctx, struct pipe_stencil_ref *ref); void vrend_set_blend_color(struct vrend_context *ctx, struct pipe_blend_color *color); void vrend_set_scissor_state(struct vrend_context *ctx, - int start_slot, - int num_scissor, - struct pipe_scissor_state *ss); + int start_slot, + int num_scissor, + struct pipe_scissor_state *ss); void vrend_set_polygon_stipple(struct vrend_context *ctx, struct pipe_poly_stipple *ps); @@ -312,8 +312,8 @@ void vrend_build_format_list(void); int vrend_renderer_resource_attach_iov(int res_handle, struct iovec *iov, int num_iovs); void vrend_renderer_resource_detach_iov(int res_handle, - struct iovec **iov_p, - int *num_iovs_p); + struct iovec **iov_p, + int *num_iovs_p); void vrend_renderer_resource_destroy(struct vrend_resource *res, bool remove); static inline void diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 34e5bfa..46cc05b 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -37,11 +37,11 @@ extern int vrend_dump_shaders; #define INTERP_PREFIX " " struct vrend_shader_io { - unsigned name; - unsigned gpr; - unsigned done; - int sid; - unsigned interpolate; + unsigned name; + unsigned gpr; + unsigned done; + int sid; + unsigned interpolate; unsigned first; bool centroid; bool glsl_predefined_no_emit; @@ -864,19 +864,19 @@ static int emit_buf(struct dump_ctx *ctx, char *buf) return sret ? 0 : ENOMEM; } -#define EMIT_BUF_WITH_RET(ctx, buf) do { \ - int ret = emit_buf((ctx), (buf)); \ - if (ret) return FALSE; \ +#define EMIT_BUF_WITH_RET(ctx, buf) do { \ + int ret = emit_buf((ctx), (buf)); \ + if (ret) return FALSE; \ } while(0) static int translate_tex(struct dump_ctx *ctx, - struct tgsi_full_instruction *inst, - int sreg_index, - char srcs[4][255], - char dsts[3][255], - const char *writemask, - const char *dstconv, - const char *dtypeprefix) + struct tgsi_full_instruction *inst, + int sreg_index, + char srcs[4][255], + char dsts[3][255], + const char *writemask, + const char *dstconv, + const char *dtypeprefix) { char *twm, *gwm = NULL, *txfi; bool is_shad = false; @@ -1846,7 +1846,7 @@ prolog(struct tgsi_iterate_context *iter) } #define STRCAT_WITH_RET(mainstr, buf) do { \ - (mainstr) = strcat_realloc((mainstr), (buf)); \ + (mainstr) = strcat_realloc((mainstr), (buf)); \ if ((mainstr) == NULL) return NULL; \ } while(0) @@ -2295,8 +2295,8 @@ static void replace_interp(char *program, } bool vrend_patch_vertex_shader_interpolants(char *program, - struct vrend_shader_info *vs_info, - struct vrend_shader_info *fs_info, bool is_gs, bool flatshade) + struct vrend_shader_info *vs_info, + struct vrend_shader_info *fs_info, bool is_gs, bool flatshade) { int i; const char *pstring; diff --git a/src/vrend_shader.h b/src/vrend_shader.h index 4ccb9a3..be506cb 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -72,9 +72,9 @@ struct vrend_shader_cfg { }; bool vrend_patch_vertex_shader_interpolants(char *program, - struct vrend_shader_info *vs_info, - struct vrend_shader_info *fs_info, - bool is_gs, bool flatshade); + struct vrend_shader_info *vs_info, + struct vrend_shader_info *fs_info, + bool is_gs, bool flatshade); char *vrend_convert_shader(struct vrend_shader_cfg *cfg, const struct tgsi_token *tokens,