Fix: Video PlayBack
AOSP requires lock_ybcr() for video playback or else EGL image wouldn't form(black screen while playing video) and gives error EGLImage: Error: 0x3000 and in some cases, a crash and a surfaceFlinger restart. To resolve this, U_gralloc element needs to be built with -dFlag Imapper4_API and Imapper5.c, which exposes the required API for gralloc to consider video buffer from hwaccel or even swaccel vid decoders.
This commit is contained in:
parent
809f6758c3
commit
4f43376654
7 changed files with 4140 additions and 23 deletions
17
Android.bp
17
Android.bp
|
|
@ -1816,7 +1816,7 @@ cc_library_shared {
|
||||||
"meson_generated/src/panfrost/vulkan/panvk_tracepoints.c",
|
"meson_generated/src/panfrost/vulkan/panvk_tracepoints.c",
|
||||||
],
|
],
|
||||||
cflags: ["-DVK_USE_PLATFORM_ANDROID_KHR"],
|
cflags: ["-DVK_USE_PLATFORM_ANDROID_KHR"],
|
||||||
ldflags: ["-Wl,--build-id=sha1"],
|
ldflags: ["-Wl,--build-id=sha1","-Wl,-Bsymbolic",],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libcutils",
|
"libcutils",
|
||||||
"libdrm",
|
"libdrm",
|
||||||
|
|
@ -1824,6 +1824,7 @@ cc_library_shared {
|
||||||
"liblog",
|
"liblog",
|
||||||
"libnativewindow",
|
"libnativewindow",
|
||||||
"libsync",
|
"libsync",
|
||||||
|
"libui",
|
||||||
"libz",
|
"libz",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
|
@ -2135,7 +2136,11 @@ cc_library_static {
|
||||||
|
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "mesa3d-panfrost_src_util_u_gralloc_lib_mesa_u_gralloc_a",
|
name: "mesa3d-panfrost_src_util_u_gralloc_lib_mesa_u_gralloc_a",
|
||||||
srcs: ["src/util/u_gralloc/*.c"],
|
srcs: ["src/util/u_gralloc/*.c",
|
||||||
|
"src/util/u_gralloc/u_gralloc_imapper5_api.cpp",
|
||||||
|
],
|
||||||
|
cflags: ["-DUSE_IMAPPER4_METADATA_API"],
|
||||||
|
shared_libs: ["libui"],
|
||||||
local_include_dirs: [
|
local_include_dirs: [
|
||||||
"include",
|
"include",
|
||||||
"include/android_stub",
|
"include/android_stub",
|
||||||
|
|
@ -3905,6 +3910,7 @@ cc_library_shared {
|
||||||
"-DHAVE_MINCORE",
|
"-DHAVE_MINCORE",
|
||||||
"-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID",
|
"-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID",
|
||||||
],
|
],
|
||||||
|
ldflags: ["-Wl,-Bsymbolic"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libcutils",
|
"libcutils",
|
||||||
"libdrm",
|
"libdrm",
|
||||||
|
|
@ -3913,6 +3919,7 @@ cc_library_shared {
|
||||||
"liblog",
|
"liblog",
|
||||||
"libnativewindow",
|
"libnativewindow",
|
||||||
"libsync",
|
"libsync",
|
||||||
|
"libui",
|
||||||
"libz",
|
"libz",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
|
@ -3946,7 +3953,9 @@ cc_library_shared {
|
||||||
"meson_generated/src/util",
|
"meson_generated/src/util",
|
||||||
"meson_generated/src/util/format",
|
"meson_generated/src/util/format",
|
||||||
],
|
],
|
||||||
|
|
||||||
relative_install_path: "egl",
|
relative_install_path: "egl",
|
||||||
|
header_libs: ["libnativebase_headers"],
|
||||||
defaults: ["mesa3d-desktop-panvk-defaults"],
|
defaults: ["mesa3d-desktop-panvk-defaults"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4039,14 +4048,14 @@ cc_defaults {
|
||||||
"-DTHREAD_SANITIZER=0",
|
"-DTHREAD_SANITIZER=0",
|
||||||
"-DUSE_GCC_ATOMIC_BUILTINS",
|
"-DUSE_GCC_ATOMIC_BUILTINS",
|
||||||
"-DUSE_LIBGLVND=0",
|
"-DUSE_LIBGLVND=0",
|
||||||
"-DVIDEO_CODEC_AV1DEC=0",
|
"-DVIDEO_CODEC_AV1DEC=1",
|
||||||
"-DVIDEO_CODEC_AV1ENC=0",
|
"-DVIDEO_CODEC_AV1ENC=0",
|
||||||
"-DVIDEO_CODEC_H264DEC=0",
|
"-DVIDEO_CODEC_H264DEC=0",
|
||||||
"-DVIDEO_CODEC_H264ENC=0",
|
"-DVIDEO_CODEC_H264ENC=0",
|
||||||
"-DVIDEO_CODEC_H265DEC=0",
|
"-DVIDEO_CODEC_H265DEC=0",
|
||||||
"-DVIDEO_CODEC_H265ENC=0",
|
"-DVIDEO_CODEC_H265ENC=0",
|
||||||
"-DVIDEO_CODEC_VC1DEC=0",
|
"-DVIDEO_CODEC_VC1DEC=0",
|
||||||
"-DVIDEO_CODEC_VP9DEC=0",
|
"-DVIDEO_CODEC_VP9DEC=1",
|
||||||
"-D_FILE_OFFSET_BITS=64",
|
"-D_FILE_OFFSET_BITS=64",
|
||||||
"-D_GNU_SOURCE",
|
"-D_GNU_SOURCE",
|
||||||
"-D__STDC_CONSTANT_MACROS",
|
"-D__STDC_CONSTANT_MACROS",
|
||||||
|
|
|
||||||
4077
Android.bp.disabled
Normal file
4077
Android.bp.disabled
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -292,7 +292,8 @@ struct dri2_egl_display {
|
||||||
#ifdef HAVE_ANDROID_PLATFORM
|
#ifdef HAVE_ANDROID_PLATFORM
|
||||||
struct u_gralloc *gralloc;
|
struct u_gralloc *gralloc;
|
||||||
/* gralloc vendor usage bit for front rendering */
|
/* gralloc vendor usage bit for front rendering */
|
||||||
uint32_t front_rendering_usage;
|
//uint32_t front_rendering_usage;
|
||||||
|
uint64_t front_rendering_usage;
|
||||||
bool has_native_fence_fd;
|
bool has_native_fence_fd;
|
||||||
bool pure_swrast;
|
bool pure_swrast;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -380,7 +381,9 @@ struct dri2_egl_surface {
|
||||||
struct ANativeWindowBuffer *buffer;
|
struct ANativeWindowBuffer *buffer;
|
||||||
int age;
|
int age;
|
||||||
} *color_buffers, *back;
|
} *color_buffers, *back;
|
||||||
uint32_t gralloc_usage;
|
//uint32_t gralloc_usage;
|
||||||
|
uint64_t gralloc_usage;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* surfaceless and device */
|
/* surfaceless and device */
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf)
|
||||||
static bool
|
static bool
|
||||||
droid_set_shared_buffer_mode(_EGLDisplay *disp, _EGLSurface *surf, bool mode)
|
droid_set_shared_buffer_mode(_EGLDisplay *disp, _EGLSurface *surf, bool mode)
|
||||||
{
|
{
|
||||||
#if ANDROID_API_LEVEL >= 24
|
// #if ANDROID_API_LEVEL >= 24
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||||
struct ANativeWindow *window = dri2_surf->window;
|
struct ANativeWindow *window = dri2_surf->window;
|
||||||
|
|
@ -261,11 +261,11 @@ droid_set_shared_buffer_mode(_EGLDisplay *disp, _EGLSurface *surf, bool mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
// #else
|
||||||
_eglLog(_EGL_FATAL, "%s:%d: internal error: unreachable", __FILE__,
|
// _eglLog(_EGL_FATAL, "%s:%d: internal error: unreachable", __FILE__,
|
||||||
__LINE__);
|
// __LINE__);
|
||||||
return false;
|
// return false;
|
||||||
#endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static _EGLSurface *
|
static _EGLSurface *
|
||||||
|
|
@ -672,6 +672,12 @@ droid_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
|
||||||
draw->ActiveRenderBuffer = draw->RequestedRenderBuffer;
|
draw->ActiveRenderBuffer = draw->RequestedRenderBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Optimization: Dequeue the buffer for a next frame:
|
||||||
|
* This reduces CPU time spent by next frame on a road
|
||||||
|
* from start-of-frame event to GPU job-submit event.
|
||||||
|
*/
|
||||||
|
update_buffers(dri2_surf);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1245,7 +1251,7 @@ dri2_initialize_android(_EGLDisplay *disp)
|
||||||
disp->Extensions.KHR_image = EGL_TRUE;
|
disp->Extensions.KHR_image = EGL_TRUE;
|
||||||
|
|
||||||
dri2_dpy->front_rendering_usage = 0;
|
dri2_dpy->front_rendering_usage = 0;
|
||||||
#if ANDROID_API_LEVEL >= 24
|
// #if ANDROID_API_LEVEL >= 24
|
||||||
if (!dri2_dpy->swrast_not_kms &&
|
if (!dri2_dpy->swrast_not_kms &&
|
||||||
dri2_dpy->loader_extensions == droid_image_loader_extensions &&
|
dri2_dpy->loader_extensions == droid_image_loader_extensions &&
|
||||||
/* In big GL, front rendering is done at the core API level by directly
|
/* In big GL, front rendering is done at the core API level by directly
|
||||||
|
|
@ -1259,6 +1265,12 @@ dri2_initialize_android(_EGLDisplay *disp)
|
||||||
*/
|
*/
|
||||||
(disp->ClientAPIs & ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT |
|
(disp->ClientAPIs & ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT |
|
||||||
EGL_OPENGL_ES3_BIT_KHR)) == 0) {
|
EGL_OPENGL_ES3_BIT_KHR)) == 0) {
|
||||||
|
|
||||||
|
#if ANDROID_API_LEVEL >= 33
|
||||||
|
/* align with BufferUsage::FRONT_BUFFER */
|
||||||
|
dri2_dpy->front_rendering_usage = 1UL << 32;
|
||||||
|
disp->Extensions.KHR_mutable_render_buffer = EGL_TRUE;
|
||||||
|
#else
|
||||||
/* For cros gralloc, if the front rendering query is supported, then all
|
/* For cros gralloc, if the front rendering query is supported, then all
|
||||||
* available window surface configs support front rendering because:
|
* available window surface configs support front rendering because:
|
||||||
*
|
*
|
||||||
|
|
@ -1280,8 +1292,9 @@ dri2_initialize_android(_EGLDisplay *disp)
|
||||||
dri2_dpy->front_rendering_usage = front_rendering_usage;
|
dri2_dpy->front_rendering_usage = front_rendering_usage;
|
||||||
disp->Extensions.KHR_mutable_render_buffer = EGL_TRUE;
|
disp->Extensions.KHR_mutable_render_buffer = EGL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create configs *after* enabling extensions because presence of DRI
|
/* Create configs *after* enabling extensions because presence of DRI
|
||||||
* driver extensions can affect the capabilities of EGLConfigs.
|
* driver extensions can affect the capabilities of EGLConfigs.
|
||||||
|
|
|
||||||
|
|
@ -262,8 +262,11 @@ struct pan_image_usage {
|
||||||
/* Image frequently updated with host data. */
|
/* Image frequently updated with host data. */
|
||||||
bool frequent_host_updates;
|
bool frequent_host_updates;
|
||||||
|
|
||||||
/* Scanout image. */
|
// /* Scanout image. */
|
||||||
bool scanout;
|
//change here
|
||||||
|
// bool scanout;
|
||||||
|
bool legacy_scanout;
|
||||||
|
bool wsi;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline enum pan_mod_support
|
static inline enum pan_mod_support
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,9 @@ pan_mod_afbc_test_props(const struct pan_kmod_dev_props *dprops,
|
||||||
return PAN_MOD_NOT_OPTIMAL;
|
return PAN_MOD_NOT_OPTIMAL;
|
||||||
|
|
||||||
/* Reserve 32x8 tiles for scanout buffers. */
|
/* Reserve 32x8 tiles for scanout buffers. */
|
||||||
if (iusage && !iusage->scanout &&
|
//change here
|
||||||
|
// if (iusage && !iusage->scanout &&
|
||||||
|
if(iusage && !iusage->wsi &&
|
||||||
pan_afbc_superblock_width(iprops->modifier) != 16)
|
pan_afbc_superblock_width(iprops->modifier) != 16)
|
||||||
return PAN_MOD_NOT_OPTIMAL;
|
return PAN_MOD_NOT_OPTIMAL;
|
||||||
|
|
||||||
|
|
@ -266,12 +268,12 @@ pan_mod_afbc_test_props(const struct pan_kmod_dev_props *dprops,
|
||||||
if (is_tiled && !can_tile)
|
if (is_tiled && !can_tile)
|
||||||
return PAN_MOD_NOT_SUPPORTED;
|
return PAN_MOD_NOT_SUPPORTED;
|
||||||
|
|
||||||
/* Prefer tiled headers when the image is big enough. */
|
// /* Prefer tiled headers when the image is big enough. */
|
||||||
bool should_tile =
|
// bool should_tile =
|
||||||
iprops->extent_px.width >= 128 && iprops->extent_px.height >= 128;
|
// iprops->extent_px.width >= 128 && iprops->extent_px.height >= 128;
|
||||||
|
|
||||||
if (is_tiled != should_tile)
|
// if (is_tiled != should_tile)
|
||||||
return PAN_MOD_NOT_OPTIMAL;
|
// return PAN_MOD_NOT_OPTIMAL;
|
||||||
|
|
||||||
/* Packing/unpacking AFBC payload requires a COMPUTE job which we'd rather
|
/* Packing/unpacking AFBC payload requires a COMPUTE job which we'd rather
|
||||||
* avoid.
|
* avoid.
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,10 @@ get_iusage(struct panvk_image *image, const VkImageCreateInfo *create_info)
|
||||||
|
|
||||||
iusage.host_copy =
|
iusage.host_copy =
|
||||||
!!(image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT);
|
!!(image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT);
|
||||||
iusage.scanout = wsi_info && wsi_info->scanout;
|
//iusage.scanout = wsi_info && wsi_info->scanout;
|
||||||
|
iusage.legacy_scanout = wsi_info && wsi_info->scanout;
|
||||||
|
iusage.wsi = wsi_info != NULL;
|
||||||
|
|
||||||
|
|
||||||
return iusage;
|
return iusage;
|
||||||
}
|
}
|
||||||
|
|
@ -368,6 +371,13 @@ panvk_image_get_mod(struct panvk_image *image,
|
||||||
|
|
||||||
assert(!"Missing modifier info");
|
assert(!"Missing modifier info");
|
||||||
}
|
}
|
||||||
|
//change here
|
||||||
|
/* legacy scanout (images without any external modifier info) should default to LINEAR. */
|
||||||
|
if (iusage.legacy_scanout)
|
||||||
|
return DRM_FORMAT_MOD_LINEAR;
|
||||||
|
|
||||||
|
/* Without external dependencies, pick the best modifier that supports the image. */
|
||||||
|
|
||||||
|
|
||||||
return panvk_image_get_mod_from_list(image, &iusage, NULL, 0);
|
return panvk_image_get_mod_from_list(image, &iusage, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue