[Mesa-dev] Trying to add pixmap support in native_fabdev

Vivek Singh vivek.siwan at gmail.com
Sat Sep 24 10:50:42 PDT 2011


On Sat, Sep 24, 2011 at 11:13 PM, <mesa-dev-request at lists.freedesktop.org>wrote:

> Send mesa-dev mailing list submissions to
>        mesa-dev at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> or, via email, send a message with subject or body 'help' to
>        mesa-dev-request at lists.freedesktop.org
>
> You can reach the person managing the list at
>        mesa-dev-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of mesa-dev digest..."
>
>
> Today's Topics:
>
>   1. [PATCH 2/4] d3d1x: propagate DepthBiasClamp to    rasterizer cso
>      (Christoph Bumiller)
>   2. [PATCH 3/4] nv50, nvc0: support polygon offset clamp state
>      (Christoph Bumiller)
>   3. [PATCH 4/4] r600: support polygon offset clamp state
>      (Christoph Bumiller)
>   4. Re: Welcome to the "mesa-dev" mailing list (Digest mode)
>      (Vivek Singh)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 24 Sep 2011 15:47:22 +0200
> From: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
> Subject: [Mesa-dev] [PATCH 2/4] d3d1x: propagate DepthBiasClamp to
>        rasterizer cso
> To: mesa-dev at lists.freedesktop.org
> Message-ID:
>        <1316872044-23685-2-git-send-email-e0425955 at student.tuwien.ac.at>
>
> ---
>  .../state_trackers/d3d1x/gd3d11/d3d11_screen.h     |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
> b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
> index 3674731..ef23b7d 100644
> --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
> +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
> @@ -504,11 +504,10 @@ struct GalliumD3D11ScreenImpl : public
> GalliumD3D11Screen
>                else
>                        state.cull_face = PIPE_FACE_NONE;
>                state.front_ccw = !!rasterizer_desc->FrontCounterClockwise;
> -               /* TODO: is this correct? */
> -               /* TODO: we are ignoring depthBiasClamp! */
>                state.offset_tri = state.offset_line = state.offset_point =
> rasterizer_desc->SlopeScaledDepthBias || rasterizer_desc->DepthBias;
>                state.offset_scale = rasterizer_desc->SlopeScaledDepthBias;
>                state.offset_units = rasterizer_desc->DepthBias;
> +               state.offset_clamp = rasterizer_desc->DepthBiasClamp;
>                state.scissor = !!rasterizer_desc->ScissorEnable;
>                state.multisample = !!rasterizer_desc->MultisampleEnable;
>                state.line_smooth =
> !!rasterizer_desc->AntialiasedLineEnable;
> --
> 1.7.3.4
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 24 Sep 2011 15:47:23 +0200
> From: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
> Subject: [Mesa-dev] [PATCH 3/4] nv50,   nvc0: support polygon offset
>        clamp state
> To: mesa-dev at lists.freedesktop.org
> Message-ID:
>        <1316872044-23685-3-git-send-email-e0425955 at student.tuwien.ac.at>
>
> ---
>  src/gallium/drivers/nv50/nv50_3d.xml.h   |    2 +-
>  src/gallium/drivers/nv50/nv50_state.c    |    2 ++
>  src/gallium/drivers/nv50/nv50_stateobj.h |    2 +-
>  src/gallium/drivers/nvc0/nvc0_3d.xml.h   |    2 ++
>  src/gallium/drivers/nvc0/nvc0_state.c    |    2 ++
>  src/gallium/drivers/nvc0/nvc0_stateobj.h |    2 +-
>  6 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nv50/nv50_3d.xml.h
> b/src/gallium/drivers/nv50/nv50_3d.xml.h
> index 1bde07f..0f5a77d 100644
> --- a/src/gallium/drivers/nv50/nv50_3d.xml.h
> +++ b/src/gallium/drivers/nv50/nv50_3d.xml.h
> @@ -1658,7 +1658,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>  #define NV50_3D_GP_RESULT_MAP_3__MASK                          0xff000000
>  #define NV50_3D_GP_RESULT_MAP_3__SHIFT                         24
>
> -#define NV50_3D_UNK187C
>  0x0000187c
> +#define NV50_3D_POLYGON_OFFSET_CLAMP                           0x0000187c
>
>  #define NVA3_3D_VERTEX_ARRAY_PER_INSTANCE_ALT(i0)             (0x00001880
> + 0x4*(i0))
>  #define NVA3_3D_VERTEX_ARRAY_PER_INSTANCE_ALT__ESIZE           0x00000004
> diff --git a/src/gallium/drivers/nv50/nv50_state.c
> b/src/gallium/drivers/nv50/nv50_state.c
> index 49ea646..9382557 100644
> --- a/src/gallium/drivers/nv50/nv50_state.c
> +++ b/src/gallium/drivers/nv50/nv50_state.c
> @@ -308,6 +308,8 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
>       SB_DATA    (so, fui(cso->offset_scale));
>       SB_BEGIN_3D(so, POLYGON_OFFSET_UNITS, 1);
>       SB_DATA    (so, fui(cso->offset_units * 2.0f));
> +      SB_BEGIN_3D(so, POLYGON_OFFSET_CLAMP, 1);
> +      SB_DATA    (so, fui(cso->offset_clamp));
>    }
>
>    assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
> diff --git a/src/gallium/drivers/nv50/nv50_stateobj.h
> b/src/gallium/drivers/nv50/nv50_stateobj.h
> index d367a06..5b914d8 100644
> --- a/src/gallium/drivers/nv50/nv50_stateobj.h
> +++ b/src/gallium/drivers/nv50/nv50_stateobj.h
> @@ -27,7 +27,7 @@ struct nv50_blend_stateobj {
>  struct nv50_rasterizer_stateobj {
>    struct pipe_rasterizer_state pipe;
>    int size;
> -   uint32_t state[44];
> +   uint32_t state[45];
>  };
>
>  struct nv50_zsa_stateobj {
> diff --git a/src/gallium/drivers/nvc0/nvc0_3d.xml.h
> b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
> index 6301637..9264b72 100644
> --- a/src/gallium/drivers/nvc0/nvc0_3d.xml.h
> +++ b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
> @@ -981,6 +981,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>
>  #define NVC0_3D_INDEX_BATCH_COUNT                              0x000017e0
>
> +#define NVC0_3D_POLYGON_OFFSET_CLAMP                           0x0000187c
> +
>  #define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE(i0)                 (0x00001880
> + 0x4*(i0))
>  #define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE__ESIZE               0x00000004
>  #define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE__LEN                 0x00000020
> diff --git a/src/gallium/drivers/nvc0/nvc0_state.c
> b/src/gallium/drivers/nvc0/nvc0_state.c
> index 9f9921c..1a37d04 100644
> --- a/src/gallium/drivers/nvc0/nvc0_state.c
> +++ b/src/gallium/drivers/nvc0/nvc0_state.c
> @@ -266,6 +266,8 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe,
>         SB_DATA    (so, fui(cso->offset_scale));
>         SB_BEGIN_3D(so, POLYGON_OFFSET_UNITS, 1);
>         SB_DATA    (so, fui(cso->offset_units * 2.0f));
> +        SB_BEGIN_3D(so, POLYGON_OFFSET_CLAMP, 1);
> +        SB_DATA    (so, fui(cso->offset_clamp));
>     }
>
>     assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
> diff --git a/src/gallium/drivers/nvc0/nvc0_stateobj.h
> b/src/gallium/drivers/nvc0/nvc0_stateobj.h
> index 0686c52..ecf9655 100644
> --- a/src/gallium/drivers/nvc0/nvc0_stateobj.h
> +++ b/src/gallium/drivers/nvc0/nvc0_stateobj.h
> @@ -25,7 +25,7 @@ struct nvc0_blend_stateobj {
>  struct nvc0_rasterizer_stateobj {
>    struct pipe_rasterizer_state pipe;
>    int size;
> -   uint32_t state[39];
> +   uint32_t state[40];
>  };
>
>  struct nvc0_zsa_stateobj {
> --
> 1.7.3.4
>
>
>
> ------------------------------
>
> Message: 3
> Date: Sat, 24 Sep 2011 15:47:24 +0200
> From: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
> Subject: [Mesa-dev] [PATCH 4/4] r600: support polygon offset clamp
>        state
> To: mesa-dev at lists.freedesktop.org
> Message-ID:
>        <1316872044-23685-4-git-send-email-e0425955 at student.tuwien.ac.at>
>
> ---
>  src/gallium/drivers/r600/evergreen_state.c |    2 +-
>  src/gallium/drivers/r600/r600_state.c      |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c
> b/src/gallium/drivers/r600/evergreen_state.c
> index 3b7844f..7a6b246 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -921,7 +921,7 @@ static void *evergreen_create_rs_state(struct
> pipe_context *ctx,
>
>  S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules),
>                                        0xFFFFFFFF, NULL, 0);
>        }
> -       r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP,
> 0x0, 0xFFFFFFFF, NULL, 0);
> +       r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP,
> fui(state->offset_clamp), 0xFFFFFFFF, NULL, 0);
>        r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE,
> clip_rule, 0xFFFFFFFF, NULL, 0);
>        return rstate;
>  }
> diff --git a/src/gallium/drivers/r600/r600_state.c
> b/src/gallium/drivers/r600/r600_state.c
> index 2e2ce40..c6a9630 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -960,7 +960,7 @@ static void *r600_create_rs_state(struct pipe_context
> *ctx,
>        r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ,
> 0x3F800000, 0xFFFFFFFF, NULL, 0);
>        r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ,
> 0x3F800000, 0xFFFFFFFF, NULL, 0);
>        r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ,
> 0x3F800000, 0xFFFFFFFF, NULL, 0);
> -       r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP,
> 0x00000000, 0xFFFFFFFF, NULL, 0);
> +       r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP,
> fui(state->offset_clamp), 0xFFFFFFFF, NULL, 0);
>        r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE,
> clip_rule, 0xFFFFFFFF, NULL, 0);
>
>        return rstate;
> --
> 1.7.3.4
>
>
>
> ------------------------------
>
> Message: 4
> Date: Sat, 24 Sep 2011 23:13:52 +0530
> From: Vivek Singh <vivek.siwan at gmail.com>
> Subject: Re: [Mesa-dev] Welcome to the "mesa-dev" mailing list (Digest
>        mode)
> To: mesa-dev at lists.freedesktop.org
> Message-ID:
>        <CAJrcCc2eZrCegNUDFkqMn2zTrPKw908W6f9ePqLkU-sfxNdJ1A at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello All
>
>  I am using Mesa-7.10.2 stack.
>
> I am trying to run EGL with egl_gallium state trackers
> (GLES=>EGL=>egl_gallium=>
> fbdev) over fbdev with following
>
> configuration
>
>
> ./configure --prefix=/opt/mesa-arm-genoa-new --host=arm-linux
> --build=i686-linux --enable-gles2 --with-x=no
>
> --with-egl-platforms=fbdev  --with-egl-displays=fbdev --with-driver=no
> --disable-glu --disable-glw --disable-glut
>
> --disable-gl-osmesa --disable-opengl --enable-debug --enable-gles-overlay
>
> I am able to run applications which can draw directly on scanout
> surfaces/pbuffer (es2gears).
>
> I want to run application which uses eglCreateImageKHR (with user defined
> pixmap structures) to make textures
> and eglCreatePixmapSurface (with user defined pixmap structures) to create
> a
> Pixmap surfaces. Since Native_fbdev.c doesnot
>
> support pixmap surfaces both calls fail.
>      I tried to put pixmap support in native_fbdev.c with following steps
> 1)putting a function in
>  fbdpy->base.destroy = fbdev_display_destroy;
>  fbdpy->base.get_param = fbdev_display_get_param;
>  fbdpy->base.get_configs = fbdev_display_get_configs;
>
>  /*Adding function to create PIXMAP surface*/
>  fbdpy->base.is_pixmap_supported = fbdev_display_is_pixmap_supported;
>  fbdpy->base.create_pixmap_surface = fbdev_display_create_pixmap_surface;
>
> 2)Added support flag true in native_config
>  pixmap_bit=true;
>
> I am able to get finctions  eglCreateImageKHR/eglCreatePixmapSurface run
> successfully able to get user defined pixmap
> to native_fbdev by typecasting it ot EGLNativePixmaptype. But I am not able
> to draw any texture on EGLImage. I suspect
> glEGLImageTargetTexture2DOES is not working properly with EGLImage returned
> from eglCreateImageKHR.
>
> I dont know how I can make it visible to GLES by calling function like
> glEGLImageTargetTexture2DOES.
>
> I am very new to GLES and EGL . Please provide me suggestions so that I can
> proceed further.
>
> For convenient i am putting my code which I have inserted to native_fbdev.c
>
> static struct native_surface *
> fbdev_display_create_pixmap_surface(struct native_display *ndpy,
>                                    EGLNativePixmapType pix,
>                                    const struct native_config *nconf)
> {
>  printf("START %s    %s\n", __FUNCTION__, __FILE__);
>  fbdev_pixmap  *pixmap = (fbdev_pixmap *)pix;
>  /*Trying To print pixmap detail*/
>
>  printf("pixmap->height                 ::%d\n", pixmap->height);
>  printf("pixmap->width                  ::%d\n",  pixmap->width);
>  printf("pixmap->bytes_per_pixel        ::%d\n", pixmap->bytes_per_pixel);
>  printf("pixmap->buffer_size            ::%d\n",  pixmap->buffer_size);
>  printf("pixmap->red_size               ::%d\n", pixmap->red_size);
>  printf("pixmap->green_size             ::%d\n",  pixmap->green_size);
>  printf("pixmap->red_size               ::%d\n", pixmap->blue_size);
>  printf("pixmap->alpha_size             ::%d\n",  pixmap->alpha_size);
>  printf("pixmap->luminance_size         ::%d\n", pixmap->luminance_size);
>  printf("pixmap->flags                  ::%d\n",  pixmap->flags);
>  printf("pixmap->data              ::%p\n",   pixmap->data);
>
>  struct fbdev_display *fbdpy = fbdev_display(ndpy);
>  struct fbdev_surface *fbsurf;
>  fbsurf = CALLOC_STRUCT(fbdev_surface);
>  if (!fbsurf)
>     return NULL;
>  fbsurf->fbdpy = fbdpy;
>  fbsurf->width = pixmap->width;
>  fbsurf->height =  pixmap->height;
>  fbsurf->type = FBDEV_SURFACE_TYPE_PIXMAP;
>  fbsurf->pixmap = pix;
>  fbsurf->rsurf = resource_surface_create(fbdpy->base.screen,
>        nconf->color_format,
>        PIPE_BIND_RENDER_TARGET |
>        PIPE_BIND_DISPLAY_TARGET |  PIPE_BIND_SCANOUT );
>
>  if (!fbsurf->rsurf) {
>     FREE(fbsurf);
>     return NULL;
>  }
>
>  resource_surface_set_size(fbsurf->rsurf, fbsurf->width, fbsurf->height);
>
>  fbsurf->base.destroy = fbdev_surface_destroy;
>  fbsurf->base.present = fbdev_surface_present;
>  fbsurf->base.validate = fbdev_surface_validate;
>  fbsurf->base.wait = fbdev_surface_wait;
>
>  printf("END %s    %s\n", __FUNCTION__, __FILE__);
>  return &fbsurf->base;
>
> }
>
> static struct native_display *
> fbdev_display_create(int fd, struct native_event_handler *event_handler,
>                    void *user_data)
> {
>  struct fbdev_display *fbdpy;
>
>  fbdpy = CALLOC_STRUCT(fbdev_display);
>  if (!fbdpy)
>     return NULL;
>
>  fbdpy->fd = fd;
>  fbdpy->event_handler = event_handler;
>  fbdpy->base.user_data = user_data;
>
>  if (!fbdev_display_init(&fbdpy->base)) {
>     FREE(fbdpy);
>     return NULL;
>  }
>
>  fbdpy->base.destroy = fbdev_display_destroy;
>  fbdpy->base.get_param = fbdev_display_get_param;
>  fbdpy->base.get_configs = fbdev_display_get_configs;
>
>  /*Vivek:: Adding function to create PIXMAP surface*/
>   fbdpy->base.is_pixmap_supported = fbdev_display_is_pixmap_supported;
>   fbdpy->base.create_pixmap_surface = fbdev_display_create_pixmap_surface;
>
>   fbdpy->base.modeset = &fbdev_display_modeset;
>
>  return &fbdpy->base;
> }
>
> static boolean
> fbdev_display_is_pixmap_supported(struct native_display *ndpy,
>                                  EGLNativePixmapType pix,
>                                  const struct native_config *nconf)
> {
>  printf("START   %s     %s\n", __FUNCTION__, __FILE__);
>  struct fbdev_display *fdpy = fbdev_display(ndpy);
>  enum pipe_format fmt;
>  uint depth;
>  depth =  32; //hard coded for 4bpp
>  switch (depth) {
>  case 32:
>     fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
>     break;
>  case 24:
>     fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
>     break;
>  case 16:
>     fmt = PIPE_FORMAT_B5G6R5_UNORM;
>     break;
>  default:
>     fmt = PIPE_FORMAT_NONE;
>     break;
>  }
>
>  return (fmt == nconf->color_format);
> }
>
> static boolean
> fbdev_surface_flush_frontbuffer(struct native_surface *nsurf)
> {
>  printf("%s    %s\n", __FUNCTION__, __FILE__);
>  struct fbdev_surface *fbsurf = fbdev_surface(nsurf);
>
>  if (!fbsurf->is_current)
>     return TRUE;
>
>  if(fbsurf->type == FBDEV_SURFACE_TYPE_PIXMAP)   //Vivek
>       {
>
>          return resource_surface_present(fbsurf->rsurf,
> NATIVE_ATTACHMENT_FRONT_LEFT, fbsurf->pixmap);
>       }
>  else
>       {
>          return resource_surface_present(fbsurf->rsurf,
> NATIVE_ATTACHMENT_FRONT_LEFT, NULL);
>       }
>
> }
>
>
> Regards
> Vivek
>
> On Sat, Sep 24, 2011 at 11:08 PM, <mesa-dev-request at lists.freedesktop.org
> >wrote:
>
> > Welcome to the mesa-dev at lists.freedesktop.org mailing list!
> >
> > To post to this list, send your email to:
> >
> >  mesa-dev at lists.freedesktop.org
> >
> > General information about the mailing list is at:
> >
> >  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> > If you ever want to unsubscribe or change your options (eg, switch to
> > or from digest mode, change your password, etc.), visit your
> > subscription page at:
> >
> >
> >
> http://lists.freedesktop.org/mailman/options/mesa-dev/vivek.siwan%40gmail.com
> >
> >
> > You can also make such adjustments via email by sending a message to:
> >
> >  mesa-dev-request at lists.freedesktop.org
> >
> > with the word `help' in the subject or body (don't include the
> > quotes), and you will get back a message with instructions.
> >
> > You must know your password to change your options (including changing
> > the password, itself) or to unsubscribe.  It is:
> >
> >  himmatwala
> >
> > Normally, Mailman will remind you of your lists.freedesktop.org
> > mailing list passwords once every month, although you can disable this
> > if you prefer.  This reminder will also include instructions on how to
> > unsubscribe or change your account options.  There is also a button on
> > your options page that will email your current password to you.
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.freedesktop.org/archives/mesa-dev/attachments/20110924/e3646c39/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
> End of mesa-dev Digest, Vol 18, Issue 186
> *****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110924/864329d2/attachment-0001.htm>


More information about the mesa-dev mailing list