minigbm: remove BO_USE_RENDERING from certain formats
We can't use GR88, R8, YV12, NV12, UYVY, YUYV buffers as render targets, so let's remove the BO_USE_RENDERING flag from these formats. However, we can sample from these formats (though this feature still needs to be enabled in our drivers), so the BO_USE_TEXTURE flag remains set. Also, change our interpretation of the GRALLOC_USAGE_HW_COMPOSER flag such that it implies BO_USE_SCANOUT | BO_USE_TEXTURE. This is because the OpenGL fallback textures from the buffer if can't be scanned-out, not renders to it. BUG=none TEST=run Youtube app on Kevin Change-Id: I9ea8452279e110bc1a9579f162abe1c72192eb40 Reviewed-on: https://chromium-review.googlesource.com/506812 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
de558ae8a2
commit
8ac0c9a955
20 changed files with 226 additions and 96 deletions
22
amdgpu.c
22
amdgpu.c
|
|
@ -41,8 +41,8 @@ enum {
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
const static uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
const static uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int amdgpu_set_metadata(int fd, uint32_t handle, struct amdgpu_bo_metadata *info)
|
||||
{
|
||||
|
|
@ -271,7 +271,7 @@ static int amdgpu_init(struct driver *drv)
|
|||
int ret;
|
||||
void *addrlib;
|
||||
struct format_metadata metadata;
|
||||
uint32_t flags = BO_COMMON_USE_MASK;
|
||||
uint32_t flags = BO_USE_RENDER_MASK;
|
||||
|
||||
addrlib = amdgpu_addrlib_init(drv_get_fd(drv));
|
||||
if (!addrlib)
|
||||
|
|
@ -283,8 +283,8 @@ static int amdgpu_init(struct driver *drv)
|
|||
metadata.priority = 1;
|
||||
metadata.modifier = DRM_FORMAT_MOD_NONE;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -296,8 +296,8 @@ static int amdgpu_init(struct driver *drv)
|
|||
metadata.priority = 2;
|
||||
metadata.modifier = DRM_FORMAT_MOD_NONE;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -308,8 +308,8 @@ static int amdgpu_init(struct driver *drv)
|
|||
metadata.tiling = ADDR_DISPLAYABLE << 16 | ADDR_TM_2D_TILED_THIN1;
|
||||
metadata.priority = 3;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -320,8 +320,8 @@ static int amdgpu_init(struct driver *drv)
|
|||
metadata.tiling = ADDR_NON_DISPLAYABLE << 16 | ADDR_TM_2D_TILED_THIN1;
|
||||
metadata.priority = 4;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
12
cirrus.c
12
cirrus.c
|
|
@ -8,12 +8,18 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
const static uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
const static uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int cirrus_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
struct backend backend_cirrus = {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ uint64_t cros_gralloc_convert_flags(int flags)
|
|||
usage |= BO_USE_RENDERING;
|
||||
if (flags & GRALLOC_USAGE_HW_COMPOSER)
|
||||
/* HWC wants to use display hardware, but can defer to OpenGL. */
|
||||
usage |= BO_USE_SCANOUT | BO_USE_RENDERING;
|
||||
usage |= BO_USE_SCANOUT | BO_USE_TEXTURE;
|
||||
if (flags & GRALLOC_USAGE_HW_FB)
|
||||
usage |= BO_USE_NONE;
|
||||
if (flags & GRALLOC_USAGE_EXTERNAL_DISP)
|
||||
|
|
|
|||
4
drv.h
4
drv.h
|
|
@ -49,10 +49,6 @@ extern "C" {
|
|||
#define DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED fourcc_code('9', '9', '9', '8')
|
||||
#define DRM_FORMAT_FLEX_YCbCr_420_888 fourcc_code('9', '9', '9', '9')
|
||||
|
||||
#define BO_COMMON_USE_MASK BO_USE_LINEAR | BO_USE_RENDERING | \
|
||||
BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | \
|
||||
BO_USE_TEXTURE
|
||||
// clang-format on
|
||||
struct driver;
|
||||
struct bo;
|
||||
|
|
|
|||
11
drv_priv.h
11
drv_priv.h
|
|
@ -79,4 +79,15 @@ struct backend {
|
|||
struct combinations combos;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define BO_USE_RENDER_MASK BO_USE_LINEAR | BO_USE_RENDERING | 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_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
|
||||
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE
|
||||
|
||||
#define LINEAR_METADATA (struct format_metadata) { 0, 1, DRM_FORMAT_MOD_NONE }
|
||||
// clang-format on
|
||||
|
||||
#endif
|
||||
|
|
|
|||
10
evdi.c
10
evdi.c
|
|
@ -8,11 +8,17 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int evdi_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
struct backend backend_evdi = {
|
||||
|
|
|
|||
18
exynos.c
18
exynos.c
|
|
@ -19,12 +19,24 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_NV12,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static const uint32_t texture_source_formats[] = { DRM_FORMAT_NV12 };
|
||||
|
||||
static int exynos_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&LINEAR_METADATA, BO_USE_TEXTURE_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
static int exynos_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
|
|
|
|||
10
gma500.c
10
gma500.c
|
|
@ -8,11 +8,17 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_RGBX8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_RGBX8888 };
|
||||
|
||||
static int gma500_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
struct backend backend_gma500 = {
|
||||
|
|
|
|||
17
helpers.c
17
helpers.c
|
|
@ -501,21 +501,12 @@ out:
|
|||
return items;
|
||||
}
|
||||
|
||||
int drv_add_linear_combinations(struct driver *drv, const uint32_t *formats, uint32_t num_formats)
|
||||
int drv_modify_linear_combinations(struct driver *drv)
|
||||
{
|
||||
int ret;
|
||||
uint32_t i, j, num_items;
|
||||
struct kms_item *items;
|
||||
struct combination *combo;
|
||||
struct format_metadata metadata;
|
||||
|
||||
metadata.tiling = 0;
|
||||
metadata.priority = 1;
|
||||
metadata.modifier = DRM_FORMAT_MOD_NONE;
|
||||
|
||||
ret = drv_add_combinations(drv, formats, num_formats, &metadata, BO_COMMON_USE_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
/*
|
||||
* All current drivers can scanout linear XRGB8888/ARGB8888 as a primary
|
||||
* plane and as a cursor. Some drivers don't support
|
||||
|
|
@ -523,8 +514,10 @@ int drv_add_linear_combinations(struct driver *drv, const uint32_t *formats, uin
|
|||
* kernel disregards the alpha component of ARGB unless it's an overlay
|
||||
* plane.
|
||||
*/
|
||||
drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT);
|
||||
drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT);
|
||||
drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &LINEAR_METADATA,
|
||||
BO_USE_CURSOR | BO_USE_SCANOUT);
|
||||
drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &LINEAR_METADATA,
|
||||
BO_USE_CURSOR | BO_USE_SCANOUT);
|
||||
|
||||
items = drv_query_kms(drv, &num_items);
|
||||
if (!items || !num_items)
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ int drv_add_combinations(struct driver *drv, const uint32_t *formats, uint32_t n
|
|||
void drv_modify_combination(struct driver *drv, uint32_t format, struct format_metadata *metadata,
|
||||
uint64_t usage);
|
||||
struct kms_item *drv_query_kms(struct driver *drv, uint32_t *num_items);
|
||||
int drv_add_linear_combinations(struct driver *drv, const uint32_t *formats, uint32_t num_formats);
|
||||
int drv_modify_linear_combinations(struct driver *drv);
|
||||
#endif
|
||||
|
|
|
|||
63
i915.c
63
i915.c
|
|
@ -20,14 +20,15 @@
|
|||
#define I915_CACHELINE_SIZE 64
|
||||
#define I915_CACHELINE_MASK (I915_CACHELINE_SIZE - 1)
|
||||
|
||||
static const uint32_t tileable_formats[] = { DRM_FORMAT_ARGB1555, DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_XRGB8888, DRM_FORMAT_UYVY,
|
||||
DRM_FORMAT_YUYV };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB1555, DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB1555,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static const uint32_t linear_only_formats[] = { DRM_FORMAT_GR88, DRM_FORMAT_R8, DRM_FORMAT_YVU420,
|
||||
DRM_FORMAT_YVU420_ANDROID };
|
||||
static const uint32_t tileable_texture_source_formats[] = { DRM_FORMAT_GR88, DRM_FORMAT_R8,
|
||||
DRM_FORMAT_UYVY, DRM_FORMAT_YUYV };
|
||||
|
||||
static const uint32_t texture_source_formats[] = { DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID };
|
||||
|
||||
struct i915_device {
|
||||
uint32_t gen;
|
||||
|
|
@ -79,42 +80,66 @@ static int i915_add_combinations(struct driver *drv)
|
|||
uint32_t i, num_items;
|
||||
struct kms_item *items;
|
||||
struct format_metadata metadata;
|
||||
uint64_t flags = BO_COMMON_USE_MASK;
|
||||
uint64_t render_flags, texture_flags;
|
||||
|
||||
render_flags = BO_USE_RENDER_MASK;
|
||||
texture_flags = BO_USE_TEXTURE_MASK;
|
||||
|
||||
metadata.tiling = I915_TILING_NONE;
|
||||
metadata.priority = 1;
|
||||
metadata.modifier = DRM_FORMAT_MOD_NONE;
|
||||
|
||||
ret = drv_add_combinations(drv, linear_only_formats, ARRAY_SIZE(linear_only_formats),
|
||||
&metadata, flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, render_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, tileable_formats, ARRAY_SIZE(tileable_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&metadata, texture_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, tileable_texture_source_formats,
|
||||
ARRAY_SIZE(texture_source_formats), &metadata, texture_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT);
|
||||
drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT);
|
||||
|
||||
flags &= ~BO_USE_SW_WRITE_OFTEN;
|
||||
flags &= ~BO_USE_SW_READ_OFTEN;
|
||||
flags &= ~BO_USE_LINEAR;
|
||||
render_flags &= ~BO_USE_SW_WRITE_OFTEN;
|
||||
render_flags &= ~BO_USE_SW_READ_OFTEN;
|
||||
render_flags &= ~BO_USE_LINEAR;
|
||||
|
||||
texture_flags &= ~BO_USE_SW_WRITE_OFTEN;
|
||||
texture_flags &= ~BO_USE_SW_READ_OFTEN;
|
||||
texture_flags &= ~BO_USE_LINEAR;
|
||||
|
||||
metadata.tiling = I915_TILING_X;
|
||||
metadata.priority = 2;
|
||||
|
||||
ret = drv_add_combinations(drv, tileable_formats, ARRAY_SIZE(tileable_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, render_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, tileable_texture_source_formats,
|
||||
ARRAY_SIZE(tileable_texture_source_formats), &metadata,
|
||||
texture_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
metadata.tiling = I915_TILING_Y;
|
||||
metadata.priority = 3;
|
||||
|
||||
ret = drv_add_combinations(drv, tileable_formats, ARRAY_SIZE(tileable_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, render_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, tileable_texture_source_formats,
|
||||
ARRAY_SIZE(tileable_texture_source_formats), &metadata,
|
||||
texture_flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
11
marvell.c
11
marvell.c
|
|
@ -10,11 +10,18 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int marvell_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_add_linear_combinations(drv, render_target_formats,
|
||||
ARRAY_SIZE(render_target_formats));
|
||||
}
|
||||
|
||||
struct backend backend_marvell = {
|
||||
|
|
|
|||
23
mediatek.c
23
mediatek.c
|
|
@ -18,14 +18,27 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_R8, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_YVU420,
|
||||
DRM_FORMAT_YVU420_ANDROID };
|
||||
|
||||
static int mediatek_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&LINEAR_METADATA, BO_USE_TEXTURE_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
|
|
|
|||
10
nouveau.c
10
nouveau.c
|
|
@ -8,11 +8,17 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int nouveau_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
struct backend backend_nouveau = {
|
||||
|
|
|
|||
27
rockchip.c
27
rockchip.c
|
|
@ -18,11 +18,12 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_NV12, DRM_FORMAT_R8,
|
||||
DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888, DRM_FORMAT_YVU420,
|
||||
DRM_FORMAT_YVU420_ANDROID };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_NV12,
|
||||
DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID };
|
||||
|
||||
static int afbc_bo_from_format(struct bo *bo, uint32_t width, uint32_t height, uint32_t format)
|
||||
{
|
||||
|
|
@ -71,7 +72,7 @@ static int afbc_bo_from_format(struct bo *bo, uint32_t width, uint32_t height, u
|
|||
static int rockchip_add_kms_item(struct driver *drv, const struct kms_item *item)
|
||||
{
|
||||
int ret;
|
||||
uint32_t i;
|
||||
uint32_t i, j;
|
||||
uint64_t flags;
|
||||
struct combination *combo;
|
||||
struct format_metadata metadata;
|
||||
|
|
@ -85,6 +86,11 @@ static int rockchip_add_kms_item(struct driver *drv, const struct kms_item *item
|
|||
metadata.tiling = 0;
|
||||
metadata.priority = 2;
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(texture_source_formats); j++) {
|
||||
if (item->format == texture_source_formats[j])
|
||||
flags &= ~BO_USE_RENDERING;
|
||||
}
|
||||
|
||||
ret = drv_add_combination(drv, item[i].format, &metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -108,8 +114,13 @@ static int rockchip_init(struct driver *drv)
|
|||
metadata.priority = 1;
|
||||
metadata.modifier = DRM_FORMAT_MOD_NONE;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
BO_COMMON_USE_MASK);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&metadata, BO_USE_TEXTURE_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
12
tegra.c
12
tegra.c
|
|
@ -45,7 +45,7 @@ struct tegra_private_map_data {
|
|||
void *untiled;
|
||||
};
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int compute_block_height_log2(int height)
|
||||
{
|
||||
|
|
@ -170,14 +170,14 @@ static int tegra_init(struct driver *drv)
|
|||
{
|
||||
int ret;
|
||||
struct format_metadata metadata;
|
||||
uint64_t flags = BO_COMMON_USE_MASK;
|
||||
uint64_t flags = BO_USE_RENDER_MASK;
|
||||
|
||||
metadata.tiling = NV_MEM_KIND_PITCH;
|
||||
metadata.priority = 1;
|
||||
metadata.modifier = DRM_FORMAT_MOD_NONE;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -191,8 +191,8 @@ static int tegra_init(struct driver *drv)
|
|||
metadata.tiling = NV_MEM_KIND_C32_2CRA;
|
||||
metadata.priority = 2;
|
||||
|
||||
ret = drv_add_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats), &metadata,
|
||||
flags);
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&metadata, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
10
udl.c
10
udl.c
|
|
@ -8,11 +8,17 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int udl_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
struct backend backend_udl = {
|
||||
|
|
|
|||
12
vc4.c
12
vc4.c
|
|
@ -16,12 +16,18 @@
|
|||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static int vc4_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
static int vc4_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
|
|
|
|||
23
vgem.c
23
vgem.c
|
|
@ -11,14 +11,27 @@
|
|||
#define MESA_LLVMPIPE_TILE_ORDER 6
|
||||
#define MESA_LLVMPIPE_TILE_SIZE (1 << MESA_LLVMPIPE_TILE_ORDER)
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_R8, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_YVU420,
|
||||
DRM_FORMAT_YVU420_ANDROID };
|
||||
|
||||
static int vgem_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&LINEAR_METADATA, BO_USE_TEXTURE_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
static int vgem_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
|
|
|
|||
23
virtio_gpu.c
23
virtio_gpu.c
|
|
@ -11,14 +11,27 @@
|
|||
#define MESA_LLVMPIPE_TILE_ORDER 6
|
||||
#define MESA_LLVMPIPE_TILE_SIZE (1 << MESA_LLVMPIPE_TILE_ORDER)
|
||||
|
||||
static const uint32_t supported_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_R8, DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID };
|
||||
static const uint32_t render_target_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_XRGB8888 };
|
||||
|
||||
static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_YVU420,
|
||||
DRM_FORMAT_YVU420_ANDROID };
|
||||
|
||||
static int virtio_gpu_init(struct driver *drv)
|
||||
{
|
||||
return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
|
||||
int ret;
|
||||
ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
|
||||
&LINEAR_METADATA, BO_USE_RENDER_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats),
|
||||
&LINEAR_METADATA, BO_USE_TEXTURE_MASK);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return drv_modify_linear_combinations(drv);
|
||||
}
|
||||
|
||||
static int virtio_gpu_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue