minigbm: stop faking the protected buffers
With real HW protection on the horizon, let's repurpose the protection flag to mean that. Currently, our protected buffer scheme on the Android side allocates a dummy fd, which is sent to Chrome. Chrome associates that dummy fd with an unmappable shared memory buffer. In the entire process, minigbm doesn't really do anything. We prevent buffers allocated with the protected flag from being mapped, but since it's a dummy fd it's not really useful. Chrome doesn't use the protected flag yet, but hopefully will so in the future, but with real HW protection. BUG= TEST= Change-Id: I57be26926539471f062ffeff33b523a3899c35f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2466958 Reviewed-by: David Stevens <stevensd@chromium.org> Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
20604bea13
commit
bbba9dde65
8 changed files with 20 additions and 20 deletions
|
|
@ -80,8 +80,9 @@ static uint64_t gralloc0_convert_usage(int usage)
|
|||
* rockchip) and usb monitors (evdi/udl). It's complicated so ignore it.
|
||||
* */
|
||||
use_flags |= BO_USE_NONE;
|
||||
/* Ignore this flag until real HW protection is available on minigbm Android drivers. */
|
||||
if (usage & GRALLOC_USAGE_PROTECTED)
|
||||
use_flags |= BO_USE_PROTECTED;
|
||||
use_flags |= 0;
|
||||
if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) {
|
||||
use_flags |= BO_USE_HW_VIDEO_ENCODER;
|
||||
/*HACK: See b/30054495 */
|
||||
|
|
|
|||
|
|
@ -278,8 +278,9 @@ int convertToBufferUsage(uint64_t grallocUsage, uint64_t* outBufferUsage) {
|
|||
/* HWC wants to use display hardware, but can defer to OpenGL. */
|
||||
bufferUsage |= BO_USE_SCANOUT | BO_USE_TEXTURE;
|
||||
}
|
||||
/* Ignore this flag until real HW protection is available on minigbm Android drivers. */
|
||||
if (grallocUsage & BufferUsage::PROTECTED) {
|
||||
bufferUsage |= BO_USE_PROTECTED;
|
||||
bufferUsage |= 0;
|
||||
}
|
||||
if (grallocUsage & BufferUsage::COMPOSER_CURSOR) {
|
||||
bufferUsage |= BO_USE_NONE;
|
||||
|
|
|
|||
|
|
@ -282,8 +282,9 @@ int convertToBufferUsage(uint64_t grallocUsage, uint64_t* outBufferUsage) {
|
|||
/* HWC wants to use display hardware, but can defer to OpenGL. */
|
||||
bufferUsage |= BO_USE_SCANOUT | BO_USE_TEXTURE;
|
||||
}
|
||||
/* Ignore this flag until real HW protection is available on minigbm Android drivers. */
|
||||
if (grallocUsage & BufferUsage::PROTECTED) {
|
||||
bufferUsage |= BO_USE_PROTECTED;
|
||||
bufferUsage |= 0;
|
||||
}
|
||||
if (grallocUsage & BufferUsage::COMPOSER_CURSOR) {
|
||||
bufferUsage |= BO_USE_NONE;
|
||||
|
|
|
|||
16
drv_priv.h
16
drv_priv.h
|
|
@ -85,19 +85,19 @@ struct backend {
|
|||
};
|
||||
|
||||
// clang-format off
|
||||
#define BO_USE_RENDER_MASK (BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERING | \
|
||||
BO_USE_RENDERSCRIPT | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE)
|
||||
#define BO_USE_RENDER_MASK (BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_RENDERSCRIPT | \
|
||||
BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | \
|
||||
BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE)
|
||||
|
||||
#define BO_USE_TEXTURE_MASK (BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERSCRIPT | \
|
||||
BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE)
|
||||
#define BO_USE_TEXTURE_MASK (BO_USE_LINEAR | BO_USE_RENDERSCRIPT | BO_USE_SW_READ_OFTEN | \
|
||||
BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | \
|
||||
BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE)
|
||||
|
||||
#define BO_USE_SW_MASK (BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY)
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY)
|
||||
|
||||
#define BO_USE_NON_GPU_HW (BO_USE_SCANOUT | BO_USE_CAMERA_WRITE | BO_USE_CAMERA_READ | \
|
||||
BO_USE_HW_VIDEO_ENCODER | BO_USE_HW_VIDEO_DECODER)
|
||||
BO_USE_HW_VIDEO_ENCODER | BO_USE_HW_VIDEO_DECODER)
|
||||
|
||||
#ifndef DRM_FORMAT_MOD_LINEAR
|
||||
#define DRM_FORMAT_MOD_LINEAR DRM_FORMAT_MOD_NONE
|
||||
|
|
|
|||
4
i915.c
4
i915.c
|
|
@ -102,8 +102,8 @@ static int i915_add_combinations(struct driver *drv)
|
|||
scanout_and_render = BO_USE_RENDER_MASK | BO_USE_SCANOUT;
|
||||
render = BO_USE_RENDER_MASK;
|
||||
texture_only = BO_USE_TEXTURE_MASK;
|
||||
uint64_t linear_mask = BO_USE_RENDERSCRIPT | BO_USE_LINEAR | BO_USE_PROTECTED |
|
||||
BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN;
|
||||
uint64_t linear_mask =
|
||||
BO_USE_RENDERSCRIPT | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN;
|
||||
|
||||
metadata.tiling = I915_TILING_NONE;
|
||||
metadata.priority = 1;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ static int mediatek_init(struct driver *drv)
|
|||
drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&LINEAR_METADATA, BO_USE_TEXTURE_MASK);
|
||||
|
||||
drv_add_combination(drv, DRM_FORMAT_R8, &LINEAR_METADATA,
|
||||
BO_USE_SW_MASK | BO_USE_LINEAR | BO_USE_PROTECTED);
|
||||
drv_add_combination(drv, DRM_FORMAT_R8, &LINEAR_METADATA, BO_USE_SW_MASK | BO_USE_LINEAR);
|
||||
|
||||
/* Android CTS tests require this. */
|
||||
drv_add_combination(drv, DRM_FORMAT_BGR888, &LINEAR_METADATA, BO_USE_SW_MASK);
|
||||
|
|
|
|||
5
msm.c
5
msm.c
|
|
@ -189,8 +189,7 @@ static int msm_init(struct driver *drv)
|
|||
struct format_metadata metadata;
|
||||
uint64_t render_use_flags = BO_USE_RENDER_MASK | BO_USE_SCANOUT;
|
||||
uint64_t texture_use_flags = BO_USE_TEXTURE_MASK | BO_USE_HW_VIDEO_DECODER;
|
||||
uint64_t sw_flags =
|
||||
(BO_USE_RENDERSCRIPT | BO_USE_SW_MASK | BO_USE_LINEAR | BO_USE_PROTECTED);
|
||||
uint64_t sw_flags = (BO_USE_RENDERSCRIPT | BO_USE_SW_MASK | BO_USE_LINEAR);
|
||||
|
||||
drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, render_use_flags);
|
||||
|
|
@ -235,7 +234,7 @@ static int msm_init(struct driver *drv)
|
|||
|
||||
drv_modify_combination(drv, DRM_FORMAT_NV12, &metadata,
|
||||
BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_SCANOUT |
|
||||
BO_USE_HW_VIDEO_ENCODER);
|
||||
BO_USE_HW_VIDEO_ENCODER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,7 @@ static int rockchip_init(struct driver *drv)
|
|||
*/
|
||||
drv_add_combination(drv, DRM_FORMAT_R8, &metadata,
|
||||
BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_SW_MASK |
|
||||
BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_HW_VIDEO_DECODER |
|
||||
BO_USE_HW_VIDEO_ENCODER);
|
||||
BO_USE_LINEAR | BO_USE_HW_VIDEO_DECODER | BO_USE_HW_VIDEO_ENCODER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue