Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • chengbo7135/xserver
  • wjp/xserver
  • DemiMarie/xserver
  • alanc/xserver
  • uvas/xserver
  • cl91/xserver
  • heymiaoO/xserver
  • oreaus/xserver
  • stapelberg/xserver
  • PaulKocialkowski/xserver
  • CendioOssman/xserver
  • wiz/xserver
  • maos20008/xserver
  • dougvj/xserver
  • mgorse1/xserver
  • gldrk/xserver
  • TMR5454/xserver
  • Kyawswat/xserver
  • hexiaodong/xserver
  • gilvbp/xserver
  • vliaskov/xserver
  • aarondill/xserver
  • zzyiwei/xserver
  • kleinerm/xserver
  • jcherry/xserver
  • jcristau/xserver
  • nathankidd/xserver
  • jexposit/xserver
  • refi_64/xserver
  • kbrenneman/xserver
  • kupper.pa/xserver
  • LickmeDown/xserver
  • zboszor/xserver
  • jadahl/xserver
  • shadeslayer/xserver
  • mherrb/xserver
  • Julia/xserver
  • twaik/xserver
  • fvalasiad/xserver
  • zzxyb/xserver
  • HermannSW/xserver
  • erwinou/xserver
  • ekurzinger/xserver
  • nacho.resa/xserver
  • agoins/xserver
  • NSUTanghaixiang/xserver
  • p12tic/xserver
  • huxd1532/xserver
  • metux/xserver
  • keithp/xserver
  • vinilokorlok/xserver
  • bbeckett/xserver
  • dslater38/xserver
  • zzag/xserver
  • emersion/xserver
  • djlucas/xserver
  • ccullumbine2018/xserver
  • daniels/xserver
  • matt335672/xserver
  • llandwerlin/xserver
  • doraskayo/xserver
  • afett/xserver
  • XDXTHX/xserver
  • xexaxo/xserver
  • ecurtin/xserver
  • rbernon/xserver
  • pekdon/xserver
  • karolherbst/xserver
  • russellcnv/xserver
  • mbiebl/xserver
  • orbea/xserver
  • vsyrjala/xserver
  • lyudess/xserver
  • manu/xserver
  • lucmann/xserver
  • tholin/xserver
  • yarivb/xserver
  • tmlind/xserver
  • chema/xserver
  • J-Bu/xserver
  • chenhuacai/xserver
  • E5ten/xserver
  • haagch/xserver
  • whot/xserver
  • strassek/xserver
  • mntmn/xserver
  • liyi42/xserver
  • YusufKhan-gamedev/xserver
  • iv-m/xserver
  • vanvugt/xserver
  • Rui511/xserver
  • catap/xserver
  • tjbp/xserver
  • webi123/xserver
  • noblock/xserver
  • freemangordon/xserver
  • xdandys/xserver
  • jbeich/xserver
  • zeising/xserver
  • romangg/xserver
  • pq/xserver
  • azhadchenko/xserver
  • Emantor/xserver
  • xorg/xserver
  • carlosg/xserver
  • kwg/xserver
  • pichika/xserver
  • klniu/xserver
  • TAAPArthur/xserver
  • sjoerd/xserver
  • Sjecai2/xserver
  • jturney/xserver
  • pkubaj/xserver
  • os369510/xserver
  • Zamundaaa/xserver
  • Gorg/xserver
  • lkundrak/xserver
  • niveditharau/xserver
  • ForTheReallys/xserver
  • jmonteiro/xserver
  • jocelyn/xserver
  • ThatMG393/xserver
  • fweimer/xserver
  • mlankhorst/xserver
  • marv/xserver
  • dbn/xserver
  • mattrope/xserver
  • coypoop/xserver
  • mwyraz/xserver
  • frog/xserver
  • 3v1n0/xserver
  • awilfox/xserver
  • muesli4/xserver
  • rarbab/xserver
  • yshui/xserver
  • jannau/xserver
  • mikeroyal/xserver
  • andrebsguedes/xserver
  • JeffyCN/xserver
  • ipominov/xserver
  • gtrentalancia/xserver
  • josch/xserver
  • lucyllewy/xserver
  • tomty89/xserver
  • qarmin/xserver
  • tagr/xserver
  • zwenna/xserver
  • bkylerussell/xserver
  • mupuf/xserver
  • zubzub/xserver
  • galaxytgtabiday/xserver
  • OlCe/xserver
  • ashafer/xserver
  • dengbo/xserver
  • valpackett/xserver
  • andreyknyazev077/xserver
  • antonovitch/xserver
  • contactshashanksharma/xserver-fork-shashank
  • akihiko.odaki/xserver
  • sknsean/xserver
  • rnpnr/xserver
  • hitong602/xserver
  • halfline/xserver
  • ismailsiege/xserver
  • dongwonk/xserver
  • Fatton1/xserver
  • GermanAizek/xserver
  • daenzer/xserver
  • FeepingCreature/xserver
  • mvlad/xserver
  • puleglot/xserver
  • smelenius/xserver
  • sewn/xserver
  • kaichuan.hsieh/xserver
  • SimonPilkington/xserver
  • adamdruppe/xserver
  • floppym/xserver
  • trevdave/xserver
  • luke-jr/xserver
  • headrush/xserver
  • davidriley/xserver
  • heitbaum/xserver
  • mrisaacb/xserver
  • goosen78/xserver
  • Ma/xserver
  • gmbr3/xserver
  • tsutsui/xserver
  • sherrodejjohnson/xserver
  • hassoon1986/xserver
  • lanodan/xserver
  • ydc-dadada/xserver
  • wengxt/xserver
  • icenowy/xserver
  • denisfa/xserver
  • StarsGreen/xserver
  • adamjrichter/xserver
  • bigon/xserver
  • djacewicz/xserver
  • davidre/xserver
  • kylin0061/xserver
  • arrowd/xserver
  • ernstp/xserver
  • bbrezillon/xserver
  • penguin42/xserver
  • anarsoul/xserver
  • marvinjr35/xserver
  • gerddie/xserver
  • xry111/xserver
  • psyruss85/xserver
  • volkanorhan/xserver
  • luporl/xserver
  • cbur201592/xserver
  • bphaslett/xserver
  • guillem/xserver
  • haihao/xserver
  • peterh/xserver
  • miztake/xserver
  • zaps166/xserver
  • lostgoat/xserver
  • vfjpl/xserver
  • bentiss/xserver
  • rilian-la-te/xserver
  • wujiangGitHub/xserver
  • cubanismo/xserver
  • arichardson/xserver
  • schreibemirhalt/xserver
  • jsg/xserver
  • karlosrangel337/xserver
  • knisht/xserver
  • manuelcrack642/xserver
  • ross/xserver
  • topimiettinen/xserver
  • davidedmundson/xserver
  • DPA/xserver
  • dkorkmazturk/xserver
  • karamjameelmoore/xserver
  • lihongtao/xserver
  • sthibaul/xserver
  • RyzenDew/xserver
  • christian-rauch/xserver
  • Vivek/xserver
  • peigongdsd/xserver
  • peng.jin/xserver
  • alagner/xserver
  • mehdigh419/xserver
  • dixler/xserver
  • BBaoVanC/xserver
  • Drakulix/xserver
  • Acidburn0zzz/xserver
  • bafanahub/xserver
  • benpicco/xserver
  • yangxiaojuan-loongson/xserver
  • kaocher82/xserver
  • pepp/xserver
  • cgzones/xserver
  • luyn/xserver
  • 1740301466jxz/xserver
  • ids1024/xserver
  • svalaskevicius/xserver
  • ZhiJie.Zhang/xserver
  • eschwartz/xserver
  • jayantpranjal0/xserver
  • hmazlan/xserver
  • kerneltoast/xserver
  • Michaelypk/xserver
  • dottedmag/xserver
  • aplattner/xserver
  • sergiomb/xserver
  • looi/xserver
  • robclark/xserver
  • tzimmermann/xserver
  • vitoux.pascal/xserver
  • aditj/xserver
  • kennylevinsen/xserver
  • Kishore409/xserver
  • Daasin/xserver
  • dirbaio/xserver
  • xinbowang/xserver
  • mwei/xserver
  • SpikyCaterpillar1/xserver
  • devin11911191/xserver
  • alex-tu-cc/xserver
  • kaniini/xserver
  • jcourreges/xserver
  • n3rdopolis/xserver
  • zagursky/xserver
  • thesamesam/xserver
  • anholt/xserver
  • themaister/xserver
  • jrtc27/xserver
  • JoseExposito/xserver
  • Hi-Angel/xserver
  • City-busz/xserver
  • ydirson/xserver
  • dawnhan/xserver
  • avolkov/xserver
  • meMuszr/xserver
  • dk/xserver
  • cooperch/xserver
  • Tuetuopay/xserver
  • gabifalk/xserver
  • jeremyhu/xserver
  • road2react/xserver
  • 1480c1/xserver
  • Spintzyk/xserver
  • MisterDA/xserver
  • starnight/xserver
  • abono/xserver
  • ajax/xserver
  • dougg3/xserver
  • chenx_dust/xserver
  • EXtremeExploit/xserver
  • jwrdegoede/xserver
  • acelan/xserver
  • airlied/xserver
  • justazarsky/xserver
  • sri-ka1ki/xserver
  • rgfernandes/xserver
  • lynxeye/xserver
  • tintou/xserver
  • mattst88/xserver
  • rmader/xserver
  • linkmauve/xserver
  • kamarul6401/xserver
  • andy-zetier/xserver
  • gsittyz/xserver
  • bernhardu/xserver
  • causztic/xserver
  • cpmichael/modesetting
  • ryanneph/xserver
  • zhangyaning/xserver
  • olv/xserver
  • hongaoo/xserver
  • LiChenG-P/xserver
  • Ivaniku/x-taylan
  • dkg/xserver
  • ofourdan/xserver
  • mahkoh/xserver
  • AkiSakurai/xserver
  • msizanoen1/xserver
