From: Samuel Thibault Subject: Re: [PATCH 0/2] fbif: Add offset in resize event Date: Wed, 26 Mar 2008 11:10:23 +0000 Message-ID: <20080326111023.GB5636@implementation.uk.xensource.com> References: <20080326110940.GA5636@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20080326110940.GA5636@implementation.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org fbfront: Add offset in resize event Also support depth change. Signed-off-by: Samuel Thibault diff -r 966c04d42e94 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Wed Mar 26 09:12:57 2008 +0000 +++ b/tools/ioemu/hw/xenfb.c Wed Mar 26 11:05:07 2008 +0000 @@ -56,6 +56,7 @@ int depth; /* colour depth of guest framebuffer */ int width; /* pixel width of guest framebuffer */ int height; /* pixel height of guest framebuffer */ + int offset; /* offset of the framebuffer */ int abs_pointer_wanted; /* Whether guest supports absolute pointer */ int button_state; /* Last seen pointer button state */ char protocol[64]; /* frontend protocol */ @@ -519,11 +520,13 @@ case XENFB_TYPE_RESIZE: xenfb->width = event->resize.width; xenfb->height = event->resize.height; + xenfb->depth = event->resize.depth; xenfb->row_stride = event->resize.stride; + xenfb->offset = event->resize.offset; dpy_colourdepth(xenfb->ds, xenfb->depth); dpy_resize(xenfb->ds, xenfb->width, xenfb->height, xenfb->row_stride); if (xenfb->ds->shared_buf) - dpy_setdata(xenfb->ds, xenfb->pixels); + dpy_setdata(xenfb->ds, xenfb->pixels + xenfb->offset); xenfb_invalidate(xenfb); break; } @@ -1105,6 +1108,7 @@ #define BLT(SRC_T,DST_T,RSB,GSB,BSB,RDB,GDB,BDB) \ for (line = y ; line < (y+h) ; line++) { \ SRC_T *src = (SRC_T *)(xenfb->pixels \ + + xenfb->offset \ + (line * xenfb->row_stride) \ + (x * xenfb->depth / 8)); \ DST_T *dst = (DST_T *)(xenfb->ds->data \ @@ -1147,7 +1151,7 @@ if (xenfb->depth == xenfb->ds->depth) { /* Perfect match can use fast path */ for (line = y ; line < (y+h) ; line++) { memcpy(xenfb->ds->data + (line * xenfb->ds->linesize) + (x * xenfb->ds->depth / 8), - xenfb->pixels + (line * xenfb->row_stride) + (x * xenfb->depth / 8), + xenfb->pixels + xenfb->offset + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8); } } else { /* Mismatch requires slow pixel munging */ --- a/xen/include/public/io/fbif.h Wed Mar 26 09:12:57 2008 +0000 +++ b/xen/include/public/io/fbif.h Wed Mar 26 11:05:08 2008 +0000 @@ -63,6 +63,7 @@ int32_t height; /* height in pixels */ int32_t stride; /* stride in bytes */ int32_t depth; /* depth in bits */ + int32_t offset; /* offset of the framebuffer in bytes */ }; #define XENFB_OUT_EVENT_SIZE 40