Fixup glx support
Renaming glamor_priv->dispatch and wrapping the access to the dispatch table with a function that also ensured the context was bound. dispatch = glamor_get_dispatch(glamor_priv); ... glamor_put_dispatch(glamor_priv); So that we catch all places where we attempt to call into GL withouta context. As an optimisation we can then do glamor_get_context(); glamor_put_context() around the rendering entry points to reduce the frequency of having to restore the old context. (Along with allowing the context to be recursively acquired and making the old context part of the glamor_egl state.) Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com> Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
430bc16ca0
commit
556adfa6b9
|
@ -196,24 +196,25 @@ glamor_block_handler(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
glamor_priv->tick++;
|
glamor_priv->tick++;
|
||||||
dispatch->glFlush();
|
dispatch->glFlush();
|
||||||
dispatch->glFinish();
|
dispatch->glFinish();
|
||||||
glamor_fbo_expire(glamor_priv);
|
glamor_fbo_expire(glamor_priv);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_glamor_block_handler(void *data, OSTimePtr timeout,
|
_glamor_block_handler(void *data, OSTimePtr timeout,
|
||||||
void *last_select_mask)
|
void *last_select_mask)
|
||||||
{
|
{
|
||||||
glamor_gl_dispatch *dispatch = data;
|
glamor_screen_private *glamor_priv = data;
|
||||||
|
glamor_gl_dispatch *dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glFlush();
|
dispatch->glFlush();
|
||||||
dispatch->glFinish();
|
dispatch->glFinish();
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -289,8 +290,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glamor_gl_dispatch_init(screen, &glamor_priv->dispatch,
|
glamor_gl_dispatch_init(screen, &glamor_priv->_dispatch, gl_version);
|
||||||
gl_version);
|
|
||||||
|
|
||||||
#ifdef GLAMOR_GLES2
|
#ifdef GLAMOR_GLES2
|
||||||
if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
|
if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) {
|
||||||
|
@ -303,8 +303,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
glamor_gl_has_extension("GL_MESA_pack_invert");
|
glamor_gl_has_extension("GL_MESA_pack_invert");
|
||||||
glamor_priv->has_fbo_blit =
|
glamor_priv->has_fbo_blit =
|
||||||
glamor_gl_has_extension("GL_EXT_framebuffer_blit");
|
glamor_gl_has_extension("GL_EXT_framebuffer_blit");
|
||||||
glamor_priv->dispatch.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE,
|
glamor_priv->_dispatch.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE,
|
||||||
&glamor_priv->max_fbo_size);
|
&glamor_priv->max_fbo_size);
|
||||||
|
|
||||||
glamor_set_debug_level(&glamor_debug_level);
|
glamor_set_debug_level(&glamor_debug_level);
|
||||||
|
|
||||||
|
@ -324,8 +324,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
if (flags & GLAMOR_USE_SCREEN) {
|
if (flags & GLAMOR_USE_SCREEN) {
|
||||||
if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
|
if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
|
||||||
_glamor_wakeup_handler,
|
_glamor_wakeup_handler,
|
||||||
(void *)
|
glamor_priv)) {
|
||||||
&glamor_priv->dispatch)) {
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,18 +28,16 @@
|
||||||
#ifndef GLAMOR_H
|
#ifndef GLAMOR_H
|
||||||
#define GLAMOR_H
|
#define GLAMOR_H
|
||||||
|
|
||||||
#include "scrnintstr.h"
|
#include <scrnintstr.h>
|
||||||
#ifdef GLAMOR_FOR_XORG
|
#ifdef GLAMOR_FOR_XORG
|
||||||
#include "xf86str.h"
|
#include <xf86str.h>
|
||||||
#endif
|
#endif
|
||||||
#include "pixmapstr.h"
|
#include <pixmapstr.h>
|
||||||
#include "windowstr.h"
|
#include <windowstr.h>
|
||||||
#include "gcstruct.h"
|
#include <gcstruct.h>
|
||||||
#include "picturestr.h"
|
#include <picturestr.h>
|
||||||
#include "fb.h"
|
#include <fb.h>
|
||||||
#include "fbpict.h"
|
#include <fbpict.h>
|
||||||
|
|
||||||
#endif /* GLAMOR_H */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* glamor_pixmap_type : glamor pixmap's type.
|
* glamor_pixmap_type : glamor pixmap's type.
|
||||||
|
@ -145,9 +143,8 @@ extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
|
||||||
|
|
||||||
extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen);
|
extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen);
|
||||||
|
|
||||||
extern _X_EXPORT void * glamor_egl_make_current(ScreenPtr screen);
|
extern _X_EXPORT void glamor_egl_make_current(ScreenPtr screen);
|
||||||
|
extern _X_EXPORT void glamor_egl_restore_context(ScreenPtr screen);
|
||||||
extern _X_EXPORT void glamor_egl_restore_context(ScreenPtr screen, void *context);
|
|
||||||
|
|
||||||
#ifdef GLAMOR_FOR_XORG
|
#ifdef GLAMOR_FOR_XORG
|
||||||
|
|
||||||
|
@ -320,3 +317,4 @@ extern _X_EXPORT Bool glamor_poly_line_nf(DrawablePtr pDrawable, GCPtr pGC, int
|
||||||
extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
DDXPointPtr points);
|
DDXPointPtr points);
|
||||||
|
|
||||||
|
#endif /* GLAMOR_H */
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
|
|
@ -21,10 +21,6 @@
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_copyarea.c
|
/** @file glamor_copyarea.c
|
||||||
|
@ -43,7 +39,7 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
|
||||||
glamor_pixmap_private *src_pixmap_priv;
|
glamor_pixmap_private *src_pixmap_priv;
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
int dst_x_off, dst_y_off, src_x_off, src_y_off, i;
|
int dst_x_off, dst_y_off, src_x_off, src_y_off, i;
|
||||||
|
|
||||||
if (!glamor_priv->has_fbo_blit) {
|
if (!glamor_priv->has_fbo_blit) {
|
||||||
|
@ -78,6 +74,7 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
|
||||||
}
|
}
|
||||||
glamor_validate_pixmap(dst_pixmap);
|
glamor_validate_pixmap(dst_pixmap);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT,
|
dispatch->glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT,
|
||||||
src_pixmap_priv->fbo->fb);
|
src_pixmap_priv->fbo->fb);
|
||||||
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
|
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
|
||||||
|
@ -136,6 +133,7 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -147,7 +145,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(dst->pScreen);
|
glamor_get_screen_private(dst->pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src);
|
PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src);
|
||||||
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
|
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
|
||||||
int i;
|
int i;
|
||||||
|
@ -158,23 +156,24 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||||
enum glamor_pixmap_status src_status = GLAMOR_NONE;
|
enum glamor_pixmap_status src_status = GLAMOR_NONE;
|
||||||
GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale;
|
GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale;
|
||||||
int flush_needed = 0;
|
int flush_needed = 0;
|
||||||
|
int alu = GXcopy;
|
||||||
|
|
||||||
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
|
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
|
||||||
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
|
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
|
||||||
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
|
||||||
glamor_delayed_fallback(dst->pScreen, "dst has no fbo.\n");
|
glamor_delayed_fallback(dst->pScreen, "dst has no fbo.\n");
|
||||||
goto fail;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src_pixmap_priv || !src_pixmap_priv->gl_fbo) {
|
if (!src_pixmap_priv || !src_pixmap_priv->gl_fbo) {
|
||||||
#ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
#ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
||||||
glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n");
|
glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n");
|
||||||
goto fail;
|
return FALSE;
|
||||||
#else
|
#else
|
||||||
src_status = glamor_upload_pixmap_to_texture(src_pixmap);
|
src_status = glamor_upload_pixmap_to_texture(src_pixmap);
|
||||||
if (src_status != GLAMOR_UPLOAD_DONE)
|
if (src_status != GLAMOR_UPLOAD_DONE)
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
|
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,25 +181,26 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||||
flush_needed = 1;
|
flush_needed = 1;
|
||||||
|
|
||||||
if (gc) {
|
if (gc) {
|
||||||
glamor_set_alu(dispatch, gc->alu);
|
|
||||||
if (!glamor_set_planemask(dst_pixmap, gc->planemask))
|
if (!glamor_set_planemask(dst_pixmap, gc->planemask))
|
||||||
goto fail;
|
return FALSE;
|
||||||
if (gc->alu != GXcopy) {
|
alu = gc->alu;
|
||||||
glamor_set_destination_pixmap_priv_nc
|
|
||||||
(src_pixmap_priv);
|
|
||||||
glamor_validate_pixmap(src_pixmap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
|
|
||||||
glamor_validate_pixmap(dst_pixmap);
|
|
||||||
|
|
||||||
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
|
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
|
||||||
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale);
|
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale);
|
||||||
|
|
||||||
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
|
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
|
||||||
&dst_y_off);
|
&dst_y_off);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
|
|
||||||
|
glamor_set_alu(dispatch, alu);
|
||||||
|
if (alu != GXcopy) {
|
||||||
|
glamor_set_destination_pixmap_priv_nc (src_pixmap_priv);
|
||||||
|
glamor_validate_pixmap(src_pixmap);
|
||||||
|
}
|
||||||
|
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
|
||||||
|
glamor_validate_pixmap(dst_pixmap);
|
||||||
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||||
GL_FALSE, 2 * sizeof(float),
|
GL_FALSE, 2 * sizeof(float),
|
||||||
vertices);
|
vertices);
|
||||||
|
@ -284,12 +284,8 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
|
||||||
/* The source texture is bound to a fbo, we have to flush it here. */
|
/* The source texture is bound to a fbo, we have to flush it here. */
|
||||||
if (flush_needed)
|
if (flush_needed)
|
||||||
dispatch->glFlush();
|
dispatch->glFlush();
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
|
||||||
glamor_set_alu(dispatch, GXcopy);
|
|
||||||
glamor_set_planemask(dst_pixmap, ~0);
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -317,7 +313,6 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
||||||
int i;
|
int i;
|
||||||
int overlaped = 0;
|
int overlaped = 0;
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
dst_pixmap = glamor_get_drawable_pixmap(dst);
|
dst_pixmap = glamor_get_drawable_pixmap(dst);
|
||||||
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
|
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
|
||||||
|
@ -326,7 +321,6 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
||||||
screen = dst_pixmap->drawable.pScreen;
|
screen = dst_pixmap->drawable.pScreen;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(dst->pScreen);
|
glamor_priv = glamor_get_screen_private(dst->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
|
||||||
glamor_fallback("dest pixmap %p has no fbo. \n",
|
glamor_fallback("dest pixmap %p has no fbo. \n",
|
||||||
|
@ -448,7 +442,6 @@ _glamor_copy_n_to_n(DrawablePtr src,
|
||||||
glamor_clear_delayed_fallbacks(dst->pScreen);
|
glamor_clear_delayed_fallbacks(dst->pScreen);
|
||||||
if (temp_src != src)
|
if (temp_src != src)
|
||||||
glamor_destroy_pixmap(temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -37,7 +33,6 @@ _glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||||
int srcx, int srcy, int w, int h, int dstx, int dsty,
|
int srcx, int srcy, int w, int h, int dstx, int dsty,
|
||||||
unsigned long bitPlane, RegionPtr *pRegion, Bool fallback)
|
unsigned long bitPlane, RegionPtr *pRegion, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
glamor_screen_private *glamor_priv;
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
|
@ -47,14 +42,12 @@ _glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDst->pScreen);
|
glamor_priv = glamor_get_screen_private(pDst->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
glamor_prepare_access(pDst, GLAMOR_ACCESS_RW);
|
glamor_prepare_access(pDst, GLAMOR_ACCESS_RW);
|
||||||
glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO);
|
glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO);
|
||||||
*pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,
|
*pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,
|
||||||
dstx, dsty, bitPlane);
|
dstx, dsty, bitPlane);
|
||||||
glamor_finish_access(pSrc, GLAMOR_ACCESS_RO);
|
glamor_finish_access(pSrc, GLAMOR_ACCESS_RO);
|
||||||
glamor_finish_access(pDst, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDst, GLAMOR_ACCESS_RW);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -21,10 +21,6 @@
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_copywindow.c
|
/** @file glamor_copywindow.c
|
||||||
|
|
|
@ -31,10 +31,6 @@
|
||||||
* This file covers core X rendering in glamor.
|
* This file covers core X rendering in glamor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
@ -174,7 +170,7 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||||
GLint sampler_uniform_location;
|
GLint sampler_uniform_location;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
glamor_priv->finish_access_prog[0] = dispatch->glCreateProgram();
|
glamor_priv->finish_access_prog[0] = dispatch->glCreateProgram();
|
||||||
glamor_priv->finish_access_prog[1] = dispatch->glCreateProgram();
|
glamor_priv->finish_access_prog[1] = dispatch->glCreateProgram();
|
||||||
|
|
||||||
|
@ -248,7 +244,7 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
||||||
dispatch->glUniform1i(sampler_uniform_location, 0);
|
dispatch->glUniform1i(sampler_uniform_location, 0);
|
||||||
dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
|
dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -258,9 +254,10 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
|
||||||
glamor_gl_dispatch *dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glDeleteProgram(glamor_priv->finish_access_prog[0]);
|
dispatch->glDeleteProgram(glamor_priv->finish_access_prog[0]);
|
||||||
dispatch->glDeleteProgram(glamor_priv->finish_access_prog[1]);
|
dispatch->glDeleteProgram(glamor_priv->finish_access_prog[1]);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -271,7 +268,6 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(drawable->pScreen);
|
glamor_get_screen_private(drawable->pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
|
||||||
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv))
|
||||||
return;
|
return;
|
||||||
|
@ -281,11 +277,17 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pixmap_priv->fbo->pbo != 0 && pixmap_priv->fbo->pbo_valid) {
|
if (pixmap_priv->fbo->pbo != 0 && pixmap_priv->fbo->pbo_valid) {
|
||||||
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
|
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||||
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
pixmap_priv->fbo->pbo_valid = FALSE;
|
|
||||||
dispatch->glDeleteBuffers(1, &pixmap_priv->fbo->pbo);
|
dispatch->glDeleteBuffers(1, &pixmap_priv->fbo->pbo);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
|
|
||||||
|
pixmap_priv->fbo->pbo_valid = FALSE;
|
||||||
pixmap_priv->fbo->pbo = 0;
|
pixmap_priv->fbo->pbo = 0;
|
||||||
} else {
|
} else {
|
||||||
free(pixmap->devPrivate.ptr);
|
free(pixmap->devPrivate.ptr);
|
||||||
|
|
|
@ -31,11 +31,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
#define GLAMOR_FOR_XORG
|
#define GLAMOR_FOR_XORG
|
||||||
#include "xorg-server.h"
|
#include <xorg-server.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
@ -93,7 +90,8 @@ struct glamor_egl_screen_private {
|
||||||
struct gbm_device *gbm;
|
struct gbm_device *gbm;
|
||||||
#endif
|
#endif
|
||||||
int has_gem;
|
int has_gem;
|
||||||
void *gl_context;
|
void *gl_context, *old_context;
|
||||||
|
int gl_context_depth;
|
||||||
|
|
||||||
PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr;
|
PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr;
|
||||||
PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr;
|
PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr;
|
||||||
|
@ -112,13 +110,18 @@ glamor_egl_get_screen_private(ScrnInfoPtr scrn)
|
||||||
scrn->privates[xf86GlamorEGLPrivateIndex].ptr;
|
scrn->privates[xf86GlamorEGLPrivateIndex].ptr;
|
||||||
}
|
}
|
||||||
#ifdef GLX_USE_SHARED_DISPATCH
|
#ifdef GLX_USE_SHARED_DISPATCH
|
||||||
_X_EXPORT void *
|
_X_EXPORT void
|
||||||
glamor_egl_make_current(ScreenPtr screen)
|
glamor_egl_make_current(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||||
struct glamor_egl_screen_private *glamor_egl =
|
struct glamor_egl_screen_private *glamor_egl =
|
||||||
glamor_egl_get_screen_private(scrn);
|
glamor_egl_get_screen_private(scrn);
|
||||||
|
|
||||||
|
if (glamor_egl->gl_context_depth++)
|
||||||
|
return;
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(current);
|
GET_CURRENT_CONTEXT(current);
|
||||||
|
glamor_egl->old_context = current;
|
||||||
|
|
||||||
if (glamor_egl->gl_context != current) {
|
if (glamor_egl->gl_context != current) {
|
||||||
eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE,
|
eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE,
|
||||||
|
@ -126,24 +129,28 @@ glamor_egl_make_current(ScreenPtr screen)
|
||||||
if (!eglMakeCurrent(glamor_egl->display,
|
if (!eglMakeCurrent(glamor_egl->display,
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
glamor_egl->context)) {
|
glamor_egl->context)) {
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
FatalError("Failed to make EGL context current\n");
|
||||||
"Failed to make EGL context current\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
return current;
|
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT void
|
_X_EXPORT void
|
||||||
glamor_egl_restore_context(ScreenPtr screen, void *context)
|
glamor_egl_restore_context(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
if (context)
|
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||||
SET_CURRENT_CONTEXT(context);
|
struct glamor_egl_screen_private *glamor_egl =
|
||||||
|
glamor_egl_get_screen_private(scrn);
|
||||||
|
|
||||||
|
if (--glamor_egl->gl_context_depth)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (glamor_egl->old_context &&
|
||||||
|
glamor_egl->gl_context != glamor_egl->old_context)
|
||||||
|
SET_CURRENT_CONTEXT(glamor_egl->old_context);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define glamor_egl_make_current(x) NULL
|
#define glamor_egl_make_current(x)
|
||||||
#define glamor_egl_restore_context(s, c)
|
#define glamor_egl_restore_context(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static EGLImageKHR
|
static EGLImageKHR
|
||||||
|
@ -252,12 +259,11 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
||||||
EGLImageKHR image;
|
EGLImageKHR image;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
int name;
|
int name;
|
||||||
void *prev_context;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
glamor_egl = glamor_egl_get_screen_private(scrn);
|
glamor_egl = glamor_egl_get_screen_private(scrn);
|
||||||
|
|
||||||
prev_context = glamor_egl_make_current(screen);
|
glamor_egl_make_current(screen);
|
||||||
if (glamor_egl->has_gem) {
|
if (glamor_egl->has_gem) {
|
||||||
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
|
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||||
|
@ -285,8 +291,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (prev_context)
|
glamor_egl_restore_context(screen);
|
||||||
glamor_egl_restore_context(screen, prev_context);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,6 +502,13 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
|
||||||
#endif
|
#endif
|
||||||
glamor_egl->saved_free_screen = scrn->FreeScreen;
|
glamor_egl->saved_free_screen = scrn->FreeScreen;
|
||||||
scrn->FreeScreen = glamor_egl_free_screen;
|
scrn->FreeScreen = glamor_egl_free_screen;
|
||||||
|
#ifdef GLAMOR_GLES2
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using GLES2.\n");
|
||||||
|
#ifdef GLX_USE_SHARED_DISPATCH
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Glamor is using GLES2 but GLX needs GL. "
|
||||||
|
"Indirect GLX may not work correctly.\n");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <xorg-server.h>
|
|
||||||
#define GLAMOR_FOR_XORG
|
#define GLAMOR_FOR_XORG
|
||||||
#include "glamor.h"
|
#include "glamor.h"
|
||||||
#include "xf86Module.h"
|
#include <xf86Module.h>
|
||||||
|
#include <xorg-server.h>
|
||||||
|
|
||||||
static XF86ModuleVersionInfo VersRec = {
|
static XF86ModuleVersionInfo VersRec = {
|
||||||
GLAMOR_EGL_MODULE_NAME,
|
GLAMOR_EGL_MODULE_NAME,
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
@ -126,17 +122,14 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
||||||
void
|
void
|
||||||
glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
glamor_gl_dispatch *dispatch = glamor_get_dispatch(fbo->glamor_priv);
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(fbo->glamor_priv);
|
|
||||||
glamor_gl_dispatch *dispatch = &fbo->glamor_priv->dispatch;
|
|
||||||
if (fbo->fb)
|
if (fbo->fb)
|
||||||
dispatch->glDeleteFramebuffers(1, &fbo->fb);
|
dispatch->glDeleteFramebuffers(1, &fbo->fb);
|
||||||
if (fbo->tex)
|
if (fbo->tex)
|
||||||
dispatch->glDeleteTextures(1, &fbo->tex);
|
dispatch->glDeleteTextures(1, &fbo->tex);
|
||||||
if (fbo->pbo)
|
if (fbo->pbo)
|
||||||
dispatch->glDeleteBuffers(1, &fbo->pbo);
|
dispatch->glDeleteBuffers(1, &fbo->pbo);
|
||||||
GLAMOR_RESTORE_CONTEXT(fbo->glamor_priv);
|
glamor_put_dispatch(fbo->glamor_priv);
|
||||||
|
|
||||||
free(fbo);
|
free(fbo);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +285,6 @@ glamor_create_tex_obj(glamor_screen_private *glamor_priv,
|
||||||
glamor_pixmap_fbo *fbo;
|
glamor_pixmap_fbo *fbo;
|
||||||
int cache_flag = GLAMOR_CACHE_TEXTURE;
|
int cache_flag = GLAMOR_CACHE_TEXTURE;
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
if (flag == GLAMOR_CREATE_TEXTURE_EXACT_SIZE)
|
if (flag == GLAMOR_CREATE_TEXTURE_EXACT_SIZE)
|
||||||
cache_flag |= GLAMOR_CACHE_EXACT_SIZE;
|
cache_flag |= GLAMOR_CACHE_EXACT_SIZE;
|
||||||
|
@ -305,10 +297,9 @@ glamor_create_tex_obj(glamor_screen_private *glamor_priv,
|
||||||
if (fbo == NULL)
|
if (fbo == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
list_init(&fbo->list);
|
list_init(&fbo->list);
|
||||||
|
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glGenTextures(1, &tex);
|
dispatch->glGenTextures(1, &tex);
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||||
|
@ -317,12 +308,13 @@ glamor_create_tex_obj(glamor_screen_private *glamor_priv,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, format,
|
dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, format,
|
||||||
GL_UNSIGNED_BYTE, NULL);
|
GL_UNSIGNED_BYTE, NULL);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
|
|
||||||
fbo->tex = tex;
|
fbo->tex = tex;
|
||||||
fbo->width = w;
|
fbo->width = w;
|
||||||
fbo->height = h;
|
fbo->height = h;
|
||||||
fbo->format = format;
|
fbo->format = format;
|
||||||
fbo->glamor_priv = glamor_priv;
|
fbo->glamor_priv = glamor_priv;
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
|
|
||||||
return fbo;
|
return fbo;
|
||||||
}
|
}
|
||||||
|
@ -344,7 +336,6 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
|
||||||
GLenum format;
|
GLenum format;
|
||||||
GLint tex;
|
GLint tex;
|
||||||
int cache_flag;
|
int cache_flag;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
if (!glamor_check_fbo_size(glamor_priv, w, h)
|
if (!glamor_check_fbo_size(glamor_priv, w, h)
|
||||||
|| !glamor_check_fbo_depth(depth))
|
|| !glamor_check_fbo_depth(depth))
|
||||||
|
@ -364,9 +355,7 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
|
||||||
if (fbo)
|
if (fbo)
|
||||||
return fbo;
|
return fbo;
|
||||||
new_fbo:
|
new_fbo:
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
dispatch = &glamor_priv->dispatch;
|
|
||||||
dispatch->glGenTextures(1, &tex);
|
dispatch->glGenTextures(1, &tex);
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||||
|
@ -377,7 +366,7 @@ new_fbo:
|
||||||
GL_UNSIGNED_BYTE, NULL);
|
GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, depth, tex, flag);
|
fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, depth, tex, flag);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
glamor_put_dispatch(glamor_priv);
|
||||||
|
|
||||||
return fbo;
|
return fbo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,6 @@
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_fillspans.c
|
/** @file glamor_fillspans.c
|
||||||
|
@ -112,7 +108,7 @@ glamor_init_solid_shader(ScreenPtr screen)
|
||||||
GLint fs_prog, vs_prog;
|
GLint fs_prog, vs_prog;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
glamor_priv->solid_prog = dispatch->glCreateProgram();
|
glamor_priv->solid_prog = dispatch->glCreateProgram();
|
||||||
vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, solid_vs);
|
vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, solid_vs);
|
||||||
fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER,
|
fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER,
|
||||||
|
@ -127,6 +123,7 @@ glamor_init_solid_shader(ScreenPtr screen)
|
||||||
glamor_priv->solid_color_uniform_location =
|
glamor_priv->solid_color_uniform_location =
|
||||||
dispatch->glGetUniformLocation(glamor_priv->solid_prog,
|
dispatch->glGetUniformLocation(glamor_priv->solid_prog,
|
||||||
"color");
|
"color");
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -136,8 +133,9 @@ glamor_fini_solid_shader(ScreenPtr screen)
|
||||||
glamor_gl_dispatch *dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glDeleteProgram(glamor_priv->solid_prog);
|
dispatch->glDeleteProgram(glamor_priv->solid_prog);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -150,7 +148,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_pixmap_private *pixmap_priv =
|
glamor_pixmap_private *pixmap_priv =
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
int x1 = x;
|
int x1 = x;
|
||||||
int x2 = x + width;
|
int x2 = x + width;
|
||||||
int y1 = y;
|
int y1 = y;
|
||||||
|
@ -158,15 +156,16 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
GLfloat color[4];
|
GLfloat color[4];
|
||||||
float vertices[8];
|
float vertices[8];
|
||||||
GLfloat xscale, yscale;
|
GLfloat xscale, yscale;
|
||||||
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
|
||||||
glamor_fallback("dest %p has no fbo.\n", pixmap);
|
glamor_fallback("dest %p has no fbo.\n", pixmap);
|
||||||
goto fail;
|
return FALSE;
|
||||||
}
|
}
|
||||||
glamor_set_alu(dispatch, alu);
|
|
||||||
if (!glamor_set_planemask(pixmap, planemask)) {
|
if (!glamor_set_planemask(pixmap, planemask)) {
|
||||||
glamor_fallback
|
glamor_fallback
|
||||||
("Failedto set planemask in glamor_solid.\n");
|
("Failedto set planemask in glamor_solid.\n");
|
||||||
goto fail;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_get_rgba_from_pixel(fg_pixel,
|
glamor_get_rgba_from_pixel(fg_pixel,
|
||||||
|
@ -189,6 +188,8 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||||
glamor_validate_pixmap(pixmap);
|
glamor_validate_pixmap(pixmap);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
|
glamor_set_alu(dispatch, alu);
|
||||||
dispatch->glUseProgram(glamor_priv->solid_prog);
|
dispatch->glUseProgram(glamor_priv->solid_prog);
|
||||||
|
|
||||||
dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location,
|
dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location,
|
||||||
|
@ -205,9 +206,6 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
fail:
|
|
||||||
glamor_set_alu(dispatch, GXcopy);
|
|
||||||
glamor_set_planemask(pixmap, ~0);
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,6 @@
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @file glamor_fillspans.c
|
/** @file glamor_fillspans.c
|
||||||
*
|
*
|
||||||
* FillSpans implementation, taken from fb_fillsp.c
|
* FillSpans implementation, taken from fb_fillsp.c
|
||||||
|
@ -41,11 +37,9 @@ _glamor_fill_spans(DrawablePtr drawable,
|
||||||
int x1, x2, y;
|
int x1, x2, y;
|
||||||
RegionPtr pClip = fbGetCompositeClip(gc);
|
RegionPtr pClip = fbGetCompositeClip(gc);
|
||||||
glamor_screen_private *glamor_priv;
|
glamor_screen_private *glamor_priv;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
|
|
||||||
if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled)
|
if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -99,7 +93,6 @@ fail:
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,13 +42,11 @@ _glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
|
||||||
int no_alpha, no_revert;
|
int no_alpha, no_revert;
|
||||||
PixmapPtr temp_pixmap = NULL;
|
PixmapPtr temp_pixmap = NULL;
|
||||||
glamor_gl_dispatch * dispatch;
|
glamor_gl_dispatch * dispatch;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
goto fall_back;
|
goto fall_back;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
|
|
||||||
if (format != ZPixmap)
|
if (format != ZPixmap)
|
||||||
goto fall_back;
|
goto fall_back;
|
||||||
|
@ -65,7 +59,6 @@ _glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
|
||||||
}
|
}
|
||||||
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
dispatch = &glamor_priv->dispatch;
|
|
||||||
|
|
||||||
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -97,6 +90,8 @@ _glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
|
||||||
|
|
||||||
int row_length = PixmapBytePad(w, drawable->depth);
|
int row_length = PixmapBytePad(w, drawable->depth);
|
||||||
row_length = (row_length * 8) / drawable->bitsPerPixel;
|
row_length = (row_length * 8) / drawable->bitsPerPixel;
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||||
dispatch->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
dispatch->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
dispatch->glPixelStorei(GL_PACK_ROW_LENGTH, row_length);
|
dispatch->glPixelStorei(GL_PACK_ROW_LENGTH, row_length);
|
||||||
|
@ -117,14 +112,13 @@ _glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
|
||||||
h,
|
h,
|
||||||
tex_format,
|
tex_format,
|
||||||
tex_type, d);
|
tex_type, d);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
if (temp_pixmap)
|
if (temp_pixmap)
|
||||||
glamor_destroy_pixmap(temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
fall_back:
|
fall_back:
|
||||||
|
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
if (ret == FALSE)
|
if (ret == FALSE)
|
||||||
miGetImage(drawable, x, y, w, h, format, planeMask, d);
|
miGetImage(drawable, x, y, w, h, format, planeMask, d);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -44,15 +40,13 @@ _glamor_get_spans(DrawablePtr drawable,
|
||||||
glamor_get_screen_private(drawable->pScreen);
|
glamor_get_screen_private(drawable->pScreen);
|
||||||
glamor_pixmap_private *pixmap_priv =
|
glamor_pixmap_private *pixmap_priv =
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
PixmapPtr temp_pixmap = NULL;
|
PixmapPtr temp_pixmap = NULL;
|
||||||
int i;
|
int i;
|
||||||
uint8_t *readpixels_dst = (uint8_t *) dst;
|
uint8_t *readpixels_dst = (uint8_t *) dst;
|
||||||
int x_off, y_off;
|
int x_off, y_off;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
|
||||||
glamor_fallback("pixmap has no fbo.\n");
|
glamor_fallback("pixmap has no fbo.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -82,6 +76,7 @@ _glamor_get_spans(DrawablePtr drawable,
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
|
glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (glamor_priv->yInverted) {
|
if (glamor_priv->yInverted) {
|
||||||
dispatch->glReadPixels(points[i].x + x_off,
|
dispatch->glReadPixels(points[i].x + x_off,
|
||||||
|
@ -98,6 +93,7 @@ _glamor_get_spans(DrawablePtr drawable,
|
||||||
readpixels_dst +=
|
readpixels_dst +=
|
||||||
PixmapBytePad(widths[i], drawable->depth);
|
PixmapBytePad(widths[i], drawable->depth);
|
||||||
}
|
}
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
if (temp_pixmap)
|
if (temp_pixmap)
|
||||||
glamor_destroy_pixmap(temp_pixmap);
|
glamor_destroy_pixmap(temp_pixmap);
|
||||||
|
|
||||||
|
@ -116,7 +112,6 @@ fail:
|
||||||
glamor_finish_access(drawable, GLAMOR_ACCESS_RO);
|
glamor_finish_access(drawable, GLAMOR_ACCESS_RO);
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -37,7 +33,6 @@ _glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
|
||||||
int x, int y, unsigned int nglyph,
|
int x, int y, unsigned int nglyph,
|
||||||
CharInfoPtr * ppci, pointer pglyphBase, Bool fallback)
|
CharInfoPtr * ppci, pointer pglyphBase, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
glamor_screen_private *glamor_priv;
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
|
@ -46,13 +41,11 @@ _glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
glamor_prepare_access_gc(pGC);
|
glamor_prepare_access_gc(pGC);
|
||||||
fbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
fbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||||
glamor_finish_access_gc(pGC);
|
glamor_finish_access_gc(pGC);
|
||||||
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
fail:
|
fail:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -79,25 +72,20 @@ _glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
|
||||||
int x, int y, unsigned int nglyph,
|
int x, int y, unsigned int nglyph,
|
||||||
CharInfoPtr * ppci, pointer pglyphBase, Bool fallback)
|
CharInfoPtr * ppci, pointer pglyphBase, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
glamor_screen_private *glamor_priv;
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
&& glamor_ddx_fallback_check_pixmap(pDrawable)
|
&& glamor_ddx_fallback_check_pixmap(pDrawable)
|
||||||
&& glamor_ddx_fallback_check_gc(pGC))
|
&& glamor_ddx_fallback_check_gc(pGC))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
glamor_prepare_access_gc(pGC);
|
glamor_prepare_access_gc(pGC);
|
||||||
fbPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
fbPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||||
glamor_finish_access_gc(pGC);
|
glamor_finish_access_gc(pGC);
|
||||||
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
fail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -120,17 +108,12 @@ static Bool
|
||||||
_glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
|
_glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
|
||||||
DrawablePtr pDrawable, int w, int h, int x, int y, Bool fallback)
|
DrawablePtr pDrawable, int w, int h, int x, int y, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
&& glamor_ddx_fallback_check_pixmap(pDrawable)
|
&& glamor_ddx_fallback_check_pixmap(pDrawable)
|
||||||
&& glamor_ddx_fallback_check_pixmap(&pBitmap->drawable)
|
&& glamor_ddx_fallback_check_pixmap(&pBitmap->drawable)
|
||||||
&& glamor_ddx_fallback_check_gc(pGC))
|
&& glamor_ddx_fallback_check_gc(pGC))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
glamor_prepare_access(&pBitmap->drawable, GLAMOR_ACCESS_RO);
|
glamor_prepare_access(&pBitmap->drawable, GLAMOR_ACCESS_RO);
|
||||||
glamor_prepare_access_gc(pGC);
|
glamor_prepare_access_gc(pGC);
|
||||||
|
@ -138,10 +121,7 @@ _glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
|
||||||
glamor_finish_access_gc(pGC);
|
glamor_finish_access_gc(pGC);
|
||||||
glamor_finish_access(&pBitmap->drawable, GLAMOR_ACCESS_RO);
|
glamor_finish_access(&pBitmap->drawable, GLAMOR_ACCESS_RO);
|
||||||
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
fail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -40,15 +40,11 @@
|
||||||
* Based on code by: Keith Packard
|
* Based on code by: Keith Packard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
#include "mipict.h"
|
#include <mipict.h>
|
||||||
|
|
||||||
#if DEBUG_GLYPH_CACHE
|
#if DEBUG_GLYPH_CACHE
|
||||||
#define DBG_GLYPH_CACHE(a) ErrorF a
|
#define DBG_GLYPH_CACHE(a) ErrorF a
|
||||||
|
@ -163,7 +159,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
|
||||||
glamor_glyph_cache_t *cache = &glamor->glyphCaches[i];
|
glamor_glyph_cache_t *cache = &glamor->glyphCaches[i];
|
||||||
PixmapPtr pixmap;
|
PixmapPtr pixmap;
|
||||||
PicturePtr picture;
|
PicturePtr picture;
|
||||||
CARD32 component_alpha;
|
XID component_alpha;
|
||||||
int depth = PIXMAN_FORMAT_DEPTH(formats[i]);
|
int depth = PIXMAN_FORMAT_DEPTH(formats[i]);
|
||||||
int error;
|
int error;
|
||||||
PictFormatPtr pPictFormat =
|
PictFormatPtr pPictFormat =
|
||||||
|
@ -652,7 +648,7 @@ glamor_glyphs_via_mask(CARD8 op,
|
||||||
GlyphPtr glyph;
|
GlyphPtr glyph;
|
||||||
int error;
|
int error;
|
||||||
BoxRec extents = { 0, 0, 0, 0 };
|
BoxRec extents = { 0, 0, 0, 0 };
|
||||||
CARD32 component_alpha;
|
XID component_alpha;
|
||||||
glamor_glyph_buffer_t buffer;
|
glamor_glyph_buffer_t buffer;
|
||||||
xRectangle fill_rect;
|
xRectangle fill_rect;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
@ -31,7 +27,7 @@ static void
|
||||||
_glamor_pixmap_validate_filling(glamor_screen_private * glamor_priv,
|
_glamor_pixmap_validate_filling(glamor_screen_private * glamor_priv,
|
||||||
glamor_pixmap_private * pixmap_priv)
|
glamor_pixmap_private * pixmap_priv)
|
||||||
{
|
{
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
GLfloat vertices[8];
|
GLfloat vertices[8];
|
||||||
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||||
GL_FALSE, 2 * sizeof(float),
|
GL_FALSE, 2 * sizeof(float),
|
||||||
|
@ -52,6 +48,7 @@ _glamor_pixmap_validate_filling(glamor_screen_private * glamor_priv,
|
||||||
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
|
pixmap_priv->pending_op.type = GLAMOR_PENDING_NONE;
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +91,7 @@ glamor_validate_pixmap(PixmapPtr pixmap)
|
||||||
void
|
void
|
||||||
glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private * pixmap_priv)
|
glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private * pixmap_priv)
|
||||||
{
|
{
|
||||||
glamor_gl_dispatch *dispatch = &pixmap_priv->glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch = glamor_get_dispatch(pixmap_priv->glamor_priv);
|
||||||
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, pixmap_priv->fbo->fb);
|
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, pixmap_priv->fbo->fb);
|
||||||
#ifndef GLAMOR_GLES2
|
#ifndef GLAMOR_GLES2
|
||||||
dispatch->glMatrixMode(GL_PROJECTION);
|
dispatch->glMatrixMode(GL_PROJECTION);
|
||||||
|
@ -106,6 +103,7 @@ glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private * pixmap_priv)
|
||||||
pixmap_priv->fbo->width,
|
pixmap_priv->fbo->width,
|
||||||
pixmap_priv->fbo->height);
|
pixmap_priv->fbo->height);
|
||||||
|
|
||||||
|
glamor_put_dispatch(pixmap_priv->glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -222,7 +220,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
unsigned int stride, row_length;
|
unsigned int stride, row_length;
|
||||||
void *texels;
|
void *texels;
|
||||||
GLenum iformat;
|
GLenum iformat;
|
||||||
|
@ -235,6 +233,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
stride = pixmap->devKind;
|
stride = pixmap->devKind;
|
||||||
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
|
@ -271,6 +270,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
|
|
||||||
if (pixmap_priv->fbo->pbo && pixmap_priv->fbo->pbo_valid)
|
if (pixmap_priv->fbo->pbo && pixmap_priv->fbo->pbo_valid)
|
||||||
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ _glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
static float vertices[8];
|
static float vertices[8];
|
||||||
static float texcoords[8] = { 0, 1,
|
static float texcoords[8] = { 0, 1,
|
||||||
1, 1,
|
1, 1,
|
||||||
|
@ -339,6 +339,7 @@ _glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
vertices);
|
vertices);
|
||||||
|
|
||||||
/* Slow path, we need to flip y or wire alpha to 1. */
|
/* Slow path, we need to flip y or wire alpha to 1. */
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||||
GL_FALSE, 2 * sizeof(float),
|
GL_FALSE, 2 * sizeof(float),
|
||||||
vertices);
|
vertices);
|
||||||
|
@ -379,13 +380,17 @@ _glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
|
||||||
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||||
dispatch->glDeleteTextures(1, &tex);
|
dispatch->glDeleteTextures(1, &tex);
|
||||||
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
||||||
{
|
{
|
||||||
|
glamor_gl_dispatch *dispatch;
|
||||||
int status;
|
int status;
|
||||||
glamor_gl_dispatch *dispatch = &fbo->glamor_priv->dispatch;
|
|
||||||
|
dispatch = glamor_get_dispatch(fbo->glamor_priv);
|
||||||
|
|
||||||
if (fbo->fb == 0)
|
if (fbo->fb == 0)
|
||||||
dispatch->glGenFramebuffers(1, &fbo->fb);
|
dispatch->glGenFramebuffers(1, &fbo->fb);
|
||||||
|
@ -422,11 +427,10 @@ glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogMessageVerb(X_INFO, 0,
|
FatalError("destination is framebuffer incomplete: %s [%#x]\n",
|
||||||
"destination is framebuffer incomplete: %s [%#x]\n",
|
str, status);
|
||||||
str, status);
|
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
glamor_put_dispatch(fbo->glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -571,7 +575,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format,
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
source_priv = glamor_get_pixmap_private(source);
|
source_priv = glamor_get_pixmap_private(source);
|
||||||
dispatch = &glamor_priv->dispatch;
|
|
||||||
if (*format == GL_BGRA) {
|
if (*format == GL_BGRA) {
|
||||||
*format = GL_RGBA;
|
*format = GL_RGBA;
|
||||||
swap_rb = 1;
|
swap_rb = 1;
|
||||||
|
@ -585,6 +588,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format,
|
||||||
|
|
||||||
temp_pixmap_priv = glamor_get_pixmap_private(temp_pixmap);
|
temp_pixmap_priv = glamor_get_pixmap_private(temp_pixmap);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, temp_pixmap_priv->fbo->tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, temp_pixmap_priv->fbo->tex);
|
||||||
dispatch->glTexParameteri(GL_TEXTURE_2D,
|
dispatch->glTexParameteri(GL_TEXTURE_2D,
|
||||||
GL_TEXTURE_MIN_FILTER,
|
GL_TEXTURE_MIN_FILTER,
|
||||||
|
@ -631,6 +635,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum * format,
|
||||||
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||||
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
return temp_pixmap;
|
return temp_pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,7 +662,7 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
||||||
ScreenPtr screen;
|
ScreenPtr screen;
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
screen = pixmap->drawable.pScreen;
|
screen = pixmap->drawable.pScreen;
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||||
|
@ -715,6 +720,7 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
||||||
}
|
}
|
||||||
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||||
dispatch->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
dispatch->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
dispatch->glPixelStorei(GL_PACK_ROW_LENGTH, row_length);
|
dispatch->glPixelStorei(GL_PACK_ROW_LENGTH, row_length);
|
||||||
|
@ -795,6 +801,7 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
done:
|
done:
|
||||||
|
|
||||||
pixmap_priv->gl_fbo = GLAMOR_FBO_DOWNLOADED;
|
pixmap_priv->gl_fbo = GLAMOR_FBO_DOWNLOADED;
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_fillspans.c
|
/** @file glamor_fillspans.c
|
||||||
|
@ -48,10 +44,8 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
|
||||||
RegionPtr pClip = fbGetCompositeClip(gc);
|
RegionPtr pClip = fbGetCompositeClip(gc);
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
glamor_screen_private *glamor_priv;
|
glamor_screen_private *glamor_priv;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
|
|
||||||
if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled) {
|
if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -119,7 +113,6 @@ fail:
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_polylines.c
|
/** @file glamor_polylines.c
|
||||||
|
@ -50,7 +46,6 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
int x1, x2, y1, y2;
|
int x1, x2, y1, y2;
|
||||||
int i;
|
int i;
|
||||||
glamor_screen_private *glamor_priv;
|
glamor_screen_private *glamor_priv;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
/* Don't try to do wide lines or non-solid fill style. */
|
/* Don't try to do wide lines or non-solid fill style. */
|
||||||
if (gc->lineWidth != 0) {
|
if (gc->lineWidth != 0) {
|
||||||
|
@ -112,7 +107,6 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
glamor_priv = glamor_get_screen_private(drawable->pScreen);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
if (gc->lineWidth == 0) {
|
if (gc->lineWidth == 0) {
|
||||||
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
|
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
|
||||||
if (glamor_prepare_access_gc(gc)) {
|
if (glamor_prepare_access_gc(gc)) {
|
||||||
|
@ -126,7 +120,6 @@ wide_line:
|
||||||
/* fb calls mi functions in the lineWidth != 0 case. */
|
/* fb calls mi functions in the lineWidth != 0 case. */
|
||||||
fbPolyLine(drawable, gc, mode, n, points);
|
fbPolyLine(drawable, gc, mode, n, points);
|
||||||
}
|
}
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,36 +26,23 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
_glamor_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
_glamor_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
DDXPointPtr ppt, Bool fallback)
|
DDXPointPtr ppt, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
&& glamor_ddx_fallback_check_gc(pGC)
|
&& glamor_ddx_fallback_check_gc(pGC)
|
||||||
&& glamor_ddx_fallback_check_pixmap(pDrawable))
|
&& glamor_ddx_fallback_check_pixmap(pDrawable))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
glamor_prepare_access_gc(pGC);
|
glamor_prepare_access_gc(pGC);
|
||||||
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
fbPolyPoint(pDrawable, pGC, mode, npt, ppt);
|
fbPolyPoint(pDrawable, pGC, mode, npt, ppt);
|
||||||
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
glamor_finish_access_gc(pGC);
|
glamor_finish_access_gc(pGC);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,16 +63,11 @@ static Bool
|
||||||
_glamor_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg,
|
_glamor_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg,
|
||||||
xSegment *pSeg, Bool fallback)
|
xSegment *pSeg, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
&& glamor_ddx_fallback_check_gc(pGC)
|
&& glamor_ddx_fallback_check_gc(pGC)
|
||||||
&& glamor_ddx_fallback_check_pixmap(pDrawable))
|
&& glamor_ddx_fallback_check_pixmap(pDrawable))
|
||||||
goto fail;
|
return FALSE;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
/* For lineWidth is not zero, fb calls to mi functions. */
|
/* For lineWidth is not zero, fb calls to mi functions. */
|
||||||
if (pGC->lineWidth == 0) {
|
if (pGC->lineWidth == 0) {
|
||||||
glamor_prepare_access_gc(pGC);
|
glamor_prepare_access_gc(pGC);
|
||||||
|
@ -94,13 +76,9 @@ _glamor_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg,
|
||||||
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
glamor_finish_access_gc(pGC);
|
glamor_finish_access_gc(pGC);
|
||||||
} else
|
} else
|
||||||
fbPolySegment(pDrawable, pGC, nseg, pSeg);
|
fbPolySegment(pDrawable, pGC, nseg, pSeg);
|
||||||
|
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -121,17 +99,12 @@ static Bool
|
||||||
_glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
_glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
DDXPointPtr ppt, Bool fallback)
|
DDXPointPtr ppt, Bool fallback)
|
||||||
{
|
{
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
glamor_screen_private *glamor_priv;
|
|
||||||
|
|
||||||
if (!fallback
|
if (!fallback
|
||||||
&& glamor_ddx_fallback_check_gc(pGC)
|
&& glamor_ddx_fallback_check_gc(pGC)
|
||||||
&& glamor_ddx_fallback_check_pixmap(pDrawable))
|
&& glamor_ddx_fallback_check_pixmap(pDrawable))
|
||||||
goto fail;
|
return FALSE;
|
||||||
/* For lineWidth is not zero, fb calls to mi functions. */
|
/* For lineWidth is not zero, fb calls to mi functions. */
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(pDrawable->pScreen);
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
if (pGC->lineWidth == 0) {
|
if (pGC->lineWidth == 0) {
|
||||||
glamor_prepare_access_gc(pGC);
|
glamor_prepare_access_gc(pGC);
|
||||||
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_prepare_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
|
@ -139,13 +112,9 @@ _glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
|
||||||
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
glamor_finish_access(pDrawable, GLAMOR_ACCESS_RW);
|
||||||
glamor_finish_access_gc(pGC);
|
glamor_finish_access_gc(pGC);
|
||||||
} else
|
} else
|
||||||
fbPolyLine(pDrawable, pGC, mode, npt, ppt);
|
fbPolyLine(pDrawable, pGC, mode, npt, ppt);
|
||||||
|
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -31,10 +31,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
#include <xorg-server.h>
|
#include <xorg-server.h>
|
||||||
|
|
||||||
#include "glamor.h"
|
#include "glamor.h"
|
||||||
|
@ -171,7 +167,7 @@ struct glamor_saved_procs {
|
||||||
(((int)(t1) - (int)(t0)) < 0)
|
(((int)(t1) - (int)(t0)) < 0)
|
||||||
|
|
||||||
typedef struct glamor_screen_private {
|
typedef struct glamor_screen_private {
|
||||||
struct glamor_gl_dispatch dispatch;
|
struct glamor_gl_dispatch _dispatch;
|
||||||
int yInverted;
|
int yInverted;
|
||||||
unsigned int tick;
|
unsigned int tick;
|
||||||
enum glamor_gl_flavor gl_flavor;
|
enum glamor_gl_flavor gl_flavor;
|
||||||
|
|
|
@ -251,7 +251,7 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(drawable->pScreen);
|
glamor_get_screen_private(drawable->pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
|
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
|
||||||
glamor_pixmap_private *pixmap_priv =
|
glamor_pixmap_private *pixmap_priv =
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
|
@ -265,10 +265,8 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
GLfloat xscale, yscale, txscale, tyscale;
|
GLfloat xscale, yscale, txscale, tyscale;
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
int no_alpha, no_revert;
|
int no_alpha, no_revert;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
if (image_format == XYBitmap) {
|
if (image_format == XYBitmap) {
|
||||||
assert(depth == 1);
|
assert(depth == 1);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -287,7 +285,6 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
if (!glamor_set_planemask(pixmap, gc->planemask)) {
|
if (!glamor_set_planemask(pixmap, gc->planemask)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
glamor_set_alu(dispatch, gc->alu);
|
|
||||||
|
|
||||||
if (glamor_get_tex_format_type_from_pixmap(pixmap,
|
if (glamor_get_tex_format_type_from_pixmap(pixmap,
|
||||||
&format,
|
&format,
|
||||||
|
@ -298,6 +295,8 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX consider to reuse a function to do the following work. */
|
/* XXX consider to reuse a function to do the following work. */
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
|
glamor_set_alu(dispatch, gc->alu);
|
||||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||||
glamor_validate_pixmap(pixmap);
|
glamor_validate_pixmap(pixmap);
|
||||||
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
|
||||||
|
@ -400,6 +399,7 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
glamor_set_alu(dispatch, GXcopy);
|
glamor_set_alu(dispatch, GXcopy);
|
||||||
glamor_set_planemask(pixmap, ~0);
|
glamor_set_planemask(pixmap, ~0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -421,7 +421,6 @@ fail:
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,15 +220,16 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
|
||||||
GLuint vs, fs, prog;
|
GLuint vs, fs, prog;
|
||||||
GLint source_sampler_uniform_location,
|
GLint source_sampler_uniform_location,
|
||||||
mask_sampler_uniform_location;
|
mask_sampler_uniform_location;
|
||||||
glamor_screen_private *glamor = glamor_get_screen_private(screen);
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
vs = glamor_create_composite_vs(dispatch, key);
|
vs = glamor_create_composite_vs(dispatch, key);
|
||||||
if (vs == 0)
|
if (vs == 0)
|
||||||
return;
|
goto out;
|
||||||
fs = glamor_create_composite_fs(dispatch, key);
|
fs = glamor_create_composite_fs(dispatch, key);
|
||||||
if (fs == 0)
|
if (fs == 0)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
prog = dispatch->glCreateProgram();
|
prog = dispatch->glCreateProgram();
|
||||||
dispatch->glAttachShader(prog, vs);
|
dispatch->glAttachShader(prog, vs);
|
||||||
|
@ -268,6 +269,9 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
|
||||||
(mask_sampler_uniform_location, 1);
|
(mask_sampler_uniform_location, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static glamor_composite_shader *
|
static glamor_composite_shader *
|
||||||
|
@ -316,7 +320,7 @@ glamor_init_composite_shaders(ScreenPtr screen)
|
||||||
int vb_size;
|
int vb_size;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glGenBuffers(1, &glamor_priv->vbo);
|
dispatch->glGenBuffers(1, &glamor_priv->vbo);
|
||||||
dispatch->glGenBuffers(1, &glamor_priv->ebo);
|
dispatch->glGenBuffers(1, &glamor_priv->ebo);
|
||||||
dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
|
dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
|
||||||
|
@ -331,17 +335,13 @@ glamor_init_composite_shaders(ScreenPtr screen)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vb = malloc(GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * 2);
|
vb = malloc(GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * 2);
|
||||||
if (vb == NULL) {
|
if (vb == NULL)
|
||||||
ErrorF("Failed to allocate vb memory.\n");
|
FatalError("Failed to allocate vb memory.\n");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
eb = malloc(eb_size);
|
eb = malloc(eb_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eb == NULL) {
|
if (eb == NULL)
|
||||||
ErrorF("fatal error, fail to get eb.\n");
|
FatalError("fatal error, fail to get eb.\n");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT);
|
glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT);
|
||||||
|
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||||
|
@ -362,6 +362,8 @@ glamor_init_composite_shaders(ScreenPtr screen)
|
||||||
free(eb);
|
free(eb);
|
||||||
glamor_priv->vb = (char*)vb;
|
glamor_priv->vb = (char*)vb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -373,7 +375,7 @@ glamor_fini_composite_shaders(ScreenPtr screen)
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glDeleteBuffers(1, &glamor_priv->vbo);
|
dispatch->glDeleteBuffers(1, &glamor_priv->vbo);
|
||||||
dispatch->glDeleteBuffers(1, &glamor_priv->ebo);
|
dispatch->glDeleteBuffers(1, &glamor_priv->ebo);
|
||||||
|
|
||||||
|
@ -388,8 +390,9 @@ glamor_fini_composite_shaders(ScreenPtr screen)
|
||||||
if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
||||||
&& glamor_priv->vb)
|
&& glamor_priv->vb)
|
||||||
free(glamor_priv->vb);
|
free(glamor_priv->vb);
|
||||||
}
|
|
||||||
|
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
glamor_set_composite_op(ScreenPtr screen,
|
glamor_set_composite_op(ScreenPtr screen,
|
||||||
|
@ -399,7 +402,7 @@ glamor_set_composite_op(ScreenPtr screen,
|
||||||
struct blendinfo *op_info;
|
struct blendinfo *op_info;
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
if (op >= ARRAY_SIZE(composite_op_info)) {
|
if (op >= ARRAY_SIZE(composite_op_info)) {
|
||||||
glamor_fallback("unsupported render op %d \n", op);
|
glamor_fallback("unsupported render op %d \n", op);
|
||||||
|
@ -435,12 +438,14 @@ glamor_set_composite_op(ScreenPtr screen,
|
||||||
dest_blend = GL_ONE_MINUS_SRC_COLOR;
|
dest_blend = GL_ONE_MINUS_SRC_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
if (source_blend == GL_ONE && dest_blend == GL_ZERO) {
|
if (source_blend == GL_ONE && dest_blend == GL_ZERO) {
|
||||||
dispatch->glDisable(GL_BLEND);
|
dispatch->glDisable(GL_BLEND);
|
||||||
} else {
|
} else {
|
||||||
dispatch->glEnable(GL_BLEND);
|
dispatch->glEnable(GL_BLEND);
|
||||||
dispatch->glBlendFunc(source_blend, dest_blend);
|
dispatch->glBlendFunc(source_blend, dest_blend);
|
||||||
}
|
}
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +456,6 @@ glamor_composite_texture_fixup(ScreenPtr screen,
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
|
||||||
Bool has_repeat;
|
Bool has_repeat;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
@ -478,7 +482,9 @@ glamor_set_composite_texture(ScreenPtr screen, int unit,
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glActiveTexture(GL_TEXTURE0 + unit);
|
dispatch->glActiveTexture(GL_TEXTURE0 + unit);
|
||||||
dispatch->glBindTexture(GL_TEXTURE_2D, pixmap_priv->fbo->tex);
|
dispatch->glBindTexture(GL_TEXTURE_2D, pixmap_priv->fbo->tex);
|
||||||
switch (picture->repeatType) {
|
switch (picture->repeatType) {
|
||||||
|
@ -533,6 +539,7 @@ glamor_set_composite_texture(ScreenPtr screen, int unit,
|
||||||
#ifndef GLAMOR_GLES2
|
#ifndef GLAMOR_GLES2
|
||||||
dispatch->glEnable(GL_TEXTURE_2D);
|
dispatch->glEnable(GL_TEXTURE_2D);
|
||||||
#endif
|
#endif
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -654,7 +661,7 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
glamor_priv->vbo_offset = 0;
|
glamor_priv->vbo_offset = 0;
|
||||||
glamor_priv->vbo_offset = 0;
|
glamor_priv->vbo_offset = 0;
|
||||||
|
@ -667,6 +674,7 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
||||||
if (glamor_priv->has_mask_coords)
|
if (glamor_priv->has_mask_coords)
|
||||||
glamor_priv->vb_stride += 2 * sizeof(float);
|
glamor_priv->vb_stride += 2 * sizeof(float);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
|
dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||||
dispatch->glBufferData(GL_ARRAY_BUFFER,
|
dispatch->glBufferData(GL_ARRAY_BUFFER,
|
||||||
|
@ -706,6 +714,7 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
||||||
sizeof(float)));
|
sizeof(float)));
|
||||||
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
||||||
}
|
}
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -739,9 +748,12 @@ glamor_flush_composite_rects(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
if (!glamor_priv->render_nr_verts)
|
if (!glamor_priv->render_nr_verts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||||
dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
|
dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||||
else {
|
else {
|
||||||
|
@ -754,6 +766,7 @@ glamor_flush_composite_rects(ScreenPtr screen)
|
||||||
|
|
||||||
dispatch->glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
|
dispatch->glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
|
||||||
GL_UNSIGNED_SHORT, NULL);
|
GL_UNSIGNED_SHORT, NULL);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -846,7 +859,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
PixmapPtr dest_pixmap =
|
PixmapPtr dest_pixmap =
|
||||||
glamor_get_drawable_pixmap(dest->pDrawable);
|
glamor_get_drawable_pixmap(dest->pDrawable);
|
||||||
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
||||||
|
@ -870,10 +883,8 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||||
int vert_stride = 4;
|
int vert_stride = 4;
|
||||||
int nrect_max;
|
int nrect_max;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
||||||
glamor_fallback("dest has no fbo.\n");
|
glamor_fallback("dest has no fbo.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1090,6 +1101,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glUseProgram(shader->prog);
|
dispatch->glUseProgram(shader->prog);
|
||||||
|
|
||||||
if (key.source == SHADER_SOURCE_SOLID) {
|
if (key.source == SHADER_SOURCE_SOLID) {
|
||||||
|
@ -1233,6 +1245,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
if (saved_source_format)
|
if (saved_source_format)
|
||||||
source->format = saved_source_format;
|
source->format = saved_source_format;
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1240,12 +1253,7 @@ glamor_composite_with_shader(CARD8 op,
|
||||||
fail:
|
fail:
|
||||||
if (saved_source_format)
|
if (saved_source_format)
|
||||||
source->format = saved_source_format;
|
source->format = saved_source_format;
|
||||||
|
|
||||||
dispatch->glDisable(GL_BLEND);
|
|
||||||
dispatch->glUseProgram(0);
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1320,7 +1328,6 @@ _glamor_composite(CARD8 op,
|
||||||
RegionRec region;
|
RegionRec region;
|
||||||
BoxPtr box;
|
BoxPtr box;
|
||||||
int nbox, i, ok;
|
int nbox, i, ok;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
|
|
||||||
x_temp_src = x_source;
|
x_temp_src = x_source;
|
||||||
y_temp_src = y_source;
|
y_temp_src = y_source;
|
||||||
|
@ -1328,7 +1335,6 @@ _glamor_composite(CARD8 op,
|
||||||
y_temp_mask = y_mask;
|
y_temp_mask = y_mask;
|
||||||
|
|
||||||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
/* Currently. Always fallback to cpu if destination is in CPU memory. */
|
/* Currently. Always fallback to cpu if destination is in CPU memory. */
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1535,7 +1541,6 @@ fail:
|
||||||
FreePicture(temp_mask, 0);
|
FreePicture(temp_mask, 0);
|
||||||
if (prect != rect)
|
if (prect != rect)
|
||||||
free(prect);
|
free(prect);
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -40,17 +36,15 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
||||||
glamor_pixmap_private *dest_pixmap_priv;
|
glamor_pixmap_private *dest_pixmap_priv;
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(drawable->pScreen);
|
glamor_get_screen_private(drawable->pScreen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
GLenum format, type;
|
GLenum format, type;
|
||||||
int no_alpha, no_revert, i;
|
int no_alpha, no_revert, i;
|
||||||
uint8_t *drawpixels_src = (uint8_t *) src;
|
uint8_t *drawpixels_src = (uint8_t *) src;
|
||||||
RegionPtr clip = fbGetCompositeClip(gc);
|
RegionPtr clip = fbGetCompositeClip(gc);
|
||||||
BoxRec *pbox;
|
BoxRec *pbox;
|
||||||
int x_off, y_off;
|
int x_off, y_off;
|
||||||
GLAMOR_DEFINE_CONTEXT;
|
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
|
|
||||||
GLAMOR_SET_CONTEXT(glamor_priv);
|
|
||||||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
||||||
glamor_fallback("pixmap has no fbo.\n");
|
glamor_fallback("pixmap has no fbo.\n");
|
||||||
|
@ -70,17 +64,15 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
|
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
|
||||||
glamor_validate_pixmap(dest_pixmap);
|
glamor_validate_pixmap(dest_pixmap);
|
||||||
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
|
|
||||||
goto fail;
|
|
||||||
glamor_set_alu(dispatch, gc->alu);
|
|
||||||
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
|
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
|
glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
|
glamor_set_alu(dispatch, gc->alu);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
|
|
||||||
n = REGION_NUM_RECTS(clip);
|
n = REGION_NUM_RECTS(clip);
|
||||||
|
@ -103,6 +95,7 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
||||||
glamor_set_planemask(dest_pixmap, ~0);
|
glamor_set_planemask(dest_pixmap, ~0);
|
||||||
glamor_set_alu(dispatch, GXcopy);
|
glamor_set_alu(dispatch, GXcopy);
|
||||||
dispatch->glDisable(GL_SCISSOR_TEST);
|
dispatch->glDisable(GL_SCISSOR_TEST);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -120,7 +113,6 @@ fail:
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
GLAMOR_RESTORE_CONTEXT(glamor_priv);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_tile.c
|
/** @file glamor_tile.c
|
||||||
|
@ -60,7 +56,7 @@ glamor_init_tile_shader(ScreenPtr screen)
|
||||||
GLint sampler_uniform_location;
|
GLint sampler_uniform_location;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
glamor_priv->tile_prog = dispatch->glCreateProgram();
|
glamor_priv->tile_prog = dispatch->glCreateProgram();
|
||||||
vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, tile_vs);
|
vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, tile_vs);
|
||||||
fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER,
|
fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER,
|
||||||
|
@ -81,6 +77,7 @@ glamor_init_tile_shader(ScreenPtr screen)
|
||||||
dispatch->glUseProgram(glamor_priv->tile_prog);
|
dispatch->glUseProgram(glamor_priv->tile_prog);
|
||||||
dispatch->glUniform1i(sampler_uniform_location, 0);
|
dispatch->glUniform1i(sampler_uniform_location, 0);
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -90,8 +87,9 @@ glamor_fini_tile_shader(ScreenPtr screen)
|
||||||
glamor_gl_dispatch *dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
|
|
||||||
glamor_priv = glamor_get_screen_private(screen);
|
glamor_priv = glamor_get_screen_private(screen);
|
||||||
dispatch = &glamor_priv->dispatch;
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
dispatch->glDeleteProgram(glamor_priv->tile_prog);
|
dispatch->glDeleteProgram(glamor_priv->tile_prog);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -103,7 +101,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(screen);
|
glamor_get_screen_private(screen);
|
||||||
glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
|
glamor_gl_dispatch *dispatch;
|
||||||
int x1 = x;
|
int x1 = x;
|
||||||
int x2 = x + width;
|
int x2 = x + width;
|
||||||
int y1 = y;
|
int y1 = y;
|
||||||
|
@ -161,6 +159,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
glamor_validate_pixmap(pixmap);
|
glamor_validate_pixmap(pixmap);
|
||||||
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
|
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
|
||||||
|
|
||||||
|
dispatch = glamor_get_dispatch(glamor_priv);
|
||||||
glamor_set_alu(dispatch, alu);
|
glamor_set_alu(dispatch, alu);
|
||||||
|
|
||||||
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
|
||||||
|
@ -219,6 +218,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
dispatch->glUseProgram(0);
|
dispatch->glUseProgram(0);
|
||||||
glamor_set_alu(dispatch, GXcopy);
|
glamor_set_alu(dispatch, GXcopy);
|
||||||
glamor_set_planemask(pixmap, ~0);
|
glamor_set_planemask(pixmap, ~0);
|
||||||
|
glamor_put_dispatch(glamor_priv);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
|
|
@ -664,31 +664,44 @@ static inline void glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int
|
||||||
glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
|
glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *glamor_make_current(ScreenPtr screen)
|
static inline void glamor_make_current(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
return glamor_egl_make_current(screen);
|
glamor_egl_make_current(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void glamor_restore_current(ScreenPtr screen, void *previous_context)
|
static inline void glamor_restore_current(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
glamor_egl_restore_context(screen, previous_context);
|
glamor_egl_restore_context(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GLX_USE_SHARED_DISPATCH
|
#ifdef GLX_USE_SHARED_DISPATCH
|
||||||
#define GLAMOR_DEFINE_CONTEXT void *_previous_context_ = NULL
|
static inline glamor_gl_dispatch *
|
||||||
#define GLAMOR_SET_CONTEXT(glamor_priv) \
|
glamor_get_dispatch(glamor_screen_private *glamor_priv)
|
||||||
if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN) \
|
{
|
||||||
_previous_context_ = glamor_make_current(glamor_priv->screen)
|
if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN)
|
||||||
|
glamor_make_current(glamor_priv->screen);
|
||||||
|
|
||||||
#define GLAMOR_RESTORE_CONTEXT(glamor_priv) \
|
return &glamor_priv->_dispatch;
|
||||||
if ((glamor_priv->flags & GLAMOR_USE_EGL_SCREEN) \
|
}
|
||||||
&& _previous_context_ != NULL) \
|
|
||||||
glamor_restore_current(glamor_priv->screen, _previous_context_)
|
static inline void
|
||||||
|
glamor_put_dispatch(glamor_screen_private *glamor_priv)
|
||||||
|
{
|
||||||
|
if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN)
|
||||||
|
glamor_restore_current(glamor_priv->screen);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
#warning "Indirect GLX may be broken, need to implement context switch."
|
||||||
|
static inline glamor_gl_dispatch *
|
||||||
|
glamor_get_dispatch(glamor_screen_private *glamor_priv)
|
||||||
|
{
|
||||||
|
return &glamor_priv->_dispatch;
|
||||||
|
}
|
||||||
|
|
||||||
#define GLAMOR_DEFINE_CONTEXT
|
static inline void
|
||||||
#define GLAMOR_SET_CONTEXT(glamor_priv)
|
glamor_put_dispatch(glamor_screen_private *glamor_priv)
|
||||||
#define GLAMOR_RESTORE_CONTEXT(glamor_priv)
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,6 @@
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
/** @file glamor_window.c
|
/** @file glamor_window.c
|
||||||
|
|
Loading…
Reference in New Issue