vrend: skip texture size check for gbm-only resources

Gbm-resources can be used for data blobs. These are created with a
height of 1 and the required width, which can easily exceed the maximum
supported texture width.

Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
David Stevens 5 years ago committed by Gurchetan Singh
parent a81147cf4d
commit b9ecaac78a
  1. 9
      src/virgl_gbm.c
  2. 3
      src/virgl_gbm.h
  3. 10
      src/vrend_renderer.c

@ -483,3 +483,12 @@ int virgl_gbm_get_plane_bytes_per_pixel(struct gbm_bo *bo, int plane) {
return -1; return -1;
return layout->bytes_per_pixel[plane]; return layout->bytes_per_pixel[plane];
} }
bool virgl_gbm_external_allocation_preferred(uint32_t flags) {
return (flags & (VIRGL_RES_BIND_SCANOUT | VIRGL_RES_BIND_SHARED)) != 0;
}
bool virgl_gbm_gpu_import_required(uint32_t flags) {
return !virgl_gbm_external_allocation_preferred(flags) ||
(flags & (VIRGL_BIND_RENDER_TARGET | VIRGL_BIND_SAMPLER_VIEW)) != 0;
}

@ -64,4 +64,7 @@ int virgl_gbm_get_plane_width(struct gbm_bo *bo, int plane);
int virgl_gbm_get_plane_height(struct gbm_bo *bo, int plane); int virgl_gbm_get_plane_height(struct gbm_bo *bo, int plane);
int virgl_gbm_get_plane_bytes_per_pixel(struct gbm_bo *bo, int plane); int virgl_gbm_get_plane_bytes_per_pixel(struct gbm_bo *bo, int plane);
bool virgl_gbm_external_allocation_preferred(uint32_t flags);
bool virgl_gbm_gpu_import_required(uint32_t flags);
#endif #endif

@ -6203,6 +6203,12 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
return -1; return -1;
} }
#ifdef ENABLE_GBM_ALLOCATION
if (!virgl_gbm_gpu_import_required(args->bind)) {
return 0;
}
#endif
if (args->target == PIPE_TEXTURE_2D || if (args->target == PIPE_TEXTURE_2D ||
args->target == PIPE_TEXTURE_RECT || args->target == PIPE_TEXTURE_RECT ||
args->target == PIPE_TEXTURE_CUBE || args->target == PIPE_TEXTURE_CUBE ||
@ -6331,7 +6337,7 @@ static void vrend_resource_gbm_init(struct vrend_resource *gr)
if (!gbm || !gbm->device || !gbm_format || !gbm_flags) if (!gbm || !gbm->device || !gbm_format || !gbm_flags)
return; return;
if ((gr->base.bind & (VIRGL_RES_BIND_SCANOUT | VIRGL_RES_BIND_SHARED)) == 0) if (!virgl_gbm_external_allocation_preferred(gr->base.bind))
return; return;
if (!gbm_device_is_format_supported(gbm->device, gbm_format, gbm_flags)) if (!gbm_device_is_format_supported(gbm->device, gbm_format, gbm_flags))
@ -6343,7 +6349,7 @@ static void vrend_resource_gbm_init(struct vrend_resource *gr)
return; return;
gr->gbm_bo = bo; gr->gbm_bo = bo;
if ((gr->base.bind & (VIRGL_BIND_RENDER_TARGET | VIRGL_BIND_SAMPLER_VIEW)) == 0) { if (!virgl_gbm_gpu_import_required(gr->base.bind)) {
gr->storage = VREND_RESOURCE_STORAGE_GBM_ONLY; gr->storage = VREND_RESOURCE_STORAGE_GBM_ONLY;
return; return;
} }

Loading…
Cancel
Save