va done
This commit is contained in:
parent
9468fc82e5
commit
2a227dd745
2 changed files with 32 additions and 2 deletions
31
drm.c
31
drm.c
|
@ -5,6 +5,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <libdrm/drm_fourcc.h>
|
||||
|
||||
#include "drm.h"
|
||||
#include "va.h"
|
||||
|
@ -114,6 +115,18 @@ void drm_cleanup() {
|
|||
drmFreeVersion(kmsvnc->drm->drm_ver);
|
||||
kmsvnc->drm->drm_ver = NULL;
|
||||
}
|
||||
if (kmsvnc->drm->pixfmt_name) {
|
||||
free(kmsvnc->drm->pixfmt_name);
|
||||
kmsvnc->drm->pixfmt_name = NULL;
|
||||
}
|
||||
if (kmsvnc->drm->mod_vendor) {
|
||||
free(kmsvnc->drm->mod_vendor);
|
||||
kmsvnc->drm->mod_vendor = NULL;
|
||||
}
|
||||
if (kmsvnc->drm->mod_name) {
|
||||
free(kmsvnc->drm->mod_name);
|
||||
kmsvnc->drm->mod_name = NULL;
|
||||
}
|
||||
if (kmsvnc->drm->plane) {
|
||||
drmModeFreePlane(kmsvnc->drm->plane);
|
||||
kmsvnc->drm->plane = NULL;
|
||||
|
@ -215,18 +228,21 @@ int drm_open() {
|
|||
if (!drm->mfb) {
|
||||
KMSVNC_FATAL("Failed to get framebuffer %u: %s\n", drm->plane->fb_id, strerror(errno));
|
||||
}
|
||||
drm->pixfmt_name = drmGetFormatName(drm->mfb->pixel_format);
|
||||
drm->mod_vendor = drmGetFormatModifierVendor(drm->mfb->modifier);
|
||||
drm->mod_name = drmGetFormatModifierName(drm->mfb->modifier);
|
||||
printf("Template framebuffer is %u: %ux%u fourcc:%u mod:%u flags:%u\n", drm->mfb->fb_id, drm->mfb->width, drm->mfb->height, drm->mfb->pixel_format, drm->mfb->modifier, drm->mfb->flags);
|
||||
printf("handles %u %u %u %u\n", drm->mfb->handles[0], drm->mfb->handles[1], drm->mfb->handles[2], drm->mfb->handles[3]);
|
||||
printf("offsets %u %u %u %u\n", drm->mfb->offsets[0], drm->mfb->offsets[1], drm->mfb->offsets[2], drm->mfb->offsets[3]);
|
||||
printf("pitches %u %u %u %u\n", drm->mfb->pitches[0], drm->mfb->pitches[1], drm->mfb->pitches[2], drm->mfb->pitches[3]);
|
||||
printf("format %s, modifier %s:%s\n", drmGetFormatName(drm->mfb->pixel_format), drmGetFormatModifierVendor(drm->mfb->modifier), drmGetFormatModifierName(drm->mfb->modifier));
|
||||
printf("format %s, modifier %s:%s\n", drm->pixfmt_name, drm->mod_vendor, drm->mod_name);
|
||||
|
||||
if (
|
||||
drm->mfb->pixel_format != KMSVNC_FOURCC_TO_INT('X', 'R', '2', '4') &&
|
||||
drm->mfb->pixel_format != KMSVNC_FOURCC_TO_INT('A', 'R', '2', '4')
|
||||
)
|
||||
{
|
||||
KMSVNC_FATAL("Unsupported pixfmt\n");
|
||||
KMSVNC_FATAL("Unsupported pixfmt %s, please create an issue with your pixfmt.\n", drm->pixfmt_name);
|
||||
}
|
||||
|
||||
if (!drm->mfb->handles[0])
|
||||
|
@ -313,6 +329,11 @@ int drm_vendors() {
|
|||
|
||||
if (strcmp(driver_name, "i915") == 0 || strcmp(driver_name, "amdgpu") == 0)
|
||||
{
|
||||
if (fourcc_mod_is_vendor(drm->mfb->modifier, INTEL)) {
|
||||
if (strstr(drm->mod_name, "CCS")) {
|
||||
printf("warn: intel with CCS modifier detected, please set INTEL_DEBUG=noccs\n");
|
||||
}
|
||||
};
|
||||
drm->funcs->convert = &convert_vaapi;
|
||||
if (drm_kmsbuf_prime_vaapi()) return 1;
|
||||
}
|
||||
|
@ -327,6 +348,9 @@ int drm_vendors() {
|
|||
strcmp(driver_name, "virtio_gpu") == 0
|
||||
)
|
||||
{
|
||||
if (drm->mfb->modifier != DRM_FORMAT_MOD_NONE && drm->mfb->modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||
printf("warn: modifier is not LINEAR, please create an issue with your modifier.\n");
|
||||
}
|
||||
// virgl does not work
|
||||
if (drm_kmsbuf_dumb()) return 1;
|
||||
}
|
||||
|
@ -362,6 +386,9 @@ int drm_vendors() {
|
|||
else
|
||||
{
|
||||
fprintf(stderr, "Untested drm driver, use at your own risk!\n");
|
||||
if (drm->mfb->modifier != DRM_FORMAT_MOD_NONE && drm->mfb->modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||
printf("warn: modifier is not LINEAR, please create an issue with your driver and modifier.\n");
|
||||
}
|
||||
if (drm_kmsbuf_dumb()) return 1;
|
||||
}
|
||||
|
||||
|
|
3
kmsvnc.h
3
kmsvnc.h
|
@ -88,6 +88,9 @@ struct kmsvnc_drm_data
|
|||
off_t mmap_offset;
|
||||
char *mapped;
|
||||
struct kmsvnc_drm_funcs *funcs;
|
||||
char *pixfmt_name;
|
||||
char *mod_vendor;
|
||||
char *mod_name;
|
||||
};
|
||||
|
||||
struct kmsvnc_va_data
|
||||
|
|
Loading…
Reference in a new issue