#ifdef DRV_MSM
#include <assert.h>
-#include <dlfcn.h>
#include <drm_fourcc.h>
#include <errno.h>
#include <inttypes.h>
}
}
-/**
- * Check for buggy apps that are known to not support modifiers, to avoid surprising them
- * with a UBWC buffer.
- */
-static bool should_avoid_ubwc(void)
-{
-#ifndef __ANDROID__
- /* waffle is buggy and, requests a renderable buffer (which on qcom platforms, we
- * want to use UBWC), and then passes it to the kernel discarding the modifier.
- * So mesa ends up correctly rendering to as tiled+compressed, but kernel tries
- * to display as linear. Other platforms do not see this issue, simply because
- * they only use compressed (ex, AFBC) with the BO_USE_SCANOUT flag.
- *
- * See b/163137550
- */
- if (dlsym(RTLD_DEFAULT, "waffle_display_connect")) {
- drv_log("WARNING: waffle detected, disabling UBWC\n");
- return true;
- }
-#endif
- return false;
-}
-
static int msm_init(struct driver *drv)
{
struct format_metadata metadata;
drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
&LINEAR_METADATA, texture_use_flags);
+ /*
+ * Chrome uses DMA-buf mmap to write to YV12 buffers, which are then accessed by the
+ * Video Encoder Accelerator (VEA). It could also support NV12 potentially in the future.
+ */
+ drv_modify_combination(drv, DRM_FORMAT_YVU420, &LINEAR_METADATA, BO_USE_HW_VIDEO_ENCODER);
+ drv_modify_combination(drv, DRM_FORMAT_NV12, &LINEAR_METADATA, BO_USE_HW_VIDEO_ENCODER);
+
/* The camera stack standardizes on NV12 for YUV buffers. */
- /* YVU420 and NV12 formats for camera, display and encoding. */
drv_modify_combination(drv, DRM_FORMAT_NV12, &LINEAR_METADATA,
- BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_SCANOUT |
- BO_USE_HW_VIDEO_ENCODER);
-
+ BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_SCANOUT);
/*
* R8 format is used for Android's HAL_PIXEL_FORMAT_BLOB and is used for JPEG snapshots
- * from camera and input/output from hardware decoder/encoder.
+ * from camera.
*/
drv_modify_combination(drv, DRM_FORMAT_R8, &LINEAR_METADATA,
- BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_HW_VIDEO_DECODER |
- BO_USE_HW_VIDEO_ENCODER);
+ BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
/* Android CTS tests require this. */
drv_add_combination(drv, DRM_FORMAT_BGR888, &LINEAR_METADATA, BO_USE_SW_MASK);
drv_modify_linear_combinations(drv);
- if (should_avoid_ubwc())
- return 0;
-
metadata.tiling = MSM_UBWC_TILING;
metadata.priority = 2;
metadata.modifier = DRM_FORMAT_MOD_QCOM_COMPRESSED;
render_use_flags &= ~sw_flags;
texture_use_flags &= ~sw_flags;
- /* TODO(hoegsberg): Disable UBWC while we roll out support for
- * passing modifiers from ARC++. cros-gralloc actuallly
- * allocates UBWC buffers in ARC++, but mesa EGL imports
- * without a modifier and the ARC++ wayland_service hardcodes
- * modifier 0 (DRM_FORMAT_MOD_LINEAR). As a result, both
- * sides think that they have a linear buffer and happly read
- * and write linear. It "works" even though the buffer was
- * allocated as UBWC, since UBWC really just results in a
- * slightly larger buffer than what we'd allocate for linear.
- *
- * As we land support in mesa for importing with modifers,
- * mesa will start writing UBWC buffers. Once we land the
- * wayland_service change in ARC++, exo will start receiving
- * the right modifier and read the buffers as UBWC. We can't
- * synchronize landing these changes and as they land out of
- * order, the result is corrupted buffers for a while. To
- * avoid breakage in the interim, we disable UBWC while the
- * changes land and then turn it back on when things settle
- * down.
- */
- if (false) {
- msm_add_ubwc_combinations(drv, render_target_formats,
- ARRAY_SIZE(render_target_formats),
- &metadata, render_use_flags);
-
- msm_add_ubwc_combinations(drv, texture_source_formats,
- ARRAY_SIZE(texture_source_formats),
- &metadata, texture_use_flags);
- }
+ msm_add_ubwc_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
+ &metadata, render_use_flags);
+
+ msm_add_ubwc_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
+ &metadata, texture_use_flags);
return 0;
}
static uint32_t msm_resolve_format(struct driver *drv, uint32_t format, uint64_t use_flags)
{
switch (format) {
- case DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED:
- /* Camera subsystem requires NV12. */
- if (use_flags & (BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE))
- return DRM_FORMAT_NV12;
- /*HACK: See b/28671744 */
- return DRM_FORMAT_XBGR8888;
case DRM_FORMAT_FLEX_YCbCr_420_888:
return DRM_FORMAT_NV12;
default: