-
-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: unbreak compilation on OpenBSD #1188
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #1188 +/- ##
=======================================
Coverage 36.62% 36.62%
=======================================
Files 50 50
Lines 11555 11555
=======================================
Hits 4232 4232
Misses 7323 7323
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good, but I have a question.
src/backend/gl/gl_common.c
Outdated
@@ -1213,6 +1213,14 @@ bool gl_last_render_time(backend_t *base, struct timespec *ts) { | |||
return false; | |||
} | |||
|
|||
/// Obtain proc address for glGetQueryObjectui64v in OpenBSD | |||
/// because the symbol function not appear directly in libgl for Mesa in this OS | |||
#ifdef __OpenBSD__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this ifdef
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we should save this pointer somewhere, instead of calling GetProcAddress every frame.
And you second commit's message is copied twice |
src/backend/gl/gl_common.c
Outdated
/// because the symbol function not appear directly in libgl for Mesa in this OS | ||
#ifdef __OpenBSD__ | ||
static PFNGLGETQUERYOBJECTUI64VPROC glGetQueryObjectui64v = NULL; | ||
glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this \
for?
f510d8f
to
1cad55f
Compare
src/backend/gl/gl_common.c
Outdated
// We need obtain proc pointer for glGetQueryObjectui64v function. | ||
// In OpenBSD this function no appear publicly, glXGetProcAddress resolve the issue. | ||
if(ptrglGetQueryObjectui64v == NULL) { | ||
ptrglGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) | ||
glXGetProcAddress("glGetQueryObjectui64v"); | ||
|
||
GLuint64 time; | ||
ptrglGetQueryObjectui64v(gd->frame_timing[gd->current_frame_timing ^ 1], | ||
GL_QUERY_RESULT, &time); | ||
ts->tv_sec = (long)(time / 1000000000); | ||
ts->tv_nsec = (long)(time % 1000000000); | ||
gl_check_err(); | ||
} | ||
else { | ||
GLuint64 time; | ||
ptrglGetQueryObjectui64v(gd->frame_timing[gd->current_frame_timing ^ 1], | ||
GL_QUERY_RESULT, &time); | ||
ts->tv_sec = (long)(time / 1000000000); | ||
ts->tv_nsec = (long)(time % 1000000000); | ||
gl_check_err(); | ||
} | ||
|
||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to copy-and-paste code here.
a good place for GetProcAddress is gl_init
.
@yukiteruamano there are some extra considerations i just found out about the opengl problem. we might go a different route, so let's merge the sched fix first |
77aeedb
to
902b5d5
Compare
OpenBSD don't have support for sched_getparam(), sched_setparam(), or sched_setscheduler() functions (yet). In this case, we need use pthead-equivalents for real-time sched for picom. Theses changes add this support. Authored-by: Jose Maldonado aka Yukiteru <josemald89@gmail.com> Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
@yukiteruamano thanks for the PR, and for being patient with the feedbacks. 👍 |
@yshui Not problem, thanks for you help, my knowledge in C/git is limited, but with this changes I have been able to unbreak the build and use picom v11+ without problems with amdgpu on OpenBSD, and if the changes arrive and are maintained upstream they will generate fewer problems to compile and maintain the project on OpenBSD. |
@yshui As you had asked me, the final changes each in their own commit, I have already compiled the binary and it works without problems. Take a look.
picom-unbreak-openbsd.log