NV_MEM_KIND_GENERIC_16Bx2 = 0xfe,
};
+static struct supported_combination combos[4] = {
+ {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE,
+ DRV_BO_USE_CURSOR | DRV_BO_USE_LINEAR | DRV_BO_USE_SW_READ_OFTEN | DRV_BO_USE_SW_WRITE_OFTEN},
+ {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE,
+ DRV_BO_USE_RENDERING | DRV_BO_USE_SW_READ_RARELY | DRV_BO_USE_SW_WRITE_RARELY},
+ {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+ DRV_BO_USE_CURSOR | DRV_BO_USE_LINEAR | DRV_BO_USE_SW_READ_OFTEN | DRV_BO_USE_SW_WRITE_OFTEN},
+ {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+ DRV_BO_USE_RENDERING | DRV_BO_USE_SW_READ_RARELY | DRV_BO_USE_SW_WRITE_RARELY},
+};
+
static int compute_block_height_log2(int height)
{
int block_height_log2 = NV_DEFAULT_BLOCK_HEIGHT_LOG2;
uint32_t *block_height_log2,
uint32_t *stride, uint32_t *size)
{
- int pitch = drv_stride_from_format(format, width);
+ int pitch = drv_stride_from_format(format, width, 0);
/* Align to blocklinear blocks. */
pitch = ALIGN(pitch, NV_BLOCKLINEAR_GOB_WIDTH);
static void compute_layout_linear(int width, int height, int format,
uint32_t *stride, uint32_t *size)
{
- *stride = drv_stride_from_format(format, width);
+ *stride = drv_stride_from_format(format, width, 0);
*size = *stride * height;
}
+static int tegra_init(struct driver *drv)
+{
+ drv_insert_combinations(drv, combos, ARRAY_SIZE(combos));
+ return drv_add_kms_flags(drv);
+}
+
static int tegra_bo_create(struct bo *bo, uint32_t width, uint32_t height,
uint32_t format, uint32_t flags)
{
bo->handles[0].u32 = gem_create.handle;
bo->offsets[0] = 0;
- bo->sizes[0] = size;
+ bo->total_size = bo->sizes[0] = size;
bo->strides[0] = stride;
if (kind != NV_MEM_KIND_PITCH) {
/* Encode blocklinear parameters for EGLImage creation. */
bo->tiling = (kind & 0xff) |
((block_height_log2 & 0xf) << 8);
- bo->format_modifiers[0] = drv_fourcc_mod_code(NV, bo->tiling);
+ bo->format_modifiers[0] = fourcc_mod_code(NV, bo->tiling);
}
return 0;
}
-static void *tegra_bo_map(struct bo *bo)
+static void *tegra_bo_map(struct bo *bo, struct map_info *data, size_t plane)
{
int ret;
struct drm_tegra_gem_mmap gem_map;
return MAP_FAILED;
}
- return mmap(0, bo->sizes[0], PROT_READ | PROT_WRITE, MAP_SHARED,
+ data->length = bo->total_size;
+
+ return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED,
bo->drv->fd, gem_map.offset);
}
-const struct backend backend_tegra =
+struct backend backend_tegra =
{
.name = "tegra",
+ .init = tegra_init,
.bo_create = tegra_bo_create,
.bo_destroy = drv_gem_bo_destroy,
.bo_map = tegra_bo_map,
- .format_list = {
- /* Linear support */
- {DRV_FORMAT_XRGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_CURSOR | DRV_BO_USE_LINEAR},
- {DRV_FORMAT_ARGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_CURSOR | DRV_BO_USE_LINEAR},
- /* Blocklinear support */
- {DRV_FORMAT_XRGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_RENDERING},
- {DRV_FORMAT_ARGB8888, DRV_BO_USE_SCANOUT | DRV_BO_USE_RENDERING},
- }
};
#endif