libcamera & apps: Open drm device by module name 'starfive'
Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
From b04b58f1eea0b2fe417205846beef663c89275b7 Mon Sep 17 00:00:00 2001
|
||||
From: "Kevin.xie" <kevin.xie@starfivetech.com>
|
||||
Date: Wed, 3 Aug 2022 16:26:26 +0800
|
||||
Subject: [PATCH] libcamera: Open drm device by module name 'starfive'
|
||||
|
||||
Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
|
||||
---
|
||||
src/cam/drm.cpp | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cam/drm.cpp b/src/cam/drm.cpp
|
||||
index f253009..72c64c9 100644
|
||||
--- a/src/cam/drm.cpp
|
||||
+++ b/src/cam/drm.cpp
|
||||
@@ -393,8 +393,8 @@ Device::~Device()
|
||||
|
||||
int Device::init()
|
||||
{
|
||||
- constexpr size_t NODE_NAME_MAX = sizeof("/dev/dri/card255");
|
||||
- char name[NODE_NAME_MAX];
|
||||
+ //constexpr size_t NODE_NAME_MAX = sizeof("/dev/dri/card255");
|
||||
+ //char name[NODE_NAME_MAX];
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@@ -404,8 +404,10 @@ int Device::init()
|
||||
* from drmOpen() is of no practical use as any modern system will
|
||||
* handle that through udev or an equivalent component.
|
||||
*/
|
||||
- snprintf(name, sizeof(name), "/dev/dri/card%u", 0);
|
||||
- fd_ = open(name, O_RDWR | O_CLOEXEC);
|
||||
+ //snprintf(name, sizeof(name), "/dev/dri/card%u", 0);
|
||||
+ //fd_ = open(name, O_RDWR | O_CLOEXEC);
|
||||
+ const char *name = "starfive";
|
||||
+ fd_ = drmOpen(name, NULL);
|
||||
if (fd_ < 0) {
|
||||
ret = -errno;
|
||||
std::cerr
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
From 5021e32ddc68459c1d96a5ddb8c4225e82023130 Mon Sep 17 00:00:00 2001
|
||||
From: "Kevin.xie" <kevin.xie@starfivetech.com>
|
||||
Date: Thu, 4 Aug 2022 13:55:56 +0800
|
||||
Subject: [PATCH] libcamera-apps: Open drm device by module name 'starfive'
|
||||
|
||||
Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
|
||||
---
|
||||
preview/drm_preview.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/preview/drm_preview.cpp b/preview/drm_preview.cpp
|
||||
index a969358..df6bfb5 100644
|
||||
--- a/preview/drm_preview.cpp
|
||||
+++ b/preview/drm_preview.cpp
|
||||
@@ -241,8 +241,8 @@ void DrmPreview::findPlane()
|
||||
|
||||
DrmPreview::DrmPreview(Options const *options) : Preview(options), last_fd_(-1)
|
||||
{
|
||||
- // drmfd_ = drmOpen("vc4", NULL);
|
||||
- drmfd_ = open("/dev/dri/card0", O_RDWR | O_CLOEXEC);
|
||||
+ drmfd_ = drmOpen("starfive", NULL);
|
||||
+ // drmfd_ = open("/dev/dri/card0", O_RDWR | O_CLOEXEC);
|
||||
if (drmfd_ < 0)
|
||||
throw std::runtime_error("drmOpen failed: " + std::string(ERRSTR));
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Reference in New Issue
Block a user