Re: Need help getting start with EGL/DRM/KMS/GLES2

Albert Freeman <[email protected]>
Newsgroups gmane.comp.video.mesa3d.user
Message-ID <CAHD8uZOKBpk=MF_uASLQS50vFE0m0pt8Vm+_B6Dp5CnWgajt5w@mail.gmail.com>
Well with these quick and dirty changes I made, it works fine on my
system, no segfault and the screen displays red.

--- gleskmsorg.c    2015-09-01 14:04:32.853672410 +0000
+++ gleskms.c    2015-09-01 14:03:57.797005474 +0000
@@ -24,8 +24,6 @@ EGL_CONFORMANT, EGL_OPENGL_ES2_BIT,
 EGL_NONE };

 static const char device_name[] = "/dev/dri/card0";
-static const uint32_t drm_mode_connector_id = 18;
-static const uint32_t drm_mode_crtc_id = 21;

 int main(void) {

@@ -86,10 +84,12 @@ int main(void) {
         exit(EXIT_FAILURE);
     }

+    drmModeRes *res;
     drmModeConnector *conn;
     uint32_t conn_id, width, height;
     drmModeModeInfo modeinfo;
-    conn = drmModeGetConnector(fd, drm_mode_connector_id);
+    res = drmModeGetResources(fd);
+    conn = drmModeGetConnector(fd, *res->connectors);
     conn_id = conn->connector_id;
     width = conn->modes[0].hdisplay;
     height = conn->modes[0].vdisplay;
@@ -129,7 +129,7 @@ int main(void) {
         exit(EXIT_FAILURE);
     }

-    ret = drmModeSetCrtc(fd, drm_mode_crtc_id, drm_fb_id, 0, 0, &conn_id, 1,
+    ret = drmModeSetCrtc(fd, *res->crtcs, drm_fb_id, 0, 0, &conn_id, 1,
             &modeinfo);
     if (ret) {
         printf("failed to set mode: %m\n");
@@ -143,8 +143,8 @@ int main(void) {
     gbm_surface_destroy(gs);
     eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
     eglDestroyContext(dpy, ctx);
-//    eglDestroySurface(dpy, surface);
-//    eglTerminate(dpy);
+    eglDestroySurface(dpy, surface);
+    eglTerminate(dpy);
     gbm_device_destroy(gbm);
     close(fd);
     return 0;
_______________________________________________
mesa-users mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.