~ubuntu-branches/ubuntu/wily/mpv/wily

« back to all changes in this revision

Viewing changes to video/out/gl_x11.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-10-16 12:38:59 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131016123859-wj70wr6n3mzimx3e
Tags: 0.2.0-1
* New upstream release
* Install sample configuration files as examples
* Enable Lua scripting support
* Remove copyright for talloc (not used anymore)
* Update installed docs list
* Update 01_spelling.patch
* Enable VAAPI support

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    GLXContext new_context = glXCreateContext(display, glx_ctx->vinfo, NULL,
48
48
                                              True);
49
49
    if (!new_context) {
50
 
        mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GLX context!\n");
 
50
        MP_FATAL(vo, "Could not create GLX context!\n");
51
51
        return false;
52
52
    }
53
53
 
54
54
    if (!glXMakeCurrent(display, ctx->vo->x11->window, new_context)) {
55
 
        mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GLX context!\n");
 
55
        MP_FATAL(vo, "Could not set GLX context!\n");
56
56
        glXDestroyContext(display, new_context);
57
57
        return false;
58
58
    }
68
68
    if (glXExtStr)
69
69
        glxstr = glXExtStr(display, ctx->vo->x11->screen);
70
70
 
71
 
    mpgl_load_functions(gl, getProcAddress, glxstr);
 
71
    mpgl_load_functions(gl, getProcAddress, glxstr, vo->log);
72
72
    if (!gl->GenPrograms && gl->GetString &&
73
73
        gl->version < MPGL_VER(3, 0) &&
74
74
        strstr(gl->GetString(GL_EXTENSIONS), "GL_ARB_vertex_program"))
75
75
    {
76
 
        mp_msg(MSGT_VO, MSGL_WARN,
77
 
                "Broken glXGetProcAddress detected, trying workaround\n");
78
 
        mpgl_load_functions(gl, NULL, glxstr);
 
76
        MP_WARN(vo, "Broken glXGetProcAddress detected, trying workaround\n");
 
77
        mpgl_load_functions(gl, NULL, glxstr, vo->log);
79
78
    }
80
79
 
81
80
    glx_ctx->context = new_context;
124
123
                                                    glx_ctx->fbc, 0, True,
125
124
                                                    context_attribs);
126
125
    if (!context) {
127
 
        mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GLX context!\n");
 
126
        MP_FATAL(vo, "Could not create GLX context!\n");
128
127
        return false;
129
128
    }
130
129
 
131
130
    // set context
132
131
    if (!glXMakeCurrent(vo->x11->display, vo->x11->window, context)) {
133
 
        mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GLX context!\n");
 
132
        MP_FATAL(vo, "Could not set GLX context!\n");
134
133
        glXDestroyContext(vo->x11->display, context);
135
134
        return false;
136
135
    }
137
136
 
138
137
    glx_ctx->context = context;
139
138
 
140
 
    mpgl_load_functions(ctx->gl, (void *)glXGetProcAddress, glxstr);
 
139
    mpgl_load_functions(ctx->gl, (void *)glXGetProcAddress, glxstr, vo->log);
141
140
 
142
141
    if (!glXIsDirect(vo->x11->display, context))
143
142
        ctx->gl->mpgl_caps &= ~MPGL_CAP_NO_SW;
163
162
    if (flags & VOFLAG_ALPHA) {
164
163
        for (int n = 0; n < fbcount; n++) {
165
164
            XVisualInfo *v = glXGetVisualFromFBConfig(vo->x11->display, fbc[n]);
 
165
            if (!v)
 
166
                continue;
166
167
            // This is a heuristic at best. Note that normal 8 bit Visuals use
167
168
            // a depth of 24, even if the pixels are padded to 32 bit. If the
168
169
            // depth is higher than 24, the remaining bits must be alpha.
211
212
    if (!glXQueryVersion(vo->x11->display, &glx_major, &glx_minor) ||
212
213
        (MPGL_VER(glx_major, glx_minor) <  MPGL_VER(1, 3)))
213
214
    {
214
 
        mp_msg(MSGT_VO, MSGL_ERR, "[gl] GLX version older than 1.3.\n");
 
215
        MP_ERR(vo, "GLX version older than 1.3.\n");
215
216
        return false;
216
217
    }
217
218
 
238
239
        set_glx_attrib(glx_attribs, GLX_STEREO, True);
239
240
        fbc = select_fb_config(vo, glx_attribs, flags);
240
241
        if (!fbc) {
241
 
            mp_msg(MSGT_VO, MSGL_ERR, "[gl] Could not find a stereo visual,"
242
 
                   " 3D will probably not work!\n");
 
242
            MP_ERR(vo, "Could not find a stereo visual,"
 
243
                       " 3D will probably not work!\n");
243
244
            set_glx_attrib(glx_attribs, GLX_STEREO, False);
244
245
            flags &= ~VOFLAG_STEREO;
245
246
        }
247
248
    if (!fbc)
248
249
        fbc = select_fb_config(vo, glx_attribs, flags);
249
250
    if (!fbc) {
250
 
        mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
 
251
        MP_ERR(vo, "no GLX support present\n");
251
252
        return false;
252
253
    }
253
254
 
254
255
    glx_ctx->fbc = fbc;
255
256
    glx_ctx->vinfo = glXGetVisualFromFBConfig(vo->x11->display, fbc);
 
257
    if (!glx_ctx->vinfo) {
 
258
        MP_ERR(vo, "Selected GLX FB config has no associated X visual\n");
 
259
        return false;
 
260
    }
256
261
 
257
 
    mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n",
258
 
            (int)glx_ctx->vinfo->visualid);
 
262
    MP_VERBOSE(vo, "GLX chose visual with ID 0x%x\n", (int)glx_ctx->vinfo->visualid);
259
263
 
260
264
    glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_RED_SIZE, &ctx->depth_r);
261
265
    glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_GREEN_SIZE, &ctx->depth_g);