static int tegra_fb_create_handle(struct drm_framebuffer *framebuffer, struct drm_file *file, unsigned int *handle) { struct tegra_fb *fb = to_tegra_fb(framebuffer); return drm_gem_handle_create(file, &fb->planes[0]->gem, handle); }
bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer) { struct tegra_fb *fb = to_tegra_fb(framebuffer); if (fb->planes[0]->flags & TEGRA_BO_BOTTOM_UP) return true; return false; }
struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, unsigned int index) { struct tegra_fb *fb = to_tegra_fb(framebuffer); if (index >= framebuffer->format->num_planes) return NULL; return fb->planes[index]; }
int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, struct tegra_bo_tiling *tiling) { struct tegra_fb *fb = to_tegra_fb(framebuffer); /* TODO: handle YUV formats? */ *tiling = fb->planes[0]->tiling; return 0; }
int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer, struct tegra_bo_tiling *tiling) { struct tegra_fb *fb = to_tegra_fb(framebuffer); uint64_t modifier = fb->base.modifier; switch (modifier) { case DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED: tiling->mode = TEGRA_BO_TILING_MODE_TILED; tiling->value = 0; break; case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(0): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; tiling->value = 0; break; case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(1): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; tiling->value = 1; break; case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(2): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; tiling->value = 2; break; case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(3): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; tiling->value = 3; break; case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(4): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; tiling->value = 4; break; case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(5): tiling->mode = TEGRA_BO_TILING_MODE_BLOCK; tiling->value = 5; break; default: /* TODO: handle YUV formats? */ *tiling = fb->planes[0]->tiling; break; } return 0; }
static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) { struct tegra_fb *fb = to_tegra_fb(framebuffer); unsigned int i; for (i = 0; i < fb->num_planes; i++) { struct tegra_bo *bo = fb->planes[i]; if (bo) drm_gem_object_unreference_unlocked(&bo->gem); } drm_framebuffer_cleanup(framebuffer); kfree(fb->planes); kfree(fb); }