Skip to content

Commit

Permalink
Revert "Use linear format for scanout buffer"
Browse files Browse the repository at this point in the history
This reverts commit 25fed79.

Tracked-On: OAM-113290
Signed-off-by: Haihong Li <haihongx.li@intel.com>
  • Loading branch information
HaihongxLi committed Nov 9, 2023
1 parent 2b6b260 commit 0bb9784
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion i915.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,48 @@ 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 @@ -244,7 +281,11 @@ 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);
scanout_and_render = unset_flags(scanout_and_render, BO_USE_SCANOUT);

/* 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);
}

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

0 comments on commit 0bb9784

Please sign in to comment.