Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NV12 decoder use local memory #91

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions i915.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,18 @@ static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t heig
return 0;
}

static bool is_need_local(int64_t use_flags)
static bool is_need_local(struct i915_device *i915_dev, uint32_t format, int64_t use_flags)
{
static bool local = true;

if (use_flags & BO_USE_SW_READ_RARELY || use_flags & BO_USE_SW_READ_OFTEN ||
use_flags & BO_USE_SW_WRITE_RARELY || use_flags & BO_USE_SW_WRITE_OFTEN) {
/* TODO(OAM-113684): video layer set BO_USE_SW_WRITE_OFTEN and BO_USE_SW_READ_OFTEN,
* while we still found using local memory can bring better performance,
* maybe app set such flags to minigbm, but CPU doesn't read/write video buffer. */
if ((i915_dev->genx10 >= 125) && (format == DRM_FORMAT_NV12) &&
(use_flags & (BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN))) {
local = true;
} else if (use_flags & BO_USE_SW_READ_RARELY || use_flags & BO_USE_SW_READ_OFTEN ||
use_flags & BO_USE_SW_WRITE_RARELY || use_flags & BO_USE_SW_WRITE_OFTEN) {
local = false;
} else {
local = true;
Expand All @@ -752,7 +758,8 @@ static int i915_bo_create_from_metadata(struct bo *bo)
struct drm_i915_gem_set_tiling gem_set_tiling;
struct i915_device *i915_dev = (struct i915_device *)bo->drv->priv;
int64_t use_flags = bo->meta.use_flags;
bool local = is_need_local(use_flags);
uint32_t format = bo->meta.format;
bool local = is_need_local(i915_dev, format, use_flags);
if (local && i915_dev->has_local_mem) {
if (!is_prelim_kernel) {
/* All new BOs we get from the kernel are zeroed, so we don't need to
Expand Down
Loading