340 results
Show changes
Commits on Source (16)
Showing
with 137 additions and 168 deletions
......@@ -59,6 +59,7 @@ compCloseScreen(ScreenPtr pScreen)
Bool ret;
free(cs->alternateVisuals);
free(cs->implicitRedirectExceptions);
pScreen->CloseScreen = cs->CloseScreen;
pScreen->InstallColormap = cs->InstallColormap;
......
......@@ -41,6 +41,8 @@ extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pS
extern _X_EXPORT Bool compIsAlternateVisual(ScreenPtr pScreen, XID visual);
Bool CompositeIsImplicitRedirectException(ScreenPtr pScreen,
XID parentVisual, XID winVisual);
extern _X_EXPORT RESTYPE CompositeClientWindowType;
#endif /* _COMPOSITEEXT_H_ */
......@@ -339,9 +339,9 @@ compIsAlternateVisual(ScreenPtr pScreen, XID visual)
return FALSE;
}
static Bool
compIsImplicitRedirectException(ScreenPtr pScreen,
XID parentVisual, XID winVisual)
Bool
CompositeIsImplicitRedirectException(ScreenPtr pScreen,
XID parentVisual, XID winVisual)
{
CompScreenPtr cs = GetCompScreen(pScreen);
int i;
......@@ -362,7 +362,7 @@ compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
XID winVisual = wVisual(pWin);
XID parentVisual = wVisual(pParent);
if (compIsImplicitRedirectException(pScreen, parentVisual, winVisual))
if (CompositeIsImplicitRedirectException(pScreen, parentVisual, winVisual))
return FALSE;
if (winVisual != parentVisual &&
......
......@@ -107,7 +107,7 @@ glamor_copy_glyph(PixmapPtr glyph_pixmap,
glyph_draw->height,
0, 0, 0x1);
}
glamor_upload_boxes((PixmapPtr) atlas_draw,
glamor_upload_boxes(atlas_draw,
&box, 1,
0, 0,
x, y,
......
......@@ -26,19 +26,19 @@
#include "glamor_transform.h"
struct copy_args {
PixmapPtr src_pixmap;
DrawablePtr src_drawable;
glamor_pixmap_fbo *src;
uint32_t bitplane;
int dx, dy;
};
static Bool
use_copyarea(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
use_copyarea(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
struct copy_args *args = arg;
glamor_pixmap_fbo *src = args->src;
glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen),
glamor_bind_texture(glamor_get_screen_private(drawable->pScreen),
GL_TEXTURE0, src, TRUE);
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
......@@ -62,22 +62,22 @@ static const glamor_facet glamor_facet_copyarea = {
*/
static Bool
use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
use_copyplane(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
struct copy_args *args = arg;
glamor_pixmap_fbo *src = args->src;
glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen),
glamor_bind_texture(glamor_get_screen_private(drawable->pScreen),
GL_TEXTURE0, src, TRUE);
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
glamor_set_color(dst, gc->fgPixel, prog->fg_uniform);
glamor_set_color(dst, gc->bgPixel, prog->bg_uniform);
glamor_set_color(drawable, gc->fgPixel, prog->fg_uniform);
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
/* XXX handle 2 10 10 10 and 1555 formats; presumably the pixmap private knows this? */
switch (args->src_pixmap->drawable.depth) {
switch (args->src_drawable->depth) {
case 30:
glUniform4ui(prog->bitplane_uniform,
(args->bitplane >> 20) & 0x3ff,
......@@ -255,7 +255,7 @@ glamor_copy_cpu_fbo(DrawablePtr src,
fbCopy1toN(src, &tmp_pix->drawable, gc, box, nbox, dx, dy,
reverse, upsidedown, bitplane, closure);
glamor_upload_boxes(dst_pixmap, box, nbox, tmp_xoff, tmp_yoff,
glamor_upload_boxes(dst, box, nbox, tmp_xoff, tmp_yoff,
dst_xoff, dst_yoff, (uint8_t *) tmp_bits,
tmp_stride * sizeof(FbBits));
fbDestroyPixmap(tmp_pix);
......@@ -266,7 +266,7 @@ glamor_copy_cpu_fbo(DrawablePtr src,
int src_xoff, src_yoff;
fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
glamor_upload_boxes(dst, box, nbox, src_xoff + dx, src_yoff + dy,
dst_xoff, dst_yoff,
(uint8_t *) src_bits, src_stride * sizeof (FbBits));
}
......@@ -319,7 +319,7 @@ glamor_copy_fbo_cpu(DrawablePtr src,
fbGetDrawable(dst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
glamor_download_boxes(src_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
glamor_download_boxes(src, box, nbox, src_xoff + dx, src_yoff + dy,
dst_xoff, dst_yoff,
(uint8_t *) dst_bits, dst_stride * sizeof (FbBits));
glamor_finish_access(dst);
......@@ -401,7 +401,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
goto bail_ctx;
}
args.src_pixmap = src_pixmap;
args.src_drawable = src;
args.bitplane = bitplane;
/* Set up the vertex buffers for the points */
......@@ -453,7 +453,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
args.dy = dy + src_off_y - src_box->y1;
args.src = glamor_pixmap_fbo_at(src_priv, src_box_index);
if (!glamor_use_program(dst_pixmap, gc, prog, &args))
if (!glamor_use_program(dst, gc, prog, &args))
goto bail_ctx;
glamor_pixmap_loop(dst_priv, dst_box_index) {
......
......@@ -156,7 +156,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
switch (gc->lineStyle) {
case LineOnOffDash:
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->on_off_dash_line_progs,
&glamor_facet_on_off_dash_lines);
if (!prog)
......@@ -175,11 +175,11 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
goto bail;
}
if (!glamor_use_program(pixmap, gc, prog, NULL))
if (!glamor_use_program(drawable, gc, prog, NULL))
goto bail;
glamor_set_color(pixmap, gc->fgPixel, prog->fg_uniform);
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
glamor_set_color(drawable, gc->fgPixel, prog->fg_uniform);
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
break;
default:
......
......@@ -57,7 +57,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->poly_glyph_blt_progs,
&glamor_facet_poly_glyph_blt);
if (!prog)
......@@ -188,7 +188,7 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->poly_glyph_blt_progs,
&glamor_facet_poly_glyph_blt);
if (!prog)
......
......@@ -76,7 +76,7 @@ glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
glamor_make_current(glamor_priv);
glamor_upload_region(pixmap, &region, x, y, (uint8_t *) bits, byte_stride);
glamor_upload_region(drawable, &region, x, y, (uint8_t *) bits, byte_stride);
RegionUninit(&region);
return TRUE;
......@@ -124,7 +124,7 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
box.x2 = x + w;
box.y1 = y;
box.y2 = y + h;
glamor_download_boxes(pixmap, &box, 1,
glamor_download_boxes(drawable, &box, 1,
drawable->x + off_x, drawable->y + off_y,
-x, -y,
(uint8_t *) d, byte_stride);
......
......@@ -61,7 +61,7 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->poly_line_program,
&glamor_facet_poly_lines);
......
......@@ -66,7 +66,7 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
goto bail;
}
if (!glamor_use_program(pixmap, gc, prog, NULL))
if (!glamor_use_program(drawable, gc, prog, NULL))
goto bail;
vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset);
......
......@@ -25,19 +25,21 @@
#include "glamor_transfer.h"
/*
* Make a pixmap ready to draw with fb by
* Make a drawable ready to draw with fb by
* creating a PBO large enough for the whole object
* and downloading all of the FBOs into it.
*/
static Bool
glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
glamor_prep_drawable_box(DrawablePtr drawable, glamor_access_t access, BoxPtr box)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScreenPtr screen = drawable->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
int gl_access, gl_usage;
RegionRec region;
int off_x, off_y;
if (priv->type == GLAMOR_DRM_ONLY)
return FALSE;
......@@ -47,6 +49,11 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
glamor_make_current(glamor_priv);
glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
box->x1 += off_x;
box->x2 += off_x;
box->y1 += off_y;
box->y2 += off_y;
RegionInit(&region, box, 1);
/* See if it's already mapped */
......@@ -119,7 +126,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
priv->map_access = access;
}
glamor_download_boxes(pixmap, RegionRects(&region), RegionNumRects(&region),
glamor_download_boxes(drawable, RegionRects(&region), RegionNumRects(&region),
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
RegionUninit(&region);
......@@ -143,9 +150,10 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
* if we were writing to it and then unbind it to release the memory
*/
static void
glamor_fini_pixmap(PixmapPtr pixmap)
void
glamor_finish_access(DrawablePtr drawable)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
......@@ -154,14 +162,15 @@ glamor_fini_pixmap(PixmapPtr pixmap)
if (!priv->prepared)
return;
if (priv->pbo) {
if (priv->pbo &&
!(drawable->depth == 24 && pixmap->drawable.depth == 32)) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo);
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
pixmap->devPrivate.ptr = NULL;
}
if (priv->map_access == GLAMOR_ACCESS_RW) {
glamor_upload_boxes(pixmap,
glamor_upload_boxes(drawable,
RegionRects(&priv->prepare_region),
RegionNumRects(&priv->prepare_region),
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
......@@ -170,7 +179,11 @@ glamor_fini_pixmap(PixmapPtr pixmap)
RegionUninit(&priv->prepare_region);
if (priv->pbo) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
if (drawable->depth == 24 && pixmap->drawable.depth == 32)
pixmap->devPrivate.ptr = NULL;
else
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
glDeleteBuffers(1, &priv->pbo);
priv->pbo = 0;
} else {
......@@ -184,39 +197,26 @@ glamor_fini_pixmap(PixmapPtr pixmap)
Bool
glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
BoxRec box;
int off_x, off_y;
glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
box.x1 = drawable->x + off_x;
box.x1 = drawable->x;
box.x2 = box.x1 + drawable->width;
box.y1 = drawable->y + off_y;
box.y1 = drawable->y;
box.y2 = box.y1 + drawable->height;
return glamor_prep_pixmap_box(pixmap, access, &box);
return glamor_prep_drawable_box(drawable, access, &box);
}
Bool
glamor_prepare_access_box(DrawablePtr drawable, glamor_access_t access,
int x, int y, int w, int h)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
BoxRec box;
int off_x, off_y;
glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
box.x1 = drawable->x + x + off_x;
box.x1 = drawable->x + x;
box.x2 = box.x1 + w;
box.y1 = drawable->y + y + off_y;
box.y1 = drawable->y + y;
box.y2 = box.y1 + h;
return glamor_prep_pixmap_box(pixmap, access, &box);
}
void
glamor_finish_access(DrawablePtr drawable)
{
glamor_fini_pixmap(glamor_get_drawable_pixmap(drawable));
return glamor_prep_drawable_box(drawable, access, &box);
}
/*
......
......@@ -25,9 +25,9 @@
#include "glamor_program.h"
static Bool
use_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
use_solid(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
return glamor_set_solid(pixmap, gc, TRUE, prog->fg_uniform);
return glamor_set_solid(drawable, gc, TRUE, prog->fg_uniform);
}
const glamor_facet glamor_fill_solid = {
......@@ -38,9 +38,9 @@ const glamor_facet glamor_fill_solid = {
};
static Bool
use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
use_tile(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform);
return glamor_set_tiled(drawable, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform);
}
static const glamor_facet glamor_fill_tile = {
......@@ -52,9 +52,9 @@ static const glamor_facet glamor_fill_tile = {
};
static Bool
use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
use_stipple(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
return glamor_set_stippled(pixmap, gc, prog->fg_uniform,
return glamor_set_stippled(drawable, gc, prog->fg_uniform,
prog->fill_offset_uniform,
prog->fill_size_inv_uniform);
}
......@@ -71,11 +71,11 @@ static const glamor_facet glamor_fill_stipple = {
};
static Bool
use_opaque_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
use_opaque_stipple(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
if (!use_stipple(pixmap, gc, prog, arg))
if (!use_stipple(drawable, gc, prog, arg))
return FALSE;
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
return TRUE;
}
......@@ -401,29 +401,29 @@ fail:
}
Bool
glamor_use_program(PixmapPtr pixmap,
glamor_use_program(DrawablePtr drawable,
GCPtr gc,
glamor_program *prog,
void *arg)
{
glUseProgram(prog->prog);
if (prog->prim_use && !prog->prim_use(pixmap, gc, prog, arg))
if (prog->prim_use && !prog->prim_use(drawable, gc, prog, arg))
return FALSE;
if (prog->fill_use && !prog->fill_use(pixmap, gc, prog, arg))
if (prog->fill_use && !prog->fill_use(drawable, gc, prog, arg))
return FALSE;
return TRUE;
}
glamor_program *
glamor_use_program_fill(PixmapPtr pixmap,
glamor_use_program_fill(DrawablePtr drawable,
GCPtr gc,
glamor_program_fill *program_fill,
const glamor_facet *prim)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScreenPtr screen = drawable->pScreen;
glamor_program *prog = &program_fill->progs[gc->fillStyle];
int fill_style = gc->fillStyle;
......@@ -441,7 +441,7 @@ glamor_use_program_fill(PixmapPtr pixmap,
return NULL;
}
if (!glamor_use_program(pixmap, gc, prog, NULL))
if (!glamor_use_program(drawable, gc, prog, NULL))
return NULL;
return prog;
......
......@@ -50,7 +50,7 @@ typedef enum {
typedef struct _glamor_program glamor_program;
typedef Bool (*glamor_use) (PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg);
typedef Bool (*glamor_use) (DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg);
typedef Bool (*glamor_use_render) (CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog);
......@@ -108,13 +108,13 @@ glamor_build_program(ScreenPtr screen,
const char *defines);
Bool
glamor_use_program(PixmapPtr pixmap,
glamor_use_program(DrawablePtr drawable,
GCPtr gc,
glamor_program *prog,
void *arg);
glamor_program *
glamor_use_program_fill(PixmapPtr pixmap,
glamor_use_program_fill(DrawablePtr drawable,
GCPtr gc,
glamor_program_fill *program_fill,
const glamor_facet *prim);
......
......@@ -70,7 +70,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
}
if (glamor_glsl_has_ints(glamor_priv)) {
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->poly_fill_rect_program,
&glamor_facet_polyfillrect_130);
......@@ -97,7 +97,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
} else {
int n;
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->poly_fill_rect_program,
&glamor_facet_polyfillrect_120);
......
......@@ -58,7 +58,7 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc,
prog = glamor_use_program_fill(drawable, gc,
&glamor_priv->poly_segment_program,
&glamor_facet_poly_segment);
......
......@@ -65,7 +65,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
glamor_make_current(glamor_priv);
if (glamor_glsl_has_ints(glamor_priv)) {
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
prog = glamor_use_program_fill(drawable, gc, &glamor_priv->fill_spans_program,
&glamor_facet_fillspans_130);
if (!prog)
......@@ -90,7 +90,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
glamor_put_vbo_space(screen);
} else {
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
prog = glamor_use_program_fill(drawable, gc, &glamor_priv->fill_spans_program,
&glamor_facet_fillspans_120);
if (!prog)
......
......@@ -288,7 +288,7 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
prog = glamor_use_program_fill(drawable, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
if (!prog)
goto bail;
......@@ -346,9 +346,9 @@ static const glamor_facet glamor_facet_image_text = {
};
static Bool
use_image_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
use_image_solid(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
return glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform);
return glamor_set_solid(drawable, gc, FALSE, prog->fg_uniform);
}
static const glamor_facet glamor_facet_image_fill = {
......@@ -359,11 +359,11 @@ static const glamor_facet glamor_facet_image_fill = {
};
static Bool
glamor_te_text_use(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
glamor_te_text_use(DrawablePtr drawable, GCPtr gc, glamor_program *prog, void *arg)
{
if (!glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform))
if (!glamor_set_solid(drawable, gc, FALSE, prog->fg_uniform))
return FALSE;
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
glamor_set_color(drawable, gc->bgPixel, prog->bg_uniform);
return TRUE;
}
......@@ -461,7 +461,7 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
RegionUninit(&region);
}
if (!glamor_use_program(pixmap, gc, prog, NULL))
if (!glamor_use_program(drawable, gc, prog, NULL))
goto bail;
(void) glamor_text(drawable, gc, glamor_font, prog,
......
......@@ -24,20 +24,25 @@
#include "glamor_transfer.h"
/*
* Write a region of bits into a pixmap
* Write a region of bits into a drawable's backing pixmap
*/
void
glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_upload_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
int dx_src, int dy_src,
int dx_dst, int dy_dst,
uint8_t *bits, uint32_t byte_stride)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScreenPtr screen = drawable->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
int box_index;
int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
int bytes_per_pixel = drawable->bitsPerPixel >> 3;
const struct glamor_format *f = glamor_format_for_pixmap(pixmap);
char *tmp_bits = NULL;
if (drawable->depth == 24 && pixmap->drawable.depth == 32)
tmp_bits = xnfalloc(byte_stride * pixmap->drawable.height);
glamor_make_current(glamor_priv);
......@@ -62,6 +67,7 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
int y1 = MAX(boxes->y1 + dy_dst, box->y1);
int y2 = MIN(boxes->y2 + dy_dst, box->y2);
uint32_t *src_line;
size_t ofs = (y1 - dy_dst + dy_src) * byte_stride;
ofs += (x1 - dx_dst + dx_src) * bytes_per_pixel;
......@@ -70,24 +76,42 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
if (x2 <= x1 || y2 <= y1)
continue;
src_line = (uint32_t *)(bits + ofs);
if (tmp_bits) {
uint32_t *tmp_line = (uint32_t *)(tmp_bits + ofs);
int x, y;
/* Make sure any sampling of the alpha channel will return 1.0 */
for (y = y1; y < y2;
y++, src_line += byte_stride / 4, tmp_line += byte_stride / 4) {
for (x = 0; x < x2 - x1; x++)
tmp_line[x] = src_line[x] | 0xff000000;
}
src_line = (uint32_t *)(tmp_bits + ofs);
}
if (glamor_priv->has_unpack_subimage ||
x2 - x1 == byte_stride / bytes_per_pixel) {
glTexSubImage2D(GL_TEXTURE_2D, 0,
x1 - box->x1, y1 - box->y1,
x2 - x1, y2 - y1,
f->format, f->type,
bits + ofs);
src_line);
} else {
for (; y1 < y2; y1++, ofs += byte_stride)
for (; y1 < y2; y1++, src_line += byte_stride / bytes_per_pixel)
glTexSubImage2D(GL_TEXTURE_2D, 0,
x1 - box->x1, y1 - box->y1,
x2 - x1, 1,
f->format, f->type,
bits + ofs);
src_line);
}
}
}
free(tmp_bits);
if (glamor_priv->has_unpack_subimage)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
......@@ -97,46 +121,31 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
*/
void
glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
glamor_upload_region(DrawablePtr drawable, RegionPtr region,
int region_x, int region_y,
uint8_t *bits, uint32_t byte_stride)
{
glamor_upload_boxes(pixmap, RegionRects(region), RegionNumRects(region),
glamor_upload_boxes(drawable, RegionRects(region), RegionNumRects(region),
-region_x, -region_y,
0, 0,
bits, byte_stride);
}
/*
* Take the data in the pixmap and stuff it back into the FBO
* Read stuff from the drawable's backing pixmap FBOs and write to memory
*/
void
glamor_upload_pixmap(PixmapPtr pixmap)
{
BoxRec box;
box.x1 = 0;
box.x2 = pixmap->drawable.width;
box.y1 = 0;
box.y2 = pixmap->drawable.height;
glamor_upload_boxes(pixmap, &box, 1, 0, 0, 0, 0,
pixmap->devPrivate.ptr, pixmap->devKind);
}
/*
* Read stuff from the pixmap FBOs and write to memory
*/
void
glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_download_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
int dx_src, int dy_src,
int dx_dst, int dy_dst,
uint8_t *bits, uint32_t byte_stride)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScreenPtr screen = drawable->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
int box_index;
int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
int bytes_per_pixel = drawable->bitsPerPixel >> 3;
const struct glamor_format *f = glamor_format_for_pixmap(pixmap);
glamor_make_current(glamor_priv);
......@@ -182,37 +191,3 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
if (glamor_priv->has_pack_subimage)
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
}
/*
* Read data from the pixmap FBO
*/
void
glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits)
{
BoxRec box;
box.x1 = x;
box.x2 = x + w;
box.y1 = y;
box.y2 = y + h;
glamor_download_boxes(pixmap, &box, 1, 0, 0, -x, -y,
bits, PixmapBytePad(w, pixmap->drawable.depth));
}
/*
* Pull the data from the FBO down to the pixmap
*/
void
glamor_download_pixmap(PixmapPtr pixmap)
{
BoxRec box;
box.x1 = 0;
box.x2 = pixmap->drawable.width;
box.y1 = 0;
box.y2 = pixmap->drawable.height;
glamor_download_boxes(pixmap, &box, 1, 0, 0, 0, 0,
pixmap->devPrivate.ptr, pixmap->devKind);
}
......@@ -24,29 +24,20 @@
#define _GLAMOR_TRANSFER_H_
void
glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_upload_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
int dx_src, int dy_src,
int dx_dst, int dy_dst,
uint8_t *bits, uint32_t byte_stride);
void
glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
glamor_upload_region(DrawablePtr drawable, RegionPtr region,
int region_x, int region_y,
uint8_t *bits, uint32_t byte_stride);
void
glamor_upload_pixmap(PixmapPtr pixmap);
void
glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_download_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
int dx_src, int dy_src,
int dx_dst, int dy_dst,
uint8_t *bits, uint32_t byte_stride);
void
glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits);
void
glamor_download_pixmap(PixmapPtr pixmap);
#endif /* _GLAMOR_TRANSFER_H_ */
......@@ -130,7 +130,7 @@ glamor_set_color_depth(ScreenPtr pScreen,
}
Bool
glamor_set_solid(PixmapPtr pixmap,
glamor_set_solid(DrawablePtr drawable,
GCPtr gc,
Bool use_alu,
GLint uniform)
......@@ -143,7 +143,7 @@ glamor_set_solid(PixmapPtr pixmap,
pixel = gc->fgPixel;
if (!glamor_set_alu(pixmap->drawable.pScreen, alu)) {
if (!glamor_set_alu(drawable->pScreen, alu)) {
switch (gc->alu) {
case GXclear:
pixel = 0;
......@@ -158,7 +158,7 @@ glamor_set_solid(PixmapPtr pixmap,
return FALSE;
}
}
glamor_set_color(pixmap, pixel, uniform);
glamor_set_color(drawable, pixel, uniform);
return TRUE;
}
......@@ -204,12 +204,12 @@ glamor_set_texture(PixmapPtr texture,
}
Bool
glamor_set_tiled(PixmapPtr pixmap,
glamor_set_tiled(DrawablePtr drawable,
GCPtr gc,
GLint offset_uniform,
GLint size_inv_uniform)
{
if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu))
if (!glamor_set_alu(drawable->pScreen, gc->alu))
return FALSE;
if (!glamor_set_planemask(gc->depth, gc->planemask))
......@@ -282,7 +282,7 @@ bail:
}
Bool
glamor_set_stippled(PixmapPtr pixmap,
glamor_set_stippled(DrawablePtr drawable,
GCPtr gc,
GLint fg_uniform,
GLint offset_uniform,
......@@ -294,7 +294,7 @@ glamor_set_stippled(PixmapPtr pixmap,
if (!stipple)
return FALSE;
if (!glamor_set_solid(pixmap, gc, TRUE, fg_uniform))
if (!glamor_set_solid(drawable, gc, TRUE, fg_uniform))
return FALSE;
return glamor_set_texture(stipple,
......