• Home
  • Raw
  • Download

Lines Matching refs:res

148         Resource const* res = it.second;  in dump_global_state()  local
153 res->args.handle, res->args.width, res->args.height, res->args.format, in dump_global_state()
154 res->iov ? res->iov[0].iov_base : nullptr, res->iov ? res->iov[0].iov_len : 0, in dump_global_state()
155 res->args.target, res->args.bind, res->args.depth, res->args.array_size, in dump_global_state()
156 res->args.last_level, res->args.nr_samples, res->args.flags); in dump_global_state()
158 for (auto const& it : res->context_map) { in dump_global_state()
173 Resource const* res = it.second; in dump_global_state() local
175 printf(" Resource %u\n", res->args.handle); in dump_global_state()
180 static int sync_linear_to_iovec(Resource* res, uint64_t offset, const virgl_box* box) { in sync_linear_to_iovec() argument
182 switch (res->args.format) { in sync_linear_to_iovec()
194 if (box->x > res->args.width || box->y > res->args.height) in sync_linear_to_iovec()
198 uint32_t w = std::min(box->w, res->args.width - box->x); in sync_linear_to_iovec()
199 uint32_t h = std::min(box->h, res->args.height - box->y); in sync_linear_to_iovec()
200 uint32_t stride = ALIGN(res->args.width * bpp, 16U); in sync_linear_to_iovec()
203 if (offset + length > res->linearSize) in sync_linear_to_iovec()
206 if (res->num_iovs > 1) { in sync_linear_to_iovec()
207 const char* linear = static_cast<const char*>(res->linear); in sync_linear_to_iovec()
208 for (uint32_t i = 0, iovOffset = 0U; length && i < res->num_iovs; i++) { in sync_linear_to_iovec()
209 if (iovOffset + res->iov[i].iov_len > offset) { in sync_linear_to_iovec()
210 char* iov_base = static_cast<char*>(res->iov[i].iov_base); in sync_linear_to_iovec()
211 size_t copyLength = std::min(length, res->iov[i].iov_len); in sync_linear_to_iovec()
217 iovOffset += res->iov[i].iov_len; in sync_linear_to_iovec()
224 static int sync_iovec_to_linear(Resource* res, uint64_t offset, const virgl_box* box) { in sync_iovec_to_linear() argument
226 switch (res->args.format) { in sync_iovec_to_linear()
238 if (box->x > res->args.width || box->y > res->args.height) in sync_iovec_to_linear()
242 uint32_t w = std::min(box->w, res->args.width - box->x); in sync_iovec_to_linear()
243 uint32_t h = std::min(box->h, res->args.height - box->y); in sync_iovec_to_linear()
244 uint32_t stride = ALIGN(res->args.width * bpp, 16U); in sync_iovec_to_linear()
247 if (offset + length > res->linearSize) in sync_iovec_to_linear()
250 if (res->num_iovs > 1) { in sync_iovec_to_linear()
251 char* linear = static_cast<char*>(res->linear); in sync_iovec_to_linear()
252 for (uint32_t i = 0, iovOffset = 0U; length && i < res->num_iovs; i++) { in sync_iovec_to_linear()
253 if (iovOffset + res->iov[i].iov_len > offset) { in sync_iovec_to_linear()
254 const char* iov_base = static_cast<const char*>(res->iov[i].iov_base); in sync_iovec_to_linear()
255 size_t copyLength = std::min(length, res->iov[i].iov_len); in sync_iovec_to_linear()
261 iovOffset += res->iov[i].iov_len; in sync_iovec_to_linear()
479 Resource* res = it->second; in virgl_renderer_get_cursor_data() local
480 if (res->args.bind != VIRGL_RES_BIND_CURSOR) in virgl_renderer_get_cursor_data()
483 void* pixels = malloc(res->linearSize); in virgl_renderer_get_cursor_data()
484 memcpy(pixels, res->linear, res->linearSize); in virgl_renderer_get_cursor_data()
485 *height = res->args.height; in virgl_renderer_get_cursor_data()
486 *width = res->args.width; in virgl_renderer_get_cursor_data()
589 Resource* res = it->second; in virgl_renderer_submit_cmd() local
591 for (size_t i = 0; i < res->num_iovs; i++) in virgl_renderer_submit_cmd()
592 cmdRespBufSize += res->iov[i].iov_len; in virgl_renderer_submit_cmd()
594 ctx->cmd_resp = res; in virgl_renderer_submit_cmd()
835 Resource* res = new (std::nothrow) Resource(args, num_iovs, iov); in virgl_renderer_resource_create() local
836 if (!res) in virgl_renderer_resource_create()
850 Resource* res = it->second; in virgl_renderer_resource_unref() local
855 virgl_renderer_ctx_detach_resource(ctx->handle, res->args.handle); in virgl_renderer_resource_unref()
858 assert(res->context_map.empty() && "Deleted resource was associated with contexts"); in virgl_renderer_resource_unref()
861 delete res; in virgl_renderer_resource_unref()
871 Resource* res = it->second; in virgl_renderer_resource_attach_iov() local
873 if (!res->iov) { in virgl_renderer_resource_attach_iov()
879 res->num_iovs = num_iovs; in virgl_renderer_resource_attach_iov()
880 res->iov = iov; in virgl_renderer_resource_attach_iov()
882 res->reallocLinear(); in virgl_renderer_resource_attach_iov()
898 Resource* res = it->second; in virgl_renderer_resource_detach_iov() local
905 .w = res->args.width, in virgl_renderer_resource_detach_iov()
906 .h = res->args.height, in virgl_renderer_resource_detach_iov()
908 sync_linear_to_iovec(res, 0, &box); in virgl_renderer_resource_detach_iov()
911 *num_iovs = res->num_iovs; in virgl_renderer_resource_detach_iov()
912 res->num_iovs = 0U; in virgl_renderer_resource_detach_iov()
915 *iov = res->iov; in virgl_renderer_resource_detach_iov()
916 res->iov = nullptr; in virgl_renderer_resource_detach_iov()
918 res->reallocLinear(); in virgl_renderer_resource_detach_iov()
931 Resource* res = it->second; in virgl_renderer_resource_get_info() local
934 switch (res->args.format) { in virgl_renderer_resource_get_info()
955 switch (res->args.format) { in virgl_renderer_resource_get_info()
968 if (!res->tex_id) { in virgl_renderer_resource_get_info()
969 g_glGenTextures(1, &res->tex_id); in virgl_renderer_resource_get_info()
970 g_glBindTexture(GL_TEXTURE_2D, res->tex_id); in virgl_renderer_resource_get_info()
976 g_glBindTexture(GL_TEXTURE_2D, res->tex_id); in virgl_renderer_resource_get_info()
979 g_glPixelStorei(GL_UNPACK_ROW_LENGTH, ALIGN(res->args.width, 16)); in virgl_renderer_resource_get_info()
980 g_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, res->args.width, res->args.height, 0, format, type, in virgl_renderer_resource_get_info()
981 res->linear); in virgl_renderer_resource_get_info()
984 info->stride = ALIGN(res->args.width * bpp, 16U); in virgl_renderer_resource_get_info()
985 info->virgl_format = res->args.format; in virgl_renderer_resource_get_info()
986 info->handle = res->args.handle; in virgl_renderer_resource_get_info()
987 info->height = res->args.height; in virgl_renderer_resource_get_info()
988 info->width = res->args.width; in virgl_renderer_resource_get_info()
989 info->depth = res->args.depth; in virgl_renderer_resource_get_info()
990 info->flags = res->args.flags; in virgl_renderer_resource_get_info()
991 info->tex_id = res->tex_id; in virgl_renderer_resource_get_info()
1067 Resource* res = res_it->second; in virgl_renderer_ctx_attach_resource() local
1070 res->context_map.emplace((uint32_t)ctx_id, ctx); in virgl_renderer_ctx_attach_resource()
1071 ctx->resource_map.emplace((uint32_t)res_handle, res); in virgl_renderer_ctx_attach_resource()
1089 Resource* res = res_it->second; in virgl_renderer_ctx_detach_resource() local
1091 ctx_it = res->context_map.find((uint32_t)ctx_id); in virgl_renderer_ctx_detach_resource()
1092 if (ctx_it == res->context_map.end()) in virgl_renderer_ctx_detach_resource()
1099 res->context_map.erase(ctx_it); in virgl_renderer_ctx_detach_resource()