Skip to content

Commit

Permalink
Revert "Revert "Use linear format for scanout buffer""
Browse files Browse the repository at this point in the history
This reverts commit 096c694.
  • Loading branch information
feijiang1 committed Jan 30, 2024
1 parent 500f765 commit 487b70f
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions i915.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,48 +187,11 @@ static uint64_t unset_flags(uint64_t current_flags, uint64_t mask)
return value;
}

/*
* Check virtual machine type, by checking cpuid
*/
enum {
HYPERTYPE_NONE = 0,
HYPERTYPE_ANY = 0x1,
HYPERTYPE_TYPE_ACRN = 0x2,
HYPERTYPE_TYPE_KVM = 0x4
};
static inline int vm_type()
{
int type = HYPERTYPE_NONE;
union {
uint32_t sig32[3];
char text[13];
} sig = {};

uint32_t eax=0, ebx=0, ecx=0, edx=0;
if(__get_cpuid(1, &eax, &ebx, &ecx, &edx)) {
if (((ecx >> 31) & 1) == 1) {
type |= HYPERTYPE_ANY;

__cpuid(0x40000000U, eax, ebx, ecx, edx);
sig.sig32[0] = ebx;
sig.sig32[1] = ecx;
sig.sig32[2] = edx;
if (!strncmp(sig.text, "ACRNACRNACRN", 12))
type |= HYPERTYPE_TYPE_ACRN;
else if ((!strncmp(sig.text, "KVMKVMKVM", 9)) ||
(!strncmp(sig.text, "EVMMEVMMEVMM", 12)))
type |= HYPERTYPE_TYPE_KVM;
}
}
return type;
}

static int i915_add_combinations(struct driver *drv)
{
struct i915_device *i915 = drv->priv;
struct format_metadata metadata;
uint64_t render, scanout_and_render, texture_only;
bool is_kvm = vm_type() & HYPERTYPE_TYPE_KVM;

scanout_and_render = BO_USE_RENDER_MASK | BO_USE_SCANOUT;
#ifdef USE_GRALLOC1
Expand Down Expand Up @@ -281,11 +244,7 @@ static int i915_add_combinations(struct driver *drv)

render = unset_flags(render, linear_mask | camera_mask);
scanout_and_render = unset_flags(scanout_and_render, linear_mask |camera_mask);

/* On ADL-P vm mode on 5.10 kernel, BO_USE_SCANOUT is not well supported for tiled bo */
if (is_kvm && i915->is_adlp) {
scanout_and_render = unset_flags(scanout_and_render, BO_USE_SCANOUT);
}
scanout_and_render = unset_flags(scanout_and_render, BO_USE_SCANOUT);

/* On dGPU, only use linear */
if (i915->genx10 >= 125)
Expand Down

0 comments on commit 487b70f

Please sign in to comment.