Changeset 142587 in webkit
- Timestamp:
- Feb 11, 2013 11:26:45 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142586 r142587 1 2013-02-11 Viatcheslav Ostapenko <sl.ostapenko@samsung.com> 2 3 [Qt][EFL][WebGL] Minor refactoring of GraphicsSurface/GraphicsSurfaceGLX 4 https://bugs.webkit.org/show_bug.cgi?id=108686 5 6 Reviewed by Noam Rosenthal. 7 8 Remove unused platformSurface()/m_platformSurface from GraphicsSurface. 9 Move m_texture from GraphicsSurface to GLX GraphicsSurfacePrivate to match 10 Win and Mac implementations. 11 12 No new tests, refactoring only. 13 14 * platform/graphics/surfaces/GraphicsSurface.cpp: 15 (WebCore::GraphicsSurface::GraphicsSurface): 16 * platform/graphics/surfaces/GraphicsSurface.h: 17 (GraphicsSurface): 18 * platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp: 19 (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate): 20 (WebCore::GraphicsSurfacePrivate::swapBuffers): 21 (WebCore::GraphicsSurfacePrivate::surface): 22 (GraphicsSurfacePrivate): 23 (WebCore::GraphicsSurfacePrivate::textureID): 24 (WebCore::GraphicsSurfacePrivate::clear): 25 (WebCore::GraphicsSurface::platformExport): 26 (WebCore::GraphicsSurface::platformGetTextureID): 27 (WebCore::GraphicsSurface::platformSwapBuffers): 28 (WebCore::GraphicsSurface::platformCreate): 29 (WebCore::GraphicsSurface::platformImport): 30 (WebCore::GraphicsSurface::platformDestroy): 31 1 32 2013-02-11 Viatcheslav Ostapenko <sl.ostapenko@samsung.com> 2 33 -
trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp
r137058 r142587 86 86 GraphicsSurface::GraphicsSurface(const IntSize&, Flags flags) 87 87 : m_flags(flags) 88 , m_platformSurface(0)89 , m_texture(0)90 88 , m_fbo(0) 91 89 , m_private(0) -
trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
r135706 r142587 74 74 75 75 Flags flags() const { return m_flags; } 76 PlatformGraphicsSurface platformSurface() const { return m_platformSurface; }77 76 IntSize size() const; 78 77 … … 120 119 121 120 private: 122 PlatformGraphicsSurface m_platformSurface;123 uint32_t m_texture;124 121 uint32_t m_fbo; 125 122 GraphicsSurfacePrivate* m_private; -
trunk/Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
r142355 r142587 74 74 , m_detachedSurface(0) 75 75 , m_isReceiver(false) 76 , m_texture(0) 76 77 { 77 78 GLXContext shareContextObject = 0; … … 108 109 , m_detachedSurface(0) 109 110 , m_isReceiver(true) 111 , m_texture(0) 110 112 { 111 113 m_configSelector = adoptPtr(new GLXConfigSelector()); … … 191 193 void swapBuffers() 192 194 { 193 // The buffers are being switched on the writing side, the reading side just reads 194 // whatever texture the XWindow contains. 195 if (m_isReceiver) 195 if (isReceiver()) { 196 if (isMesaGLX() && textureID()) { 197 glBindTexture(GL_TEXTURE_2D, textureID()); 198 // Mesa doesn't re-bind texture to the front buffer on glXSwapBufer 199 // Manually release previous lock and rebind texture to surface to ensure frame updates. 200 pGlXReleaseTexImageEXT(display(), glxPixmap(), GLX_FRONT_EXT); 201 pGlXBindTexImageEXT(display(), glxPixmap(), GLX_FRONT_EXT, 0); 202 } 203 196 204 return; 205 } 197 206 198 207 GLXContext glContext = glXGetCurrentContext(); … … 262 271 TextureMapperGL::Flags flags() const { return m_flags; } 263 272 273 Window surface() const { return m_surface; } 274 275 GLuint textureID() const 276 { 277 if (m_texture) 278 return m_texture; 279 280 GLXPixmap pixmap = glxPixmap(); 281 if (!pixmap) 282 return 0; 283 284 GLuint texture; 285 glGenTextures(1, &texture); 286 glBindTexture(GL_TEXTURE_2D, texture); 287 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 288 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 289 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 290 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 291 pGlXBindTexImageEXT(display(), pixmap, GLX_FRONT_EXT, 0); 292 const_cast<GraphicsSurfacePrivate*>(this)->m_texture = texture; 293 294 return texture; 295 } 264 296 private: 265 297 void clear() 266 298 { 299 if (m_texture) { 300 pGlXReleaseTexImageEXT(display(), glxPixmap(), GLX_FRONT_EXT); 301 glDeleteTextures(1, &m_texture); 302 } 303 267 304 if (m_glxPixmap) { 268 305 glXDestroyPixmap(display(), m_glxPixmap); … … 301 338 bool m_isReceiver; 302 339 TextureMapperGL::Flags m_flags; 340 GLuint m_texture; 303 341 }; 304 342 … … 323 361 GraphicsSurfaceToken GraphicsSurface::platformExport() 324 362 { 325 return GraphicsSurfaceToken(m_p latformSurface);363 return GraphicsSurfaceToken(m_private->surface()); 326 364 } 327 365 328 366 uint32_t GraphicsSurface::platformGetTextureID() 329 367 { 330 if (!m_texture) { 331 GLXPixmap pixmap = m_private->glxPixmap(); 332 if (!pixmap) 333 return 0; 334 335 glGenTextures(1, &m_texture); 336 glBindTexture(GL_TEXTURE_2D, m_texture); 337 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 338 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 339 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 340 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 341 pGlXBindTexImageEXT(m_private->display(), pixmap, GLX_FRONT_EXT, 0); 342 } 343 344 return m_texture; 368 return m_private->textureID(); 345 369 } 346 370 … … 377 401 uint32_t GraphicsSurface::platformSwapBuffers() 378 402 { 379 if (m_private->isReceiver()) {380 if (isMesaGLX() && platformGetTextureID()) {381 glBindTexture(GL_TEXTURE_2D, platformGetTextureID());382 // Mesa doesn't re-bind texture to the front buffer on glXSwapBufer383 // Manually release previous lock and rebind texture to surface to get frame update.384 pGlXReleaseTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT);385 pGlXBindTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT, 0);386 }387 return 0;388 }389 390 403 m_private->swapBuffers(); 391 404 return 0; … … 411 424 return PassRefPtr<GraphicsSurface>(); 412 425 413 surface->m_p latformSurface = surface->m_private->createSurface(size);426 surface->m_private->createSurface(size); 414 427 415 428 return surface; … … 425 438 426 439 RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); 427 surface->m_platformSurface = token.frontBufferHandle; 428 429 surface->m_private = new GraphicsSurfacePrivate(surface->m_platformSurface); 440 441 surface->m_private = new GraphicsSurfacePrivate(token.frontBufferHandle); 430 442 if (!resolveGLMethods()) 431 443 return PassRefPtr<GraphicsSurface>(); … … 447 459 void GraphicsSurface::platformDestroy() 448 460 { 449 if (m_texture) {450 pGlXReleaseTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT);451 glDeleteTextures(1, &m_texture);452 }453 454 461 delete m_private; 455 462 m_private = 0;
Note: See TracChangeset
for help on using the changeset viewer.