Comments (5)
The following patch fixes the issue
diff --git a/platform/drm/cog-platform-drm.c b/platform/drm/cog-platform-drm.c
index be8521b..25a4f22 100644
--- a/platform/drm/cog-platform-drm.c
+++ b/platform/drm/cog-platform-drm.c
@@ -359,6 +359,7 @@ find_crtc_for_encoder(const drmModeRes *resources, const drmModeEncoder *encoder
const uint32_t crtc_mask = 1 << i;
const uint32_t crtc_id = resources->crtcs[i];
if (encoder->possible_crtcs & crtc_mask) {
+ //g_assert (encoder->crtc_id == crtc_id); // should this two values match? should be an if instead of an assert?
return crtc_id;
}
}
@@ -517,6 +518,9 @@ init_drm(void)
continue;
}
+ if (drm_data.encoder->encoder_id != drm_data.connector.obj->encoder_id)
+ continue;
+
const int32_t crtc_id = find_crtc_for_encoder(drm_data.base_resources, drm_data.encoder);
if (crtc_id != -1) {
drm_data.crtc.obj_id = crtc_id;
But I'm not sure if is the best approach because I'm not very familiar with this DRM code.
Some notes:
-
The commented assert on the patch above won't trigger in the RPi4 case, so is safe to keep the assert. Maybe it should be an
if
instead of an assert. -
See the following debug output produced with this patch: http://ix.io/4Jg0
Encoder[0]: has drm_data.encoder->encoder_id=31 and drm_data.connector.obj->encoder_id=41 and drm_data.encoder->crtc_id 0!
Encoder[1]: has drm_data.encoder->encoder_id=41 and drm_data.connector.obj->encoder_id=41 and drm_data.encoder->crtc_id 107!
Encoder[2]: has drm_data.encoder->encoder_id=58 and drm_data.connector.obj->encoder_id=41 and drm_data.encoder->crtc_id 0!
I have 6 crts with the following crt_ids
crt_number=0 has crt_id=57
crt_number=1 has crt_id=74
crt_number=2 has crt_id=85
crt_number=3 has crt_id=96
crt_number=4 has crt_id=107
crt_number=5 has crt_id=118
As you see, in this case (RPi4) I have 3 encoders and only one of those has a non-zero value for the crtc_id
. So maybe checking for drm_data.encoder->crtc_id != 0
is a god idea?
from cog.
As you see, in this case (RPi4) I have 3 encoders and only one of those has a non-zero value for the
crtc_id
. So maybe checking fordrm_data.encoder->crtc_id != 0
is a god idea?
Following that, I can see this alternative patch also fixes the issue on the RPi4
diff --git a/platform/drm/cog-platform-drm.c b/platform/drm/cog-platform-drm.c
index be8521b..b32d6a4 100644
--- a/platform/drm/cog-platform-drm.c
+++ b/platform/drm/cog-platform-drm.c
@@ -359,6 +359,7 @@ find_crtc_for_encoder(const drmModeRes *resources, const drmModeEncoder *encoder
const uint32_t crtc_mask = 1 << i;
const uint32_t crtc_id = resources->crtcs[i];
if (encoder->possible_crtcs & crtc_mask) {
+ //g_assert (encoder->crtc_id == crtc_id); // should this two values match? should be an if instead of an assert?
return crtc_id;
}
}
@@ -517,6 +518,9 @@ init_drm(void)
continue;
}
+ if (!drm_data.encoder->crtc_id)
+ continue;
+
const int32_t crtc_id = find_crtc_for_encoder(drm_data.base_resources, drm_data.encoder);
if (crtc_id != -1) {
drm_data.crtc.obj_id = crtc_id;
Basically we have to call the function find_crtc_for_encoder()
only with an encoder that has valid crtc_id
value (non-zero) .. Otherwise that function does not work as expected and returns something that causes issues later.
Not sure if is better this second patch or the previous one.
Comments?
from cog.
Interesting, this other patch fixes the issue as well:
diff --git a/platform/drm/cog-platform-drm.c b/platform/drm/cog-platform-drm.c
index be8521b..7516eec 100644
--- a/platform/drm/cog-platform-drm.c
+++ b/platform/drm/cog-platform-drm.c
@@ -359,7 +359,8 @@ find_crtc_for_encoder(const drmModeRes *resources, const drmModeEncoder *encoder
const uint32_t crtc_mask = 1 << i;
const uint32_t crtc_id = resources->crtcs[i];
if (encoder->possible_crtcs & crtc_mask) {
- return crtc_id;
+ if (encoder->crtc_id == crtc_id)
+ return crtc_id;
}
}
Basically turn the previous commented assertion into an if and do not check in the previous loop the value of the crtc_id
of the encoder.
Looks like a winner to me this last one.
I would like to know if this also works on the imx6 use case
from cog.
I wonder if this is the same bug/issue I am seeing here: #611
from cog.
Just merged a fix for this in #680
from cog.
Related Issues (20)
- VPU not used with cog HOT 12
- Disentangle CogShell from CogPlatform
- When drawing a pixel, also the pixel above is impacted HOT 2
- Difference handling needed on Visibility vs Focus for the Views
- Meson configure error when Cog is build only for wayland
- Missing cog-export.h header in the cogcore_headers
- gtk4: Pointer coordinates wrongly reported when the window is on a monitor with fractional scaling HOT 1
- [Clean-up] Remove redundant platform safe-guards in core
- Remove cog_platform_init_web_view() from the API
- MouseEvent buttons property not set in wayland backend
- Crash calling wl_pointer_set_cursor() in cog-utils.c HOT 2
- /snap/wpe-webkit-mir-kiosk/101/usr/bin/cog memory increases until it crashes.
- Identifiers for touch points are not constant in multi touch HOT 3
- cog flickering and not HW accelerated on NXP iMX8M-Plus HOT 2
- Latest COG w/DRM backend has no focus HOT 2
- [wpe-2.38.5][wpe-webkit-mir-kiosk] Long touch/press not working
- (wpe-webkit-mir-kiosk) - Launch homepage on idle HOT 3
- DRM key-repeat only repeats once
- Is DRM missing cog_launcher_get_viewport()?
- cogctl ping fails but reload etc works
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cog.