Lines Matching +full:data +full:- +full:sheet
3 * SPDX-License-Identifier: GPL-2.0 OR MIT
37 return (tmp > (uint64_t) ((u32) -1)) ? (u32) -1 : tmp; in clamped_umul32()
41 * vmw_surface_get_desc - Look up the appropriate SVGA3dSurfaceDesc for the
54 * vmw_surface_get_mip_size - Given a base level size and the mip level,
74 block_size->width = __KERNEL_DIV_ROUND_UP(pixel_size->width, in vmw_surface_get_size_in_blocks()
75 desc->blockSize.width); in vmw_surface_get_size_in_blocks()
76 block_size->height = __KERNEL_DIV_ROUND_UP(pixel_size->height, in vmw_surface_get_size_in_blocks()
77 desc->blockSize.height); in vmw_surface_get_size_in_blocks()
78 block_size->depth = __KERNEL_DIV_ROUND_UP(pixel_size->depth, in vmw_surface_get_size_in_blocks()
79 desc->blockSize.depth); in vmw_surface_get_size_in_blocks()
85 return (desc->blockDesc & SVGA3DBLOCKDESC_PLANAR_YUV) != 0; in vmw_surface_is_planar_surface()
97 pitch = blocks.width * desc->pitchBytesPerBlock; in vmw_surface_calculate_pitch()
103 * vmw_surface_get_image_buffer_size - Calculates image buffer size.
110 * This function is overflow-safe. If the result would have overflowed, instead
127 total_size = clamped_umul32(total_size, desc->bytesPerBlock); in vmw_surface_get_image_buffer_size()
141 * vmw_surface_get_serialized_size - Get the serialized size for the image.
164 * vmw_surface_get_serialized_size_extended - Returns the number of bytes
185 * vmw_surface_get_pixel_offset - Compute the offset (in bytes) to a pixel
197 const u32 bw = desc->blockSize.width, bh = desc->blockSize.height; in vmw_surface_get_pixel_offset()
198 const u32 bd = desc->blockSize.depth; in vmw_surface_get_pixel_offset()
200 desc->bytesPerBlock; in vmw_surface_get_pixel_offset()
204 x / bw * desc->bytesPerBlock); in vmw_surface_get_pixel_offset()
243 * vmw_surface_is_gb_screen_target_format - Is the specified format usable as
245 * (with just the GBObjects cap-bit
265 * vmw_surface_is_dx_screen_target_format - Is the specified format usable as
284 * vmw_surface_is_screen_target_format - Is the specified format usable as a
303 * struct vmw_surface_mip - Mimpmap level information
318 * struct vmw_surface_cache - Cached surface information
323 * @sheet_bytes: Bytes required in the backing store for a sheet
340 * struct vmw_surface_loc - Surface location
341 * @sheet: The multisample sheet.
349 u32 sheet; member
355 * vmw_surface_subres - Compute the subresource from layer and mipmap.
356 * @cache: Surface layout data.
365 return cache->num_mip_levels * layer + mip_level; in vmw_surface_subres()
369 * vmw_surface_setup_cache - Build a surface cache entry
376 * Return: Zero on success, -EINVAL on invalid surface layout.
389 cache->desc = desc = vmw_surface_get_desc(format); in vmw_surface_setup_cache()
390 cache->num_mip_levels = num_mip_levels; in vmw_surface_setup_cache()
391 cache->num_layers = num_layers; in vmw_surface_setup_cache()
392 for (i = 0; i < cache->num_mip_levels; i++) { in vmw_surface_setup_cache()
393 struct vmw_surface_mip *mip = &cache->mip[i]; in vmw_surface_setup_cache()
395 mip->size = vmw_surface_get_mip_size(*size, i); in vmw_surface_setup_cache()
396 mip->bytes = vmw_surface_get_image_buffer_size in vmw_surface_setup_cache()
397 (desc, &mip->size, 0); in vmw_surface_setup_cache()
398 mip->row_stride = in vmw_surface_setup_cache()
399 __KERNEL_DIV_ROUND_UP(mip->size.width, in vmw_surface_setup_cache()
400 desc->blockSize.width) * in vmw_surface_setup_cache()
401 desc->bytesPerBlock * num_samples; in vmw_surface_setup_cache()
402 if (!mip->row_stride) in vmw_surface_setup_cache()
405 mip->img_stride = in vmw_surface_setup_cache()
406 __KERNEL_DIV_ROUND_UP(mip->size.height, in vmw_surface_setup_cache()
407 desc->blockSize.height) * in vmw_surface_setup_cache()
408 mip->row_stride; in vmw_surface_setup_cache()
409 if (!mip->img_stride) in vmw_surface_setup_cache()
412 cache->mip_chain_bytes += mip->bytes; in vmw_surface_setup_cache()
414 cache->sheet_bytes = cache->mip_chain_bytes * num_layers; in vmw_surface_setup_cache()
415 if (!cache->sheet_bytes) in vmw_surface_setup_cache()
422 return -EINVAL; in vmw_surface_setup_cache()
426 * vmw_surface_get_loc - Get a surface location from an offset into the
428 * @cache: Surface layout data.
437 const struct vmw_surface_mip *mip = &cache->mip[0]; in vmw_surface_get_loc()
438 const SVGA3dSurfaceDesc *desc = cache->desc; in vmw_surface_get_loc()
442 loc->sheet = offset / cache->sheet_bytes; in vmw_surface_get_loc()
443 offset -= loc->sheet * cache->sheet_bytes; in vmw_surface_get_loc()
445 layer = offset / cache->mip_chain_bytes; in vmw_surface_get_loc()
446 offset -= layer * cache->mip_chain_bytes; in vmw_surface_get_loc()
447 for (i = 0; i < cache->num_mip_levels; ++i, ++mip) { in vmw_surface_get_loc()
448 if (mip->bytes > offset) in vmw_surface_get_loc()
450 offset -= mip->bytes; in vmw_surface_get_loc()
453 loc->sub_resource = vmw_surface_subres(cache, i, layer); in vmw_surface_get_loc()
454 loc->z = offset / mip->img_stride; in vmw_surface_get_loc()
455 offset -= loc->z * mip->img_stride; in vmw_surface_get_loc()
456 loc->z *= desc->blockSize.depth; in vmw_surface_get_loc()
457 loc->y = offset / mip->row_stride; in vmw_surface_get_loc()
458 offset -= loc->y * mip->row_stride; in vmw_surface_get_loc()
459 loc->y *= desc->blockSize.height; in vmw_surface_get_loc()
460 loc->x = offset / desc->bytesPerBlock; in vmw_surface_get_loc()
461 loc->x *= desc->blockSize.width; in vmw_surface_get_loc()
465 * vmw_surface_inc_loc - Clamp increment a surface location with one block
470 * When computing the size of a range as size = end - start, the range does not
480 const SVGA3dSurfaceDesc *desc = cache->desc; in vmw_surface_inc_loc()
481 u32 mip = loc->sub_resource % cache->num_mip_levels; in vmw_surface_inc_loc()
482 const struct drm_vmw_size *size = &cache->mip[mip].size; in vmw_surface_inc_loc()
484 loc->sub_resource++; in vmw_surface_inc_loc()
485 loc->x += desc->blockSize.width; in vmw_surface_inc_loc()
486 if (loc->x > size->width) in vmw_surface_inc_loc()
487 loc->x = size->width; in vmw_surface_inc_loc()
488 loc->y += desc->blockSize.height; in vmw_surface_inc_loc()
489 if (loc->y > size->height) in vmw_surface_inc_loc()
490 loc->y = size->height; in vmw_surface_inc_loc()
491 loc->z += desc->blockSize.depth; in vmw_surface_inc_loc()
492 if (loc->z > size->depth) in vmw_surface_inc_loc()
493 loc->z = size->depth; in vmw_surface_inc_loc()
497 * vmw_surface_min_loc - The start location in a subresource
498 * @cache: Surface layout data.
507 loc->sheet = 0; in vmw_surface_min_loc()
508 loc->sub_resource = sub_resource; in vmw_surface_min_loc()
509 loc->x = loc->y = loc->z = 0; in vmw_surface_min_loc()
513 * vmw_surface_min_loc - The end location in a subresource
514 * @cache: Surface layout data.
529 loc->sheet = 0; in vmw_surface_max_loc()
530 loc->sub_resource = sub_resource + 1; in vmw_surface_max_loc()
531 mip = sub_resource % cache->num_mip_levels; in vmw_surface_max_loc()
532 size = &cache->mip[mip].size; in vmw_surface_max_loc()
533 loc->x = size->width; in vmw_surface_max_loc()
534 loc->y = size->height; in vmw_surface_max_loc()
535 loc->z = size->depth; in vmw_surface_max_loc()