do we need context types (as a new enum)?
With Vulkan coming, we will need the concept of "context types". Two questions coming to my mind are
- should kernel/vmm know about the context type?
- do we need a new enum?
For the first question, I am thinking no. So far, kernel/vmm parses resources info (e.g., blob types and flags) but not command streams. What context types determine are the contents of the command streams. kernel/vmm should stay away.
For the second question, we should note that context types are not the only thing that determine the contents of the command streams. capsets also determine the contents, and are more detailed. We can actually make do by reusing capset ids as the context types.
That is, we can add
// this replaces the newly added "enum virgl_capsets"
enum virgl_context_types {
VIRGL_CONTEXT_TYPE_VIRGL = 1,
VIRGL_CONTEXT_TYPE_VIRGL2 = 2,
VIRGL_CONTEXT_TYPE_VENUS = 3,
};
to virgl_hw.h
. Mesa can use it to fill in drm_virtgpu_get_caps::cap_set_id
and know if a context type is supported, and if yes, the capset itself. This gives Mesa enough information to continue with context creation and command stream generations